util class to dynamic register class/method/property More...
#include <ZFDynamicRegisterUtil.h>
Public Member Functions | |
ZFDynamic (void) | |
main constructor | |
ZFDynamic (const zfstring ®Tag) | |
construct with regTag | |
ZFDynamic & | regTag (const zfstring ®Tag) |
util to make the registration able to be called more than once | |
const zfstring & | regTag (void) const |
see regTag | |
void | removeAll (void) |
see ZFDynamic | |
const ZFCoreArray< const ZFClass * > & | allClass (void) const |
see ZFDynamic | |
const ZFCoreArray< const ZFClass * > & | allEnum (void) const |
see ZFDynamic | |
const ZFCoreArray< const ZFMethod * > & | allMethod (void) const |
see ZFDynamic | |
const ZFCoreArray< const ZFProperty * > & | allProperty (void) const |
see ZFDynamic | |
const ZFCoreArray< zfidentity > & | allEvent (void) const |
see ZFDynamic | |
ZFDynamic & | classBegin (const zfstring &className, const zfstring &parentClassName, ZFObject *classDynamicRegisterUserData=zft_zfnull) |
see ZFDynamic | |
ZFDynamic & | classBegin (const zfstring &className, const ZFClass *classParent=ZFObject::ClassData(), ZFObject *classDynamicRegisterUserData=zft_zfnull) |
see ZFDynamic | |
ZFDynamic & | classBegin (const ZFClass *cls) |
see ZFDynamic | |
ZFDynamic & | classEnd (void) |
see ZFDynamic | |
ZFDynamic & | classImplement (const ZFClass *clsToImplement) |
see ZFImplementDynamicRegister | |
ZFDynamic & | classCanAllocPublic (zfbool value) |
see ZFClass::classCanAllocPublic | |
ZFDynamic & | onEvent (zfidentity eventId, const ZFListener &callback, ZFLevel level=ZFLevelAppNormal) |
see ZFDynamic | |
ZFDynamic & | onInit (const ZFListener &callback) |
see ZFDynamic and onEvent | |
ZFDynamic & | onInitFinish (const ZFListener &callback) |
see ZFDynamic and onEvent | |
ZFDynamic & | onDeallocPrepare (const ZFListener &callback) |
see ZFDynamic and onEvent | |
ZFDynamic & | onDealloc (const ZFListener &callback) |
see ZFDynamic and onEvent | |
ZFDynamic & | onInit (const ZFMP &mp, const ZFListener &impl=zft_zfnull) |
util to register custom constructor | |
ZFDynamic & | objectInfoImplByProp (void) |
util to implement ZFObject::objectInfoImpl by ZFObjectPrettyInfo | |
ZFDynamic & | objectInfoImplByStruct (void) |
util to implement ZFObject::objectInfoImpl by ZFObjectShortInfo | |
ZFDynamic & | objectHashImplByProp (void) |
util to implement ZFObject::objectHashImpl by hash all properties | |
ZFDynamic & | objectCompareImplByProp (void) |
util to implement ZFObject::objectCompareImpl by ZFPropertyAllEqual | |
ZFDynamic & | objectCompareValueImplByProp (void) |
util to implement ZFObject::objectCompareValueImpl by ZFPropertyAllEqual | |
ZFDynamic & | NSBegin (const zfstring &methodNamespace) |
see ZFDynamic | |
ZFDynamic & | NSEnd (void) |
see ZFDynamic | |
ZFDynamic & | enumBegin (const zfstring &enumClassName) |
see ZFDynamic | |
ZFDynamic & | enumBeginFlags (const zfstring &enumClassName) |
see ZFDynamic | |
ZFDynamic & | enumValue (const zfstring &enumName, zfuint enumValue=((zfuint) -1)) |
see ZFDynamic | |
ZFDynamic & | enumEnd (zfuint enumDefault=((zfuint) -1)) |
see ZFDynamic | |
ZFDynamic & | event (const zfstring &name) |
register a event, see also ZFEVENT ZFEVENT_GLOBAL | |
ZFDynamic & | method (const zfstring &returnTypeId, const zfstring &methodName, const ZFMP &methodParam, const ZFListener &methodImpl, ZFMethodType methodType=ZFMethodTypeVirtual, ZFMethodAccessType methodAccessType=ZFMethodAccessTypePublic) |
see ZFDynamic | |
ZFDynamic & | method (const ZFMethodDynamicRegisterParam ¶m) |
see ZFDynamic | |
ZFDynamic & | staticMethod (const zfstring &returnTypeId, const zfstring &methodName, const ZFMP &methodParam, const ZFListener &methodImpl) |
see ZFDynamic | |
ZFDynamic & | singleton (const zfstring &methodName=zfstring::shared("instance")) |
util to register a static method that holds singleton instance | |
ZFDynamic & | property (const zfstring &propertyTypeId, const zfstring &propertyName, ZFObject *propertyInitValue=zft_zfnull, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic) |
see ZFDynamic | |
ZFDynamic & | property (const ZFClass *propertyClassOfRetainProperty, const zfstring &propertyName, ZFObject *propertyInitValue=zft_zfnull, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic) |
see ZFDynamic | |
ZFDynamic & | propertyWithInit (const zfstring &propertyTypeId, const zfstring &propertyName, const ZFListener &propertyInitValue, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic) |
see property | |
ZFDynamic & | propertyWithInit (const ZFClass *propertyClassOfRetainProperty, const zfstring &propertyName, const ZFListener &propertyInitValue, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic) |
see ZFDynamic | |
ZFDynamic & | property (const ZFPropertyDynamicRegisterParam ¶m) |
see ZFDynamic | |
ZFDynamic & | propertyOnInit (const zfstring &propertyName, const ZFListener &callback) |
util to ZFPropertyDynamicRegisterLifeCycle | |
ZFDynamic & | propertyOnUpdate (const zfstring &propertyName, const ZFListener &callback) |
util to ZFPropertyDynamicRegisterLifeCycle | |
ZFDynamic & | propertyOnAttach (const zfstring &propertyName, const ZFListener &callback) |
util to ZFPropertyDynamicRegisterLifeCycle | |
ZFDynamic & | propertyOnDetach (const zfstring &propertyName, const ZFListener &callback) |
util to ZFPropertyDynamicRegisterLifeCycle | |
ZFDynamic & | propertyLifeCycle (const zfstring &propertyName, ZFPropertyLifeCycle lifeCycle, const ZFListener &callback) |
util to ZFPropertyDynamicRegisterLifeCycle | |
ZFDynamic & | staticProperty (const zfstring &propertyTypeId, const zfstring &propertyName, ZFObject *propertyInitValue=zft_zfnull, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic) |
util to register setter and getter static method to simulate static property | |
ZFDynamic & | staticProperty (const ZFClass *propertyClassOfRetainProperty, const zfstring &propertyName, ZFObject *propertyInitValue=zft_zfnull, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic) |
see staticProperty | |
ZFDynamic & | staticPropertyWithInit (const zfstring &propertyTypeId, const zfstring &propertyName, const ZFListener &propertyInitValue, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic) |
util to register setter and getter static method to simulate static property | |
ZFDynamic & | staticPropertyWithInit (const ZFClass *propertyClassOfRetainProperty, const zfstring &propertyName, const ZFListener &propertyInitValue, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic) |
see staticPropertyWithInit | |
void | objectInfoT (zfstring &ret) const |
see objectInfo | |
zfstring | objectInfo (void) const |
return object info | |
Static Public Member Functions | |
static void | exportTag (const ZFOutput &output, zfbool exportScope=_ZFT_t_zffalse, zfbool exportInternal=_ZFT_t_zftrue) |
util method to export all symbols to a tag file | |
static void | onInitImpl (const ZFArgs &zfargs) |
util for impl to implement default behavior of onInit | |
static ZFCoreArray< ZFOutput > & | errorCallbacks (void) |
callbacks which would be called when error occurred | |
util class to dynamic register class/method/property
usage:
when any steps failed, errorCallbacks would be notified, and all further call would be ignored
you may store the returned ZFDynamic object, and use removeAll to remove all registered items at once
to make it more convenient for script language, you may also use regTag to make the registration looks like singleton registration
|
static |
util method to export all symbols to a tag file
the tag file contains all of these in plain text format, one line for each:
output ensured unique, while order are not ensured
anything that starts with "_ZFP_" would be ignored
this is useful to use ZFFramework in some script language which has no semantic completion, so that you can use keyword completion by using the tag file
util to make the registration able to be called more than once
by default, dynamic register would fail if contents already exists, that's not very convenient for script languages
to solve this, you may use this method to mark the registration, which would automatically unregister old ones if exists, identified by that regTag
ZFDynamic & ZFDynamic::onEvent | ( | zfidentity | eventId, |
const ZFListener & | callback, | ||
ZFLevel | level = ZFLevelAppNormal ) |
see ZFDynamic
attach observer to instance of current classBegin, by ZFClass::instanceObserverAdd
ZFDynamic & ZFDynamic::onInit | ( | const ZFMP & | mp, |
const ZFListener & | impl = zft_zfnull ) |
util to register custom constructor
when impl valid, the impl would be used to init the object, otherwise, each init param would be treated as property to init the object
register a event, see also ZFEVENT ZFEVENT_GLOBAL
if within class scope (classBegin), YourClassName::E_YourEvent
would be registered, otherwise, YourNamespace::E_YourEvent
would be registered
registered event would include:
ZFDynamic & ZFDynamic::method | ( | const zfstring & | returnTypeId, |
const zfstring & | methodName, | ||
const ZFMP & | methodParam, | ||
const ZFListener & | methodImpl, | ||
ZFMethodType | methodType = ZFMethodTypeVirtual, | ||
ZFMethodAccessType | methodAccessType = ZFMethodAccessTypePublic ) |
see ZFDynamic
util method to register method (global method or class member method)
usage:
ZFDynamic & ZFDynamic::propertyWithInit | ( | const zfstring & | propertyTypeId, |
const zfstring & | propertyName, | ||
const ZFListener & | propertyInitValue, | ||
ZFMethodAccessType | setterAccessType = ZFMethodAccessTypePublic, | ||
ZFMethodAccessType | getterAccessType = ZFMethodAccessTypePublic ) |
see property
the propertyInitValue callback's sender would be the v_ZFProperty
ZFDynamic & ZFDynamic::staticPropertyWithInit | ( | const zfstring & | propertyTypeId, |
const zfstring & | propertyName, | ||
const ZFListener & | propertyInitValue, | ||
ZFMethodAccessType | setterAccessType = ZFMethodAccessTypePublic, | ||
ZFMethodAccessType | getterAccessType = ZFMethodAccessTypePublic ) |
util to register setter and getter static method to simulate static property
the propertyInitValue callback's sender would be the v_ZFMethod of owner getter or setter method
|
static |
callbacks which would be called when error occurred
by default, ZFOutputDefault would be attached during ZFFrameworkInit with ZFLevelZFFrameworkNormal