ZFFramework
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
ZFDynamic Class Reference

util class to dynamic register class/method/property More...

#include <ZFDynamicRegisterUtil.h>

Public Member Functions

 ZFDynamic (void)
 main constructor
 
 ZFDynamic (const zfchar *regTag)
 construct with regTag
 
 ZFDynamic (ZFObject *regTag)
 construct with regTag (converted from ZFObject::objectInfo)
 
ZFDynamicregTag (const zfchar *regTag)
 util to make the registration able to be called more than once
 
const zfcharregTag (void) const
 see regTag
 
ZFDynamicregTag (ZFObject *regTag)
 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
 
ZFDynamicclassBegin (const zfchar *classNameFull, const ZFClass *classParent=ZFObject::ClassData(), ZFObject *classDynamicRegisterUserData=0)
 see ZFDynamic
 
ZFDynamicclassBegin (const zfchar *classNameFull, const zfchar *parentClassNameFull, ZFObject *classDynamicRegisterUserData=0)
 see ZFDynamic
 
ZFDynamicclassBegin (const ZFClass *cls)
 see ZFDynamic
 
ZFDynamicclassEnd (void)
 see ZFDynamic
 
ZFDynamicclassImplement (const ZFClass *clsToImplement)
 see ZFImplementDynamicRegister
 
ZFDynamicclassCanAllocPublic (zfbool value)
 see ZFClass::classCanAllocPublic
 
ZFDynamicon (zfidentity eventId, const ZFListener &callback, ZFLevel level=ZFLevelAppNormal)
 see ZFDynamic
 
ZFDynamiconInit (const ZFListener &callback)
 see ZFDynamic
 
ZFDynamiconDealloc (const ZFListener &callback)
 see ZFDynamic
 
ZFDynamicNSBegin (const zfchar *methodNamespace="ZF")
 see ZFDynamic
 
ZFDynamicNSEnd (void)
 see ZFDynamic
 
ZFDynamicenumBegin (const zfchar *enumClassName)
 see ZFDynamic
 
ZFDynamicenumBeginFlags (const zfchar *enumClassName)
 see ZFDynamic
 
ZFDynamicenumValue (const zfchar *enumName, zfuint enumValue=((zfuint) -1))
 see ZFDynamic
 
ZFDynamicenumEnd (zfuint enumDefault=((zfuint) -1))
 see ZFDynamic
 
ZFDynamicevent (const zfchar *eventName)
 register a event, see also ZFOBSERVER_EVENT ZFOBSERVER_EVENT_GLOBAL
 
ZFDynamicmethod (const zfchar *methodReturnTypeId, const zfchar *methodName, const ZFMP &methodParam, const ZFListener &methodImpl, ZFMethodType methodType=ZFMethodTypeVirtual, ZFMethodPrivilegeType methodPrivilegeType=ZFMethodPrivilegeTypePublic)
 see ZFDynamic
 
ZFDynamicmethod (const ZFMethodDynamicRegisterParam &param)
 see ZFDynamic
 
ZFDynamicproperty (const zfchar *propertyTypeId, const zfchar *propertyName, ZFObject *propertyInitValue=0, ZFMethodPrivilegeType setterPrivilegeType=ZFMethodPrivilegeTypePublic, ZFMethodPrivilegeType getterPrivilegeType=ZFMethodPrivilegeTypePublic)
 see ZFDynamic
 
ZFDynamicproperty (const ZFClass *propertyClassOfRetainProperty, const zfchar *propertyName, ZFObject *propertyInitValue=0, ZFMethodPrivilegeType setterPrivilegeType=ZFMethodPrivilegeTypePublic, ZFMethodPrivilegeType getterPrivilegeType=ZFMethodPrivilegeTypePublic)
 see ZFDynamic
 
ZFDynamicproperty (const ZFPropertyDynamicRegisterParam &param)
 see ZFDynamic
 
ZFDynamicpropertyOnInit (const zfchar *propertyName, const ZFListener &callback)
 util to ZFPropertyDynamicRegisterLifeCycle
 
ZFDynamicpropertyOnVerify (const zfchar *propertyName, const ZFListener &callback)
 util to ZFPropertyDynamicRegisterLifeCycle
 
ZFDynamicpropertyOnAttach (const zfchar *propertyName, const ZFListener &callback)
 util to ZFPropertyDynamicRegisterLifeCycle
 
ZFDynamicpropertyOnDetach (const zfchar *propertyName, const ZFListener &callback)
 util to ZFPropertyDynamicRegisterLifeCycle
 
ZFDynamicpropertyLifeCycle (const zfchar *propertyName, ZFPropertyLifeCycle lifeCycle, const ZFListener &callback)
 util to ZFPropertyDynamicRegisterLifeCycle
 
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_zffalse)
 util method to export all symbols to a tag file
 
static ZFCoreArray< ZFOutput > & errorCallbacks (void)
 callbacks which would be called when error occurred
 

Detailed Description

util class to dynamic register class/method/property

usage:

.classBegin(classNameFull [, parent, classDynamicRegisterUserData])
.event(eventName)
.method(returnTypeId, methodName, ZFMP()
.mp(paramTypeId0 [, paramName0, paramDefault0])
, methodImpl
)
.property(typeIdOrRetainClass, propertyName [, propertyInitValue])
.onInit(callback)
.onDealloc(callback)
.classEnd()
.NSBegin([methodNamespace])
.event(eventName)
.method(returnTypeId, methodName, ZFMP()
.mp(paramTypeId0 [, paramName0, paramDefault0])
, methodImpl
)
.NSEnd()
.enumBegin(enumClassName) // or enumBeginFlags()
.enumValue(enumName [, enumValue])
.enumValue(enumName [, enumValue])
.enumEnd([enumDefault])
;
ZFDynamic(void)
main constructor
ZFDynamic & enumValue(const zfchar *enumName, zfuint enumValue=((zfuint) -1))
see ZFDynamic
util for ZFDynamic::method
Definition ZFMethodDynamicRegister.h:213
static zfidentity EventObjectAfterAlloc(void)
see ZFObject::observerNotify
Definition ZFObjectCore.h:256

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

Member Function Documentation

◆ exportTag()

static void ZFDynamic::exportTag ( const ZFOutput & output,
zfbool exportScope = _ZFT_t_zffalse,
zfbool exportInternal = _ZFT_t_zffalse )
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:

  • class name
  • method namespace
  • method name (including property)
  • type id name

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

◆ regTag()

ZFDynamic & ZFDynamic::regTag ( const zfchar * regTag)

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

◆ event()

ZFDynamic & ZFDynamic::event ( const zfchar * eventName)

register a event, see also ZFOBSERVER_EVENT ZFOBSERVER_EVENT_GLOBAL

if within class scope (classBegin), YourClassName::EventYourEvent would be registered, otherwise, YourNamespace::EventYourEvent would be registered
registered event would include:

◆ method()

ZFDynamic & ZFDynamic::method ( const zfchar * methodReturnTypeId,
const zfchar * methodName,
const ZFMP & methodParam,
const ZFListener & methodImpl,
ZFMethodType methodType = ZFMethodTypeVirtual,
ZFMethodPrivilegeType methodPrivilegeType = ZFMethodPrivilegeTypePublic )

see ZFDynamic

util method to register method (global method or class member method), methodImpl's param0 is ZFMethodInvokeData

usage:

.method("void", "myMethod", ZFMP()
.mp("zfint", "p0")
.mp("zfint", "p1", zfobj<v_zfint>(123))
, methodImpl);
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:164

◆ errorCallbacks()

static ZFCoreArray< ZFOutput > & ZFDynamic::errorCallbacks ( void )
static

callbacks which would be called when error occurred

by default, ZFOutputDefault would be attached during ZFFrameworkInit with ZFLevelZFFrameworkNormal


The documentation for this class was generated from the following file: