observer types for ZFObject More...
Go to the source code of this file.
Classes | |
class | ZFListener |
listener as ZFCallback, mostly used by ZFObject::observerNotify More... | |
class | ZFObserver |
holder object for observer logic, see ZFObject::observerNotify More... | |
Namespaces | |
namespace | ZFGlobalEvent |
Macros | |
#define | ZFEVENT(YourEvent) |
see ZFObject::observerNotify | |
#define | ZFEVENT_INLINE(YourEvent) |
see ZFEVENT | |
#define | ZFEVENT_REGISTER(YourClass, YourEvent) |
see ZFEVENT | |
#define | ZFEVENT_GLOBAL(ZFLIB_, YourEvent) |
declare a observer event in global scope, see ZFEVENT | |
#define | ZFEVENT_GLOBAL_REGISTER(YourEvent) |
see ZFEVENT_GLOBAL | |
Functions | |
ZFObserver & | ZFGlobalObserver (void) |
all event notified by ZFObject::observerNotify would also be notified to the observers added by this method, see ZFObject::observerNotify | |
zfstring | ZFEventNameForId (zfidentity idValue) |
get id name from id value, or null if no such id, see ZFEventIdForName | |
zfidentity | ZFEventIdForName (const zfstring &idName) |
get id value from id name, or zfidentityInvalid if no such id name | |
zfidentity | ZFEventDynamicRegister (const zfstring &idName) |
dynamically register your own id | |
void | ZFEventDynamicUnregister (zfidentity idValue) |
unregister id that was registered by ZFEventDynamicRegister | |
observer types for ZFObject
#define ZFEVENT | ( | YourEvent | ) |
usage:
declare a event for ZFObject's observer logic, declared event name can be accessed by:
note that subclass may declare a event same as parent, while the final event name is different:
ParentClass::E_YourEvent() => "ParentClass.E_YourEvent"
ChildClass::E_YourEvent() => "ChildClass.E_YourEvent"
#define ZFEVENT_GLOBAL | ( | ZFLIB_, | |
YourEvent ) |
declare a observer event in global scope, see ZFEVENT
usage:
unlike ZFEVENT, this macro would declare event outside of class scope, typically you should use ZFEVENT_GLOBAL which have "ZFGlobalEvent" as namespace
once declared, use ZFGlobalObserver to notify or add observer:
|
extern |
all event notified by ZFObject::observerNotify would also be notified to the observers added by this method, see ZFObject::observerNotify
use only if necessary, which may cause performance issue
|
inline |
get id value from id name, or zfidentityInvalid if no such id name
the id name should looks like YourClass.E_YourIdName
or YourNamespace.E_YourIdName
note: can be found only if:
|
inline |
dynamically register your own id
assert fail if already registered
|
inline |
unregister id that was registered by ZFEventDynamicRegister
do nothing if no such id, assert fail if the id is not dynamically registered