| Ghost.hxx | | Ghost.hxx | |
| | | | |
| skipping to change at line 236 | | skipping to change at line 236 | |
| static naRef call( naContext c, | | static naRef call( naContext c, | |
| naRef me, | | naRef me, | |
| int argc, | | int argc, | |
| naRef* args, | | naRef* args, | |
| void* user_data ) | | void* user_data ) | |
| { | | { | |
| MethodHolder* holder = static_cast<MethodHolder*>(user_data); | | MethodHolder* holder = static_cast<MethodHolder*>(user_data); | |
| if( !holder ) | | if( !holder ) | |
| naRuntimeError(c, "invalid method holder!"); | | naRuntimeError(c, "invalid method holder!"); | |
| | | | |
|
| return holder->_method | | try | |
| ( | | { | |
| requireObject(c, me), | | return holder->_method | |
| CallContext(c, argc, args) | | ( | |
| ); | | requireObject(c, me), | |
| | | CallContext(c, argc, args) | |
| | | ); | |
| | | } | |
| | | catch(const std::exception& ex) | |
| | | { | |
| | | naRuntimeError(c, "Fatal error in method call: %s", ex.what() | |
| | | ); | |
| | | } | |
| | | catch(...) | |
| | | { | |
| | | naRuntimeError(c, "Unknown exception in method call."); | |
| | | } | |
| | | | |
| | | return naNil(); | |
| } | | } | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * A ghost member. Can consist either of getter and/or setter functio
ns | | * A ghost member. Can consist either of getter and/or setter functio
ns | |
| * for exposing a data variable or a single callable function. | | * for exposing a data variable or a single callable function. | |
| */ | | */ | |
| struct member_t | | struct member_t | |
| { | | { | |
| member_t() | | member_t() | |
| | | | |
End of changes. 1 change blocks. |
| 5 lines changed or deleted | | 19 lines changed or added | |
|
| props.hxx | | props.hxx | |
| | | | |
| skipping to change at line 1955 | | skipping to change at line 1955 | |
| class SGPropertyChangeCallback | | class SGPropertyChangeCallback | |
| : public SGPropertyChangeListener | | : public SGPropertyChangeListener | |
| { | | { | |
| public: | | public: | |
| SGPropertyChangeCallback(T* obj, void (T::*method)(SGPropertyNode*), | | SGPropertyChangeCallback(T* obj, void (T::*method)(SGPropertyNode*), | |
| SGPropertyNode_ptr property,bool initial=false
) | | SGPropertyNode_ptr property,bool initial=false
) | |
| : _obj(obj), _callback(method), _property(property) | | : _obj(obj), _callback(method), _property(property) | |
| { | | { | |
| _property->addChangeListener(this,initial); | | _property->addChangeListener(this,initial); | |
| } | | } | |
|
| | | | |
| | | SGPropertyChangeCallback(const SGPropertyChangeCallback<T>& other) : | |
| | | _obj(other._obj), _callback(other._callback), _property(othe | |
| | | r._property) | |
| | | { | |
| | | _property->addChangeListener(this,false); | |
| | | } | |
| | | | |
| virtual ~SGPropertyChangeCallback() | | virtual ~SGPropertyChangeCallback() | |
| { | | { | |
| _property->removeChangeListener(this); | | _property->removeChangeListener(this); | |
| } | | } | |
| void valueChanged (SGPropertyNode * node) | | void valueChanged (SGPropertyNode * node) | |
| { | | { | |
| (_obj->*_callback)(node); | | (_obj->*_callback)(node); | |
| } | | } | |
| private: | | private: | |
| T* _obj; | | T* _obj; | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 8 lines changed or added | |
|