ZFFramework
Loading...
Searching...
No Matches
ZFDynamicRegisterUtil.h
Go to the documentation of this file.
1
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;
56public:
58 ZFDynamic(void);
60 ZFDynamic(ZF_IN const zfchar *regTag);
63
65 ZFDynamic(ZF_IN const ZFDynamic &ref);
66 ~ZFDynamic(void);
67 ZFDynamic &operator = (ZF_IN const ZFDynamic &ref);
68 zfbool operator == (ZF_IN const ZFDynamic &ref) const;
69 zfbool operator != (ZF_IN const ZFDynamic &ref) const {return !this->operator == (ref);}
72public:
89 static void exportTag(
90 ZF_IN_OUT const ZFOutput &output
91 , ZF_IN_OPT zfbool exportScope = zffalse
92 , ZF_IN_OPT zfbool exportInternal = zffalse
93 );
94
95public:
105 ZFDynamic &regTag(ZF_IN const zfchar *regTag);
107 const zfchar *regTag(void) const;
110
111public:
113 void removeAll(void);
124
125public:
128 ZF_IN const zfchar *classNameFull
129 , ZF_IN const zfchar *parentClassNameFull
130 , ZF_IN_OPT ZFObject *classDynamicRegisterUserData = zfnull
131 );
134 ZF_IN const zfchar *classNameFull
135 , ZF_IN_OPT const ZFClass *classParent = ZFObject::ClassData()
136 , ZF_IN_OPT ZFObject *classDynamicRegisterUserData = zfnull
137 );
142
144 ZFDynamic &classImplement(ZF_IN const ZFClass *clsToImplement);
145
148
151 ZF_IN zfidentity eventId
152 , ZF_IN const ZFListener &callback
154 );
156 ZFDynamic &onInit(ZF_IN const ZFListener &callback) {
158 }
162 }
163
164public:
169
170public:
172 ZFDynamic &enumBegin(ZF_IN const zfchar *enumClassName);
174 ZFDynamic &enumBeginFlags(ZF_IN const zfchar *enumClassName);
177 ZF_IN const zfchar *enumName
178 , ZF_IN_OPT zfuint enumValue = ZFEnumInvalid()
179 );
182
183public:
194 ZFDynamic &event(ZF_IN const zfchar *eventName);
195
196public:
213 ZF_IN const zfchar *methodReturnTypeId
214 , ZF_IN const zfchar *methodName
215 , ZF_IN const ZFMP &methodParam
216 , ZF_IN const ZFListener &methodImpl
219 );
220
223
224public:
227 ZF_IN const zfchar *propertyTypeId
228 , ZF_IN const zfchar *propertyName
229 , ZF_IN_OPT ZFObject *propertyInitValue = zfnull
232 );
235 ZF_IN const ZFClass *propertyClassOfRetainProperty
236 , ZF_IN const zfchar *propertyName
237 , ZF_IN_OPT ZFObject *propertyInitValue = zfnull
240 );
243
246 ZF_IN const zfchar *propertyName
247 , ZF_IN const ZFListener &callback
248 );
251 ZF_IN const zfchar *propertyName
252 , ZF_IN const ZFListener &callback
253 );
256 ZF_IN const zfchar *propertyName
257 , ZF_IN const ZFListener &callback
258 );
261 ZF_IN const zfchar *propertyName
262 , ZF_IN const ZFListener &callback
263 );
264
267 ZF_IN const zfchar *propertyName
268 , ZF_IN ZFPropertyLifeCycle lifeCycle
269 , ZF_IN const ZFListener &callback
270 );
271
272public:
280
281public:
286 zfstring ret;
287 this->objectInfoT(ret);
288 return ret;
289 }
290
291private:
292 _ZFP_ZFDynamicPrivate *d;
293};
296
297// ============================================================
304
306#endif // #ifndef _ZFI_ZFDynamicRegisterUtil_h_
307
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFCoreEnvDef.h:93
#define ZF_NAMESPACE_GLOBAL_NAME
global namespace id for impl
Definition ZFCoreEnvDef.h:72
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFCoreEnvDef.h:94
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
_ZFT_t_zfchar zfchar
char wrapper
Definition ZFCoreTypeDef_CharType.h:17
#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:58
_zft_zfidentity zfidentity
identity type, ensured at least 32 bit, ensured unsigned
Definition ZFCoreTypeDef_CoreType.h:192
#define zffalse
bool false type
Definition ZFCoreTypeDef_CoreType.h:66
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:50
_ZFT_t_zfuint zfuint
same as unsigned int, see zfindex
Definition ZFCoreTypeDef_CoreType.h:127
#define ZFOUTPUT_TYPE(T_Type, outputAction)
declare your custom type conversion to string, convenient for debug
Definition ZFCoreTypeDef_OtherType.h:237
void ZFDynamicRemoveAll()
util method to remove all contents registered by ZFDynamic
#define ZFEnumInvalid()
invalid value for ZFEnum
Definition ZFEnum.h:16
ZFLevel
level for logic which depends on order
Definition ZFLevel.h:17
@ ZFLevelZFFrameworkStatic
ZFFramework static, for non-ZFObject-related meta data or global instance.
Definition ZFLevel.h:18
@ ZFLevelZFFrameworkPostStatic
ZFFramework post static.
Definition ZFLevel.h:33
@ ZFLevelAppNormal
app
Definition ZFLevel.h:26
ZFMethodPrivilegeType
access type for ZFMethod
Definition ZFMethod.h:17
@ ZFMethodPrivilegeTypePublic
public
Definition ZFMethod.h:18
ZFMethodType
the method type
Definition ZFMethod.h:43
@ ZFMethodTypeVirtual
virtual method
Definition ZFMethod.h:46
#define ZFMETHOD_FUNC_DECLARE_0(ZFLIB_, ReturnType, MethodName)
declare function type of ZFMethod
Definition ZFMethodFuncDeclare.h:505
ZFObject related include.
ZFPropertyLifeCycle
property life cycle, see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDynamicRegisterExtra.h:19
#define ZFTYPEID_ACCESS_ONLY_DECLARE(ZFLIB_, TypeName, Type)
declare a type that reflectable and accessable, but not serializable
Definition ZFTypeIdCore.h:358
ZFObject's class info.
Definition ZFClass.h:66
light weight array
Definition ZFCoreArray.h:317
util class to dynamic register class/method/property
Definition ZFDynamicRegisterUtil.h:55
ZFDynamic & onInit(const ZFListener &callback)
see ZFDynamic
Definition ZFDynamicRegisterUtil.h:156
ZFDynamic & classCanAllocPublic(zfbool value)
see ZFClass::classCanAllocPublic
ZFDynamic & classBegin(const zfchar *classNameFull, const zfchar *parentClassNameFull, ZFObject *classDynamicRegisterUserData=0)
see ZFDynamic
ZFDynamic & regTag(const zfchar *regTag)
util to make the registration able to be called more than once
ZFDynamic & enumBeginFlags(const zfchar *enumClassName)
see ZFDynamic
ZFDynamic & classBegin(const zfchar *classNameFull, const ZFClass *classParent=ZFObject::ClassData(), ZFObject *classDynamicRegisterUserData=0)
see ZFDynamic
const ZFCoreArray< const ZFClass * > & allEnum(void) const
see ZFDynamic
ZFDynamic & property(const ZFClass *propertyClassOfRetainProperty, const zfchar *propertyName, ZFObject *propertyInitValue=0, ZFMethodPrivilegeType setterPrivilegeType=ZFMethodPrivilegeTypePublic, ZFMethodPrivilegeType getterPrivilegeType=ZFMethodPrivilegeTypePublic)
see ZFDynamic
ZFDynamic & propertyOnDetach(const zfchar *propertyName, const ZFListener &callback)
util to ZFPropertyDynamicRegisterLifeCycle
ZFDynamic & classEnd(void)
see ZFDynamic
ZFDynamic & property(const ZFPropertyDynamicRegisterParam &param)
see ZFDynamic
ZFDynamic & on(zfidentity eventId, const ZFListener &callback, ZFLevel level=ZFLevelAppNormal)
see ZFDynamic
ZFDynamic & enumBegin(const zfchar *enumClassName)
see ZFDynamic
void objectInfoT(zfstring &ret) const
see objectInfo
static ZFCoreArray< ZFOutput > & errorCallbacks(void)
callbacks which would be called when error occurred
ZFDynamic & propertyOnVerify(const zfchar *propertyName, const ZFListener &callback)
util to ZFPropertyDynamicRegisterLifeCycle
ZFDynamic(ZFObject *regTag)
construct with regTag (converted from ZFObject::objectInfo)
const ZFCoreArray< const ZFClass * > & allClass(void) const
see ZFDynamic
ZFDynamic(const zfchar *regTag)
construct with regTag
ZFDynamic & NSEnd(void)
see ZFDynamic
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
ZFDynamic & propertyLifeCycle(const zfchar *propertyName, ZFPropertyLifeCycle lifeCycle, const ZFListener &callback)
util to ZFPropertyDynamicRegisterLifeCycle
ZFDynamic & method(const zfchar *methodReturnTypeId, const zfchar *methodName, const ZFMP &methodParam, const ZFListener &methodImpl, ZFMethodType methodType=ZFMethodTypeVirtual, ZFMethodPrivilegeType methodPrivilegeType=ZFMethodPrivilegeTypePublic)
see ZFDynamic
ZFDynamic & classBegin(const ZFClass *cls)
see ZFDynamic
const zfchar * regTag(void) const
see regTag
ZFDynamic & propertyOnInit(const zfchar *propertyName, const ZFListener &callback)
util to ZFPropertyDynamicRegisterLifeCycle
const ZFCoreArray< const ZFMethod * > & allMethod(void) const
see ZFDynamic
ZFDynamic & regTag(ZFObject *regTag)
see regTag
void removeAll(void)
see ZFDynamic
ZFDynamic & onDealloc(const ZFListener &callback)
see ZFDynamic
Definition ZFDynamicRegisterUtil.h:160
ZFDynamic & enumEnd(zfuint enumDefault=((zfuint) -1))
see ZFDynamic
ZFDynamic & event(const zfchar *eventName)
register a event, see also ZFEVENT ZFEVENT_GLOBAL
ZFDynamic & NSBegin(const zfchar *methodNamespace="ZF")
see ZFDynamic
ZFDynamic & propertyOnAttach(const zfchar *propertyName, const ZFListener &callback)
util to ZFPropertyDynamicRegisterLifeCycle
const ZFCoreArray< const ZFProperty * > & allProperty(void) const
see ZFDynamic
ZFDynamic & property(const zfchar *propertyTypeId, const zfchar *propertyName, ZFObject *propertyInitValue=0, ZFMethodPrivilegeType setterPrivilegeType=ZFMethodPrivilegeTypePublic, ZFMethodPrivilegeType getterPrivilegeType=ZFMethodPrivilegeTypePublic)
see ZFDynamic
ZFDynamic & method(const ZFMethodDynamicRegisterParam &param)
see ZFDynamic
ZFDynamic(void)
main constructor
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:285
ZFDynamic & enumValue(const zfchar *enumName, zfuint enumValue=((zfuint) -1))
see ZFDynamic
listener as ZFCallback, mostly used by ZFObject::observerNotify
Definition ZFObjectObserver.h:30
util for ZFDynamic::method
Definition ZFMethodDynamicRegister.h:213
param for ZFMethodDynamicRegister
Definition ZFMethodDynamicRegister.h:103
base class of all objects
Definition ZFObjectCore.h:209
static zfidentity EventObjectBeforeAlloc(void)
see ZFObject::observerNotify
Definition ZFObjectCore.h:243
static zfidentity EventObjectBeforeDealloc(void)
see ZFObject::observerNotify
Definition ZFObjectCore.h:262
static const ZFClass * ClassData(void)
get class info
Definition ZFObjectCore.h:211
general output callback
Definition ZFIOCallback_output.h:37
param for ZFPropertyDynamicRegister
Definition ZFPropertyDynamicRegister.h:42