ZFFramework
 
Loading...
Searching...
No Matches
ZFDynamicRegisterUtil.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFDynamicRegisterUtil_h_
7#define _ZFI_ZFDynamicRegisterUtil_h_
8
9#include "ZFObject.h"
10
12/* ZFMETHOD_MAX_PARAM */
13
14// ============================================================
15zfclassFwd _ZFP_ZFDynamicPrivate;
57public:
59 ZFDynamic(void);
62
64 ZFDynamic(ZF_IN const ZFDynamic &ref);
65 ~ZFDynamic(void);
66 ZFDynamic &operator = (ZF_IN const ZFDynamic &ref);
67 zfbool operator == (ZF_IN const ZFDynamic &ref) const;
68 zfbool operator != (ZF_IN const ZFDynamic &ref) const {return !this->operator == (ref);}
70
71public:
88 static void exportTag(
89 ZF_IN_OUT const ZFOutput &output
90 , ZF_IN_OPT zfbool exportScope = zffalse
91 , ZF_IN_OPT zfbool exportInternal = zftrue
92 );
93
94public:
106 const zfstring &regTag(void) const;
107
108public:
110 void removeAll(void);
121
122public:
125 ZF_IN const zfstring &className
126 , ZF_IN const zfstring &parentClassName
127 , ZF_IN_OPT ZFObject *classDynamicRegisterUserData = zfnull
128 );
131 ZF_IN const zfstring &className
132 , ZF_IN_OPT const ZFClass *classParent = ZFObject::ClassData()
133 , ZF_IN_OPT ZFObject *classDynamicRegisterUserData = zfnull
134 );
139
141 ZFDynamic &classImplement(ZF_IN const ZFClass *clsToImplement);
142
145
153 ZF_IN zfidentity eventId
154 , ZF_IN const ZFListener &callback
156 );
158 ZFDynamic &onInit(ZF_IN const ZFListener &callback) {
160 }
161
164 }
165
169
173
192 ZF_IN const ZFMP &mp
193 , ZF_IN_OPT const ZFListener &impl = zfnull
194 );
195
197 static void onInitImpl(ZF_IN const ZFArgs &zfargs);
198
209
210public:
212 ZFDynamic &NSBegin(ZF_IN const zfstring &methodNamespace);
215
216public:
218 ZFDynamic &enumBegin(ZF_IN const zfstring &enumClassName);
220 ZFDynamic &enumBeginFlags(ZF_IN const zfstring &enumClassName);
223 ZF_IN const zfstring &enumName
225 );
228
229public:
241
242public:
258 ZF_IN const zfstring &returnTypeId
259 , ZF_IN const zfstring &methodName
260 , ZF_IN const ZFMP &methodParam
261 , ZF_IN const ZFListener &methodImpl
264 );
265
268
271 ZF_IN const zfstring &returnTypeId
272 , ZF_IN const zfstring &methodName
273 , ZF_IN const ZFMP &methodParam
274 , ZF_IN const ZFListener &methodImpl
275 );
276
280 ZFDynamic &singleton(ZF_IN_OPT const zfstring &methodName = zftext("instance"));
281
282public:
285 ZF_IN const zfstring &propertyTypeId
286 , ZF_IN const zfstring &propertyName
287 , ZF_IN_OPT ZFObject *propertyInitValue = zfnull
290 );
293 ZF_IN const ZFClass *propertyClassOfRetainProperty
294 , ZF_IN const zfstring &propertyName
295 , ZF_IN_OPT ZFObject *propertyInitValue = zfnull
298 );
305 ZF_IN const zfstring &propertyTypeId
306 , ZF_IN const zfstring &propertyName
307 , ZF_IN const ZFListener &propertyInitValue
310 );
313 ZF_IN const ZFClass *propertyClassOfRetainProperty
314 , ZF_IN const zfstring &propertyName
315 , ZF_IN const ZFListener &propertyInitValue
318 );
321
324 ZF_IN const zfstring &propertyName
325 , ZF_IN const ZFListener &callback
326 );
329 ZF_IN const zfstring &propertyName
330 , ZF_IN const ZFListener &callback
331 );
334 ZF_IN const zfstring &propertyName
335 , ZF_IN const ZFListener &callback
336 );
339 ZF_IN const zfstring &propertyName
340 , ZF_IN const ZFListener &callback
341 );
342
345 ZF_IN const zfstring &propertyName
346 , ZF_IN ZFPropertyLifeCycle lifeCycle
347 , ZF_IN const ZFListener &callback
348 );
349
350public:
355 ZF_IN const zfstring &propertyTypeId
356 , ZF_IN const zfstring &propertyName
357 , ZF_IN_OPT ZFObject *propertyInitValue = zfnull
360 );
363 ZF_IN const ZFClass *propertyClassOfRetainProperty
364 , ZF_IN const zfstring &propertyName
365 , ZF_IN_OPT ZFObject *propertyInitValue = zfnull
368 );
375 ZF_IN const zfstring &propertyTypeId
376 , ZF_IN const zfstring &propertyName
377 , ZF_IN const ZFListener &propertyInitValue
380 );
383 ZF_IN const ZFClass *propertyClassOfRetainProperty
384 , ZF_IN const zfstring &propertyName
385 , ZF_IN const ZFListener &propertyInitValue
388 );
389
390public:
398
399public:
404 zfstring ret;
405 this->objectInfoT(ret);
406 return ret;
407 }
408
409private:
410 _ZFP_ZFDynamicPrivate *d;
411};
414ZFOUTPUT_TYPE(ZFDynamic, {v.objectInfoT(s);})
415
416// ============================================================
423
425#endif // #ifndef _ZFI_ZFDynamicRegisterUtil_h_
426
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
#define zffinal
dummy macro shows that a method or class is designed must not to be overrided
Definition ZFCoreTypeDef_ClassType.h:63
#define zfclassLikePOD
shows the class is not a POD type, but you may use it like a POD except memset it to 0
Definition ZFCoreTypeDef_ClassType.h:41
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:184
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:196
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
#define zftrue
bool true type
Definition ZFCoreTypeDef_CoreType.h:107
_zft_zfidentity zfidentity
identity type, ensured at least 32 bit, ensured unsigned
Definition ZFCoreTypeDef_CoreType.h:225
#define zffalse
bool false type
Definition ZFCoreTypeDef_CoreType.h:111
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88
_ZFT_t_zfuint zfuint
same as unsigned int, see zfindex
Definition ZFCoreTypeDef_CoreType.h:169
#define ZFOUTPUT_TYPE(T_Type, outputAction)
declare your custom type conversion to string, convenient for debug
Definition ZFCoreTypeDef_OtherType.h:221
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
void ZFDynamicRemoveAll()
util method to remove all contents registered by ZFDynamic
#define ZFEnumInvalid()
invalid value for ZFEnum
Definition ZFEnum.h:18
ZFLevel
level for logic which depends on order
Definition ZFLevel.h:17
@ ZFLevelZFFrameworkPostHigh
ZFFramework post high.
Definition ZFLevel.h:31
@ ZFLevelZFFrameworkNormal
ZFFramework, for logic initialization.
Definition ZFLevel.h:21
@ ZFLevelAppNormal
app
Definition ZFLevel.h:26
@ ZFLevelZFFrameworkPostNormal
ZFFramework post normal.
Definition ZFLevel.h:30
ZFMethodType
the method type
Definition ZFMethod.h:43
@ ZFMethodTypeVirtual
virtual method
Definition ZFMethod.h:46
ZFMethodAccessType
access type for ZFMethod
Definition ZFMethod.h:17
@ ZFMethodAccessTypePublic
public
Definition ZFMethod.h:18
#define ZFMETHOD_FUNC_DECLARE_0(ZFLIB_, ReturnType, MethodName)
declare function type of ZFMethod
Definition ZFMethodFuncDeclare.h:493
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
ZFObject related include.
ZFPropertyLifeCycle
property life cycle, see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDynamicRegisterExtra.h:19
#define ZFTYPEID_ACCESS_ONLY_REG(ZFLIB_, TypeName, Type,...)
see ZFTYPEID_DECLARE
Definition ZFTypeIdDeclare.h:205
#define ZFTYPEID_ACCESS_ONLY_DECLARE(ZFLIB_, TypeName, Type)
see ZFTYPEID_DECLARE
Definition ZFTypeIdDeclare.h:195
listener data used by ZFListener
Definition ZFArgs.h:20
ZFObject's class info.
Definition ZFClass.h:67
light weight array
Definition ZFCoreArray.h:331
util class to dynamic register class/method/property
Definition ZFDynamicRegisterUtil.h:56
ZFDynamic & propertyOnInit(const zfstring &propertyName, const ZFListener &callback)
util to ZFPropertyDynamicRegisterLifeCycle
ZFDynamic & event(const zfstring &name)
register a event, see also ZFEVENT ZFEVENT_GLOBAL
ZFDynamic & propertyLifeCycle(const zfstring &propertyName, ZFPropertyLifeCycle lifeCycle, const ZFListener &callback)
util to ZFPropertyDynamicRegisterLifeCycle
ZFDynamic & classBegin(const zfstring &className, const ZFClass *classParent=ZFObject::ClassData(), ZFObject *classDynamicRegisterUserData=zft_zfnull)
see ZFDynamic
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 & onInit(const ZFListener &callback)
see ZFDynamic and onEvent
Definition ZFDynamicRegisterUtil.h:158
ZFDynamic & objectHashImplByProp(void)
util to implement ZFObject::objectHashImpl by hash all properties
ZFDynamic & classCanAllocPublic(zfbool value)
see ZFClass::classCanAllocPublic
ZFDynamic & regTag(const zfstring &regTag)
util to make the registration able to be called more than once
const ZFCoreArray< const ZFClass * > & allEnum(void) const
see ZFDynamic
ZFDynamic & enumBegin(const zfstring &enumClassName)
see ZFDynamic
static void onInitImpl(const ZFArgs &zfargs)
util for impl to implement default behavior of onInit
ZFDynamic & method(const zfstring &returnTypeId, const zfstring &methodName, const ZFMP &methodParam, const ZFListener &methodImpl, ZFMethodType methodType=ZFMethodTypeVirtual, ZFMethodAccessType methodAccessType=ZFMethodAccessTypePublic)
see ZFDynamic
ZFDynamic & singleton(const zfstring &methodName=zfstring::shared("instance"))
util to register a static method that holds singleton instance
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 & objectCompareImplByProp(void)
util to implement ZFObject::objectCompareImpl by ZFPropertyAllEqual
ZFDynamic & objectCompareValueImplByProp(void)
util to implement ZFObject::objectCompareValueImpl by ZFPropertyAllEqual
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
ZFDynamic & staticMethod(const zfstring &returnTypeId, const zfstring &methodName, const ZFMP &methodParam, const ZFListener &methodImpl)
see ZFDynamic
ZFDynamic & classEnd(void)
see ZFDynamic
ZFDynamic & property(const ZFPropertyDynamicRegisterParam &param)
see ZFDynamic
ZFDynamic & propertyWithInit(const zfstring &propertyTypeId, const zfstring &propertyName, const ZFListener &propertyInitValue, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic)
see property
void objectInfoT(zfstring &ret) const
see objectInfo
ZFDynamic & propertyOnDetach(const zfstring &propertyName, const ZFListener &callback)
util to ZFPropertyDynamicRegisterLifeCycle
static ZFCoreArray< ZFOutput > & errorCallbacks(void)
callbacks which would be called when error occurred
ZFDynamic & enumBeginFlags(const zfstring &enumClassName)
see ZFDynamic
const ZFCoreArray< const ZFClass * > & allClass(void) const
see ZFDynamic
ZFDynamic & NSEnd(void)
see ZFDynamic
ZFDynamic & objectInfoImplByStruct(void)
util to implement ZFObject::objectInfoImpl by ZFObjectShortInfo
ZFDynamic & propertyOnUpdate(const zfstring &propertyName, const ZFListener &callback)
util to ZFPropertyDynamicRegisterLifeCycle
ZFDynamic & onInitFinish(const ZFListener &callback)
see ZFDynamic and onEvent
Definition ZFDynamicRegisterUtil.h:162
ZFDynamic & property(const ZFClass *propertyClassOfRetainProperty, const zfstring &propertyName, ZFObject *propertyInitValue=zft_zfnull, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic)
see ZFDynamic
ZFDynamic & classBegin(const ZFClass *cls)
see ZFDynamic
ZFDynamic(const zfstring &regTag)
construct with regTag
ZFDynamic & onEvent(zfidentity eventId, const ZFListener &callback, ZFLevel level=ZFLevelAppNormal)
see ZFDynamic
const ZFCoreArray< const ZFMethod * > & allMethod(void) const
see ZFDynamic
ZFDynamic & objectInfoImplByProp(void)
util to implement ZFObject::objectInfoImpl by ZFObjectPrettyInfo
ZFDynamic & enumValue(const zfstring &enumName, zfuint enumValue=((zfuint) -1))
see ZFDynamic
void removeAll(void)
see ZFDynamic
ZFDynamic & onDealloc(const ZFListener &callback)
see ZFDynamic and onEvent
Definition ZFDynamicRegisterUtil.h:170
ZFDynamic & enumEnd(zfuint enumDefault=((zfuint) -1))
see ZFDynamic
ZFDynamic & propertyWithInit(const ZFClass *propertyClassOfRetainProperty, const zfstring &propertyName, const ZFListener &propertyInitValue, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic)
see ZFDynamic
ZFDynamic & onInit(const ZFMP &mp, const ZFListener &impl=zft_zfnull)
util to register custom constructor
ZFDynamic & classBegin(const zfstring &className, const zfstring &parentClassName, ZFObject *classDynamicRegisterUserData=zft_zfnull)
see ZFDynamic
ZFDynamic & onDeallocPrepare(const ZFListener &callback)
see ZFDynamic and onEvent
Definition ZFDynamicRegisterUtil.h:166
ZFDynamic & staticPropertyWithInit(const ZFClass *propertyClassOfRetainProperty, const zfstring &propertyName, const ZFListener &propertyInitValue, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic)
see staticPropertyWithInit
ZFDynamic & propertyOnAttach(const zfstring &propertyName, const ZFListener &callback)
util to ZFPropertyDynamicRegisterLifeCycle
ZFDynamic & NSBegin(const zfstring &methodNamespace)
see ZFDynamic
const ZFCoreArray< const ZFProperty * > & allProperty(void) const
see ZFDynamic
ZFDynamic & method(const ZFMethodDynamicRegisterParam &param)
see ZFDynamic
ZFDynamic(void)
main constructor
ZFDynamic & staticProperty(const ZFClass *propertyClassOfRetainProperty, const zfstring &propertyName, ZFObject *propertyInitValue=zft_zfnull, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic)
see staticProperty
ZFDynamic & classImplement(const ZFClass *clsToImplement)
see ZFImplementDynamicRegister
const ZFCoreArray< zfidentity > & allEvent(void) const
see ZFDynamic
zfstring objectInfo(void) const
return object info
Definition ZFDynamicRegisterUtil.h:403
ZFDynamic & property(const zfstring &propertyTypeId, const zfstring &propertyName, ZFObject *propertyInitValue=zft_zfnull, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic)
see ZFDynamic
const zfstring & regTag(void) const
see regTag
listener as ZFCallback, mostly used by ZFObject::observerNotify
Definition ZFObjectObserver.h:30
util for ZFDynamic::method
Definition ZFMethodDynamicRegister.h:197
param for ZFMethodDynamicRegister
Definition ZFMethodDynamicRegister.h:102
base class of all objects
Definition ZFObjectCore.h:209
static const ZFClass * ClassData(void)
get class info
Definition ZFObjectCore.h:211
static zfidentity E_ObjectAfterAlloc(void)
see ZFObject::observerNotify
static zfidentity E_ObjectBeforeAlloc(void)
see ZFObject::observerNotify
static zfidentity E_ObjectBeforeDealloc(void)
see ZFObject::observerNotify
general output callback
Definition ZFIOCallback_output.h:37
param for ZFPropertyDynamicRegister
Definition ZFPropertyDynamicRegister.h:42
#define zftext(s)
util macro for zfstring::shared
Definition zfstring.h:694