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// ============================================================
27
42
55
56// ============================================================
57zfclassFwd _ZFP_ZFDynamicPrivate;
101public:
104
106 ZFDynamic(ZF_IN const ZFDynamic &ref);
107 ~ZFDynamic(void);
108 ZFDynamic &operator = (ZF_IN const ZFDynamic &ref);
109 zfbool operator == (ZF_IN const ZFDynamic &ref) const;
110 zfbool operator != (ZF_IN const ZFDynamic &ref) const {return !(this->operator == (ref));}
112
113public:
130 static void exportTag(
131 ZF_IN_OUT const ZFOutput &output
132 , ZF_IN_OPT zfbool exportScope = zffalse
133 , ZF_IN_OPT zfbool exportInternal = zftrue
134 );
135
136public:
138 void removeAll(void);
155
156public:
159 ZF_IN const zfstring &className
160 , ZF_IN const zfstring &parentClassName
161 , ZF_IN_OPT ZFObject *classDynamicRegisterUserData = zfnull
162 );
165 ZF_IN const zfstring &className
166 , ZF_IN_OPT const ZFClass *classParent = ZFObject::ClassData()
167 , ZF_IN_OPT ZFObject *classDynamicRegisterUserData = zfnull
168 );
173
175 ZFDynamic &classImplement(ZF_IN const ZFClass *clsToImplement);
176
179
187 ZF_IN zfidentity eventId
188 , ZF_IN const ZFListener &callback
190 );
192 ZFDynamic &onInit(ZF_IN const ZFListener &callback) {
194 }
195
198 }
199
203
207
226 ZF_IN const ZFMP &mp
227 , ZF_IN_OPT const ZFListener &impl = zfnull
228 );
229
231 static void onInitImpl(ZF_IN const ZFArgs &zfargs);
232
243
244public:
246 ZFDynamic &NSBegin(ZF_IN const zfstring &methodNamespace);
249
250public:
252 ZFDynamic &enumBegin(ZF_IN const zfstring &enumClassName);
254 ZFDynamic &enumBeginFlags(ZF_IN const zfstring &enumClassName);
257 ZF_IN const zfstring &enumName
259 );
262
263public:
275
276public:
292 ZF_IN const zfstring &returnTypeId
293 , ZF_IN const zfstring &methodName
294 , ZF_IN const ZFMP &methodParam
295 , ZF_IN const ZFListener &methodImpl
298 );
299
302
305 ZF_IN const zfstring &returnTypeId
306 , ZF_IN const zfstring &methodName
307 , ZF_IN const ZFMP &methodParam
308 , ZF_IN const ZFListener &methodImpl
309 );
310
314 ZFDynamic &singleton(ZF_IN_OPT const zfstring &methodName = zftext("instance"));
315
316public:
319 ZF_IN const zfstring &propertyTypeId
320 , ZF_IN const zfstring &propertyName
321 , ZF_IN_OPT ZFObject *propertyInitValue = zfnull
324 );
327 ZF_IN const ZFClass *propertyClassOfRetainProperty
328 , ZF_IN const zfstring &propertyName
329 , ZF_IN_OPT ZFObject *propertyInitValue = zfnull
332 );
339 ZF_IN const zfstring &propertyTypeId
340 , ZF_IN const zfstring &propertyName
341 , ZF_IN const ZFListener &propertyInitValue
344 );
347 ZF_IN const ZFClass *propertyClassOfRetainProperty
348 , ZF_IN const zfstring &propertyName
349 , ZF_IN const ZFListener &propertyInitValue
352 );
355
358 ZF_IN const zfstring &propertyName
359 , ZF_IN const ZFListener &callback
360 );
363 ZF_IN const zfstring &propertyName
364 , ZF_IN const ZFListener &callback
365 );
368 ZF_IN const zfstring &propertyName
369 , ZF_IN const ZFListener &callback
370 );
373 ZF_IN const zfstring &propertyName
374 , ZF_IN const ZFListener &callback
375 );
376
379 ZF_IN const zfstring &propertyName
380 , ZF_IN ZFPropertyLifeCycle lifeCycle
381 , ZF_IN const ZFListener &callback
382 );
383
384public:
389 ZF_IN const zfstring &propertyTypeId
390 , ZF_IN const zfstring &propertyName
391 , ZF_IN_OPT ZFObject *propertyInitValue = zfnull
394 );
397 ZF_IN const ZFClass *propertyClassOfRetainProperty
398 , ZF_IN const zfstring &propertyName
399 , ZF_IN_OPT ZFObject *propertyInitValue = zfnull
402 );
409 ZF_IN const zfstring &propertyTypeId
410 , ZF_IN const zfstring &propertyName
411 , ZF_IN const ZFListener &propertyInitValue
414 );
417 ZF_IN const ZFClass *propertyClassOfRetainProperty
418 , ZF_IN const zfstring &propertyName
419 , ZF_IN const ZFListener &propertyInitValue
422 );
423
428
429public:
437
438public:
443 zfstring ret;
444 this->objectInfoT(ret);
445 return ret;
446 }
447
448private:
449 _ZFP_ZFDynamicPrivate *d;
450};
453ZFOUTPUT_TYPE(ZFDynamic, {v.objectInfoT(s);})
454
456#endif // #ifndef _ZFI_ZFDynamicRegisterUtil_h_
457
#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:196
#define zfclassPOD
shows the class is a POD type
Definition ZFCoreTypeDef_ClassType.h:35
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:200
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:212
#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_DECLARE(ZFLIB_, T_Type)
see ZFOUTPUT_TYPE
Definition ZFCoreTypeDef_OtherType.h:244
#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
#define ZFCORE_POD_DECLARE_NO_COMPARER(Type)
explicitly declare as POD
Definition ZFCoreUtilTemplate.h:565
#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 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 ZFPropertyFwd.h:92
#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:63
light weight array
Definition ZFCoreArray.h:297
info for ZFDynamic::onEvent
Definition ZFDynamicRegisterUtil.h:44
zfidentity eventId
event id
Definition ZFDynamicRegisterUtil.h:49
const ZFClass * cls
owner class
Definition ZFDynamicRegisterUtil.h:47
util class to dynamic register class/method/property
Definition ZFDynamicRegisterUtil.h:100
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:192
ZFDynamic & objectHashImplByProp(void)
util to implement ZFObject::objectHashImpl by hash all properties
ZFDynamic & classCanAllocPublic(zfbool value)
see ZFClass::classCanAllocPublic
zfstring currentScope(void) const
return fully namespace or class names for current scope
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 & 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
const ZFCoreArray< ZFDynamicEventImplInfo > & allEventImpl(void) const
see ZFDynamic
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 & singleton(const zfstring &methodName=zfstring::shared("instance",))
util to register a static method that holds singleton instance
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:196
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
const ZFCoreArray< ZFDynamicPropLifeCycleInfo > & allPropertyLifeCycle(void) const
see ZFDynamic
ZFDynamic & onEvent(zfidentity eventId, const ZFListener &callback, ZFLevel level=ZFLevelAppNormal)
see ZFDynamic
const ZFCoreArray< const ZFMethod * > & allMethod(void) const
see ZFDynamic
const ZFCoreArray< ZFDynamicImplementInfo > & allImplement(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:204
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:200
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:442
ZFDynamic & property(const zfstring &propertyTypeId, const zfstring &propertyName, ZFObject *propertyInitValue=zft_zfnull, ZFMethodAccessType setterAccessType=ZFMethodAccessTypePublic, ZFMethodAccessType getterAccessType=ZFMethodAccessTypePublic)
see ZFDynamic
info for ZFDynamic::classImplement
Definition ZFDynamicRegisterUtil.h:16
const ZFClass * clsToImplement
parent class to implement
Definition ZFDynamicRegisterUtil.h:21
const ZFClass * cls
child class
Definition ZFDynamicRegisterUtil.h:19
info for ZFDynamic::propertyLifeCycle
Definition ZFDynamicRegisterUtil.h:29
const ZFClass * ownerClassOrNull
owner class, can be child of property's owner class
Definition ZFDynamicRegisterUtil.h:34
ZFPropertyLifeCycle lifeCycle
life cycle
Definition ZFDynamicRegisterUtil.h:36
const ZFProperty * property
the property
Definition ZFDynamicRegisterUtil.h:32
listener as ZFCallback, mostly used by ZFObject::observerNotify
Definition ZFObjectObserver.h:30
util for ZFDynamic::method
Definition ZFMethodDynamicRegister.h:203
param for ZFMethodDynamicRegister
Definition ZFMethodDynamicRegister.h:102
base class of all objects
Definition ZFObjectCore.h:195
static const ZFClass * ClassData(void)
get class info
Definition ZFObjectCore.h:197
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
info for a property for ZFObject, see ZFPROPERTY_RETAIN for more info
Definition ZFProperty.h:27
#define zftext(s,...)
util macro for zfstring::shared
Definition zfstring.h:785