cppbind: add naContext/naRef overload to Ghost::_set

This commit is contained in:
Thomas Geymayer
2014-05-06 16:11:13 +02:00
parent 247aa49849
commit 9642f6d946

View File

@@ -538,7 +538,7 @@ namespace nasal
* @endcode
*/
template<class Param>
Ghost _set(bool (raw_type::*setter)(const std::string&, Param))
Ghost& _set(bool (raw_type::*setter)(const std::string&, Param))
{
// Setter signature: bool( naContext,
// raw_type&,
@@ -552,6 +552,34 @@ namespace nasal
));
}
/**
* Register a method which is called upon setting an unknown member of
* this ghost.
*
* @code{cpp}
* class MyClass
* {
* public:
* bool setMember( naContext c,
* const std::string& key,
* naRef value );
* }
*
* Ghost<MyClassPtr>::init("Test")
* ._set(&MyClass::setMember);
* @endcode
*/
Ghost& _set(bool (raw_type::*setter)( naContext,
const std::string&,
naRef ))
{
// Setter signature: bool( naContext,
// raw_type&,
// const std::string&,
// naRef )
return _set( boost::bind(setter, _2, _1, _3, _4) );
}
/**
* Register anything that accepts an object instance and a
* nasal::CallContext and returns naRef as method.