#define CHECKOBJ | ( | obj | ) | ncsIsValidObj((mObject*)obj) |
#define INSTANCEOF | ( | obj, | |||
clss | ) | ncsInstanceOf((mObject*)(obj), (mObjectClass*)(void*)(&Class(clss))) |
A wrapper of ncsInstanceOf, just like java's instanceof.
Example: Test a object is mComponentClass: INSTANCEOF(obj, mComponent)
Definition at line 402 of file mobject.h.
Referenced by ncsIsValidObj().
#define SAFE_CAST | ( | Type, | |||
obj | ) | TYPE_CAST(Type, ncsSafeCast((mObject*)obj,(mObjectClass*)(void*)(&(Class(Type))))) |
wrapper of ncsSafeCast, check the class type before cast.
#define SAFE_CAST_CLASS | ( | Clss, | |||
ClssCast | ) | ((ClassType(ClssCast)*)(ncsSafeCastClass((mObjectClass*)Clss, (mObjectClass*)(void*)(&Class(ClssCast))))) |
#define TYPE_CAST | ( | Type, | |||
obj | ) | ((Type*)(obj)) |
#define TYPENAME | ( | obj | ) | ((obj)?(((obj)->_class)?((obj)->_class)->typeName:""):"") |
typedef BOOL(* NCS_CB_ONOBJEVENT)(mObject *self, mObject *sender, int eventId, DWORD param) |
void deleteObject | ( | mObject * | obj | ) |
delete a object intance, like delete operator in C++
obj | - the object want to delete |
BOOL ncsAddEventListener | ( | mObject * | sender, | |
mObject * | listener, | |||
NCS_CB_ONOBJEVENT | eventProc, | |||
int | eventId | |||
) |
connect sender object to listener object
sender | The sender of event | |
listener | The listener of event | |
eventProc | The processing callback of event | |
eventId | The id of event |
MGNCS_EXPORT BOOL ncsAddEventListeners | ( | mObject * | sender, | |
mObject * | listener, | |||
NCS_CB_ONOBJEVENT | eventProc, | |||
int * | eventIds | |||
) |
connect a group of events from sender to listener
BOOL ncsAddEventListeners(mObject *sender, \ mObject* listener, \ NCS_CB_ONOBJEVENT eventProc, \ int* eventIds);
sender | The sender of events | |
listener | The listener of events | |
eventProc | The processing callback of events | |
eventIds | The id array of events, end by 0 |
BOOL ncsInstanceOf | ( | mObject * | object, | |
mObjectClass * | clss | |||
) |
check an object is the class instance or not, same as instanceof operator in Java
object | - the pointer of object being to test | |
clss | - the pointer of class for test |
void ncsRaiseEvent | ( | mObject * | sender, | |
int | event_id, | |||
DWORD | param | |||
) |
raise an event to listeners
sender | event sender | |
event_id | the id of event | |
param | the event param |
remove a special event connect
listener | the listener object | |
source | the source object | |
event | the special event want to remove |
BOOL ncsRemoveEventListener | ( | mObject * | listener | ) |
remove the connections which are listened by the object
listener | the object pointer of listener |
BOOL ncsRemoveEventSource | ( | mObject * | sender | ) |
remove the connections when a sender is destroied
sender | the sender of events |
mObject * ncsSafeCast | ( | mObject * | obj, | |
mObjectClass * | clss | |||
) |
safe type cast function, like the dynamic_cast operator in C++
obj | - the mObject pointer being casted | |
clss | - the target type to cast |
mObjectClass * ncsSafeCastClass | ( | mObjectClass * | clss, | |
mObjectClass * | castCls | |||
) |
cast from a supper class to derived class type safely
clss | - the supper type class pointer | |
castCls | - the derived class type pointer |
mObject * newObject | ( | mObjectClass * | _class | ) |
new a object instance, like new operator in C++
_class | - the class of the object |