ZFFramework
 
Loading...
Searching...
No Matches
ZFClass.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFClass_h_
7#define _ZFI_ZFClass_h_
8
9#include "zfautoFwd.h"
10#include "ZFObjectObserver.h"
12
13// ============================================================
16
17// ============================================================
18typedef ZFObject *(*_ZFP_ZFObjectConstructor)(void);
19typedef void (*_ZFP_ZFObjectDestructor)(ZF_IN ZFObject *obj);
20typedef void (*_ZFP_ZFObjectCheckInitImplementationListCallback)(ZF_IN_OUT ZFClass *cls);
21typedef ZFInterface * (*_ZFP_ZFObjectToInterfaceCastCallback)(ZF_IN ZFObject *obj);
22
23typedef ZFObject *(*_ZFP_zfAllocCacheCallback)(void);
24typedef void (*_ZFP_zfAllocCacheReleaseCallback)(ZF_IN ZFObject *obj);
25
26// ============================================================
30
31
33
36
39
42
43public:
45 zfbool operator == (ZF_IN ZFClassInstanceObserverAddParam const &ref) const {
46 return (zftrue
47 && this->observer() == ref.observer()
48 && this->owner() == ref.owner()
49 && this->observerLevel() == ref.observerLevel()
50 && this->observeAllChildType() == ref.observeAllChildType()
51 );
52 }
53 zfbool operator != (ZF_IN ZFClassInstanceObserverAddParam const &ref) const {
54 return !this->operator == (ref);
55 }
57};
58
59// ============================================================
60zfclassFwd _ZFP_ZFClassPrivate;
61zfclassFwd _ZFP_ZFObjectPrivate;
68
69 // ============================================================
70 // static methods
71public:
96 static const ZFClass *classForName(ZF_IN const zfstring &classNameOrFullName);
100 static const ZFClass *classForName(
103 );
104
105 // ============================================================
106 // instance observer
107public:
112 ZF_IN const ZFListener &observer
113 , ZF_IN_OPT ZFObject *owner = zfnull
114 , ZF_IN_OPT ZFLevel observerLevel = ZFLevelAppNormal
115 , ZF_IN_OPT zfbool observeAllChildType = zftrue
116 ) const;
119 this->instanceObserverAdd(param.observer(), param.owner(), param.observerLevel(), param.observeAllChildType());
120 }
121
122 void instanceObserverRemove(ZF_IN const ZFListener &observer) const;
134 void _ZFP_ZFClass_instanceObserverNotify(ZF_IN ZFObject *obj) const;
135
136 // ============================================================
137 // class info
138public:
142 zfstring objectInfo(void) const {
143 zfstring ret;
144 this->objectInfoT(ret);
145 return ret;
146 }
147
154 zfstring ret;
155 this->objectInfoOfInheritTreeT(ret);
156 return ret;
157 }
158
159public:
163 zfbool classIsTypeOf(ZF_IN const ZFClass *cls) const;
164
165public:
167 inline const ZFCoreArray<zfstring> &classAliasTo(void) const {
168 return this->_ZFP_ZFClass_classAliasTo;
169 }
170
174 inline const zfstring &classNamespace(void) const {
175 return this->_ZFP_ZFClass_classNamespace;
176 }
177
180 inline const zfstring &className(void) const {
181 return this->_ZFP_ZFClass_className;
182 }
183
186 inline const zfstring &classNameFull(void) const {
187 return this->_ZFP_ZFClass_classNameFull;
188 }
189
193 inline const ZFClass *classParent(void) const {
194 return this->_ZFP_ZFClass_classParent;
195 }
196
210 inline zfbool classIsAbstract(void) const {
211 return this->_ZFP_ZFClass_classIsAbstract;
212 }
213
216 inline zfbool classIsInterface(void) const {
217 return this->_ZFP_ZFClass_classIsInterface;
218 }
219
227 inline zfbool classIsInternal(void) const {
228 return this->_ZFP_ZFClass_classIsInternal;
229 }
230
238 inline zfbool classIsInternalPrivate(void) const {
239 return this->_ZFP_ZFClass_classIsInternalPrivate;
240 }
241
252 inline zfbool classCanAllocPublic(void) const {
253 return this->_ZFP_ZFClass_classCanAllocPublic;
254 }
255
271 zfauto newInstance(void) const;
272
273 /* ZFMETHOD_MAX_PARAM */
314 ZF_IN ZFObject *param0
315 , ZF_IN_OPT ZFObject *param1 = ZFMP_DEF()
316 , ZF_IN_OPT ZFObject *param2 = ZFMP_DEF()
317 , ZF_IN_OPT ZFObject *param3 = ZFMP_DEF()
318 , ZF_IN_OPT ZFObject *param4 = ZFMP_DEF()
319 , ZF_IN_OPT ZFObject *param5 = ZFMP_DEF()
320 , ZF_IN_OPT ZFObject *param6 = ZFMP_DEF()
321 , ZF_IN_OPT ZFObject *param7 = ZFMP_DEF()
322 ) const;
325 ZF_IN const ZFCoreArray<zfauto> &params
326 , ZF_OUT_OPT zfbool *success = zfnull
327 , ZF_OUT_OPT zfstring *errorHint = zfnull
328 ) const;
329
331 void *newInstanceGenericBegin(void) const;
334 ZF_IN void *&token
335 , ZF_IN const ZFMethod *objectOnInitMethod
336 , ZF_IN_OUT const ZFArgs &zfargs
337 ) const;
340 ZF_IN void *&token
341 , ZF_IN zfbool objectOnInitMethodInvokeSuccess
342 ) const;
343
344 zffinal zfauto _ZFP_ZFClass_newInstance(ZF_IN _ZFP_ZFObjectPrivate *dObj) const;
345
353 const ZFClass *implementedInterfaceAt(ZF_IN zfindex index) const;
361 const ZFClass *dynamicInterfaceAt(ZF_IN zfindex index) const;
365 zfbool dynamicImplementOf(ZF_IN const ZFClass *parent) const;
366
375
376 // ============================================================
377 // ZFMethod
378public:
386 zfindex methodCount(void) const;
388 zfiter methodIter(void) const;
390 const ZFMethod *methodIterValue(ZF_IN const zfiter &it) const;
391
402
410 this->methodGetAllT(ret);
411 return ret;
412 }
413
414 /* ZFMETHOD_MAX_PARAM */
427 ZF_IN const zfstring &methodName
428 , ZF_IN const zfchar *paramTypeId0
429 , ZF_IN_OPT const zfchar *paramTypeId1 = zfnull
430 , ZF_IN_OPT const zfchar *paramTypeId2 = zfnull
431 , ZF_IN_OPT const zfchar *paramTypeId3 = zfnull
432 , ZF_IN_OPT const zfchar *paramTypeId4 = zfnull
433 , ZF_IN_OPT const zfchar *paramTypeId5 = zfnull
434 , ZF_IN_OPT const zfchar *paramTypeId6 = zfnull
435 , ZF_IN_OPT const zfchar *paramTypeId7 = zfnull
436 ) const;
438 const ZFMethod *methodForNameIgnoreParent(ZF_IN const zfstring &methodName) const;
442 , ZF_IN const zfstring &methodName
443 ) const;
447 this->methodForNameGetAllIgnoreParentT(ret, methodName);
448 return ret;
449 }
450
459 ZF_IN const zfstring &methodName
460 , ZF_IN const zfchar *paramTypeId0
461 , ZF_IN_OPT const zfchar *paramTypeId1 = zfnull
462 , ZF_IN_OPT const zfchar *paramTypeId2 = zfnull
463 , ZF_IN_OPT const zfchar *paramTypeId3 = zfnull
464 , ZF_IN_OPT const zfchar *paramTypeId4 = zfnull
465 , ZF_IN_OPT const zfchar *paramTypeId5 = zfnull
466 , ZF_IN_OPT const zfchar *paramTypeId6 = zfnull
467 , ZF_IN_OPT const zfchar *paramTypeId7 = zfnull
468 ) const;
470 const ZFMethod *methodForName(ZF_IN const zfstring &methodName) const;
474 , ZF_IN const zfstring &methodName
475 ) const;
481 this->methodForNameGetAllT(ret, methodName);
482 return ret;
483 }
484
485 // ============================================================
486 // ZFProperty
487public:
497 zfiter propertyIter(void) const;
499 const ZFProperty *propertyIterValue(ZF_IN const zfiter &it) const;
500
511
519 this->propertyGetAllT(ret);
520 return ret;
521 }
522
531 const ZFProperty *propertyForNameIgnoreParent(ZF_IN const zfstring &propertyName) const;
541 const ZFProperty *propertyForName(ZF_IN const zfstring &propertyName) const;
542
549 const ZFMethod *propertySetterForNameIgnoreParent(ZF_IN const zfstring &propertyName) const;
556 const ZFMethod *propertySetterForName(ZF_IN const zfstring &propertyName) const;
563 const ZFMethod *propertyGetterForNameIgnoreParent(ZF_IN const zfstring &propertyName) const;
570 const ZFMethod *propertyGetterForName(ZF_IN const zfstring &propertyName) const;
571
580
585 ZF_IN const ZFProperty *property
586 , ZF_IN const ZFClass *refClass
587 ) const;
588
589public:
591 void zfconvRegister(ZF_IN const ZFClass *dstCls, ZF_IN zfconvImpl impl) const;
593 void zfconvUnregister(ZF_IN const ZFClass *dstCls) const;
595 zfconvImpl zfconvCheck(ZF_IN const zfstring &dstCls) const;
597 zfconvImpl zfconvCheck(ZF_IN const ZFClass *dstCls) const;
598
600 friend ZFLIB_ZFCore zfauto zfconv(ZF_IN const ZFClass *cls, ZF_IN ZFObject *obj);
602 friend ZFLIB_ZFCore zfbool zfconvT(ZF_OUT zfauto &ret, ZF_IN const ZFClass *cls, ZF_IN ZFObject *obj);
603
604 // ============================================================
605 // class instance methods
606public:
615 ZF_IN const zfstring &key
616 , ZF_IN ZFObject *tag
617 ) const;
619 zfany classTag(ZF_IN const zfstring &key) const;
624 ) const;
626 inline void classTagRemove(ZF_IN const zfstring &key) const {
627 this->classTag(key, zfnull);
628 }
629
639 zffinal void classTagRemoveAll(void) const;
640
641 // ============================================================
652 ZF_IN const zfstring &key
653 , ZF_IN ZFObject *tag
654 ) const;
656 zfany dataCache(ZF_IN const zfstring &key) const;
661 ) const;
663 inline void dataCacheRemove(ZF_IN const zfstring &key) const {
664 this->dataCache(key, zfnull);
665 }
666
669 zffinal void dataCacheRemoveAll(void) const;
670
671 // ============================================================
677 return _ZFP_ZFClass_classNameFull.sigId();
678 }
679
680 // ============================================================
681 // private
682public:
683 static ZFClass *_ZFP_ZFClassRegister(
684 ZF_IN const zfstring &classNamespace
685 , ZF_IN const zfstring &className
686 , ZF_IN const ZFClass *parent
687 , ZF_IN const ZFClass *outer
688 , ZF_IN zfbool classCanAllocPublic
689 , ZF_IN _ZFP_zfAllocCacheCallback objectAllocWithCacheCallback
690 , ZF_IN _ZFP_ZFObjectConstructor constructor
691 , ZF_IN _ZFP_ZFObjectDestructor destructor
692 , ZF_IN _ZFP_ZFObjectCheckInitImplementationListCallback checkInitImplListCallback
693 , ZF_IN zfbool classIsInterface
694 , ZF_IN zfbool classIsDynamicRegister
695 , ZF_IN ZFObject *classDynamicRegisterUserData
696 );
697 static void _ZFP_ZFClassUnregister(ZF_IN const ZFClass *cls);
699 ZFClass(void);
700 ~ZFClass(void);
702 void _ZFP_ZFClass_autoRegister(void) const;
703 zfbool _ZFP_ZFClass_interfaceNeedRegister(void);
704 void _ZFP_ZFClass_interfaceRegister(
705 ZF_IN zfint dummy
706 , ZF_IN const ZFClass *cls
707 , ZF_IN _ZFP_ZFObjectToInterfaceCastCallback callback
708 , ...
709 );
710 ZFInterface *_ZFP_ZFClass_interfaceCast(
711 ZF_IN ZFObject *obj
712 , ZF_IN const ZFClass *interfaceClass
713 ) const;
714 ZFObject *_ZFP_ZFClass_objectCast(
715 ZF_IN ZFObject *obj
716 , ZF_IN const ZFClass *objectClass
717 ) const;
718
719 zfbool _ZFP_ZFClass_ZFImplementDynamicRegister(ZF_IN const ZFClass *clsToImplement) const;
720 void _ZFP_ZFClass_ZFImplementDynamicUnregister(ZF_IN const ZFClass *clsToImplement) const;
721
722 void _ZFP_ZFClass_objectDesctuct(ZF_IN ZFObject *obj) const;
723 ZFClass *_ZFP_ZFClass_removeConst(void) const {
724 return const_cast<ZFClass *>(this);
725 }
726
727 void _ZFP_ZFClass_methodRegister(ZF_IN const ZFMethod *method) const;
728 void _ZFP_ZFClass_methodUnregister(ZF_IN const ZFMethod *method) const;
729 void _ZFP_ZFClass_propertyRegister(ZF_IN const ZFProperty *zfproperty) const;
730 void _ZFP_ZFClass_propertyUnregister(ZF_IN const ZFProperty *zfproperty) const;
731 void _ZFP_ZFClass_propertyAutoInitRegister(ZF_IN const ZFProperty *property) const;
732 void _ZFP_ZFClass_propertyAutoInitAction(ZF_IN ZFObject *owner) const;
733 void _ZFP_ZFClass_propertyInitStepRegister(ZF_IN const ZFProperty *property) const;
734
735 _ZFP_zfAllocCacheCallback _ZFP_objectAllocWithCacheCallback(void) const;
736 _ZFP_ZFObjectConstructor _ZFP_objectConstructor(void) const;
737 _ZFP_ZFObjectDestructor _ZFP_objectDestructor(void) const;
738 void _ZFP_classDynamicRegisterObjectInstanceDetach(ZF_IN ZFObject *obj) const;
739
740private:
741 _ZFP_ZFClassPrivate *d;
742 friend zfclassFwd _ZFP_ZFClassPrivate;
743 const ZFClass *_ZFP_ZFClass_classParent;
744 ZFSigName _ZFP_ZFClass_classNamespace;
745 ZFSigName _ZFP_ZFClass_className;
746 ZFSigName _ZFP_ZFClass_classNameFull;
747 zfbool _ZFP_ZFClass_classIsAbstract;
748 zfbool _ZFP_ZFClass_classIsInterface;
749 zfbool _ZFP_ZFClass_classIsInternal;
750 zfbool _ZFP_ZFClass_classIsInternalPrivate;
751 zfbool _ZFP_ZFClass_methodAndPropertyCacheNeedUpdate;
752public:
753 zfbool _ZFP_ZFClass_implListNeedInit;
754 zfbool _ZFP_ZFClass_classCanAllocPublic;
755 ZFCoreArray<zfstring> _ZFP_ZFClass_classAliasTo;
756};
757
767#define ZFObjectTagKeyword_newInstanceGenericFailed "_ZFP_NIGFail"
768
769// ============================================================
770zfclassLikePOD ZFLIB_ZFCore _ZFP_ZFClassRegisterHolder {
771public:
772 _ZFP_ZFClassRegisterHolder(
773 ZF_IN const zfstring &classNamespace
774 , ZF_IN const zfstring &className
775 , ZF_IN const ZFClass *parent
776 , ZF_IN const ZFClass *outer
777 , ZF_IN zfbool classCanAllocPublic
778 , ZF_IN _ZFP_zfAllocCacheCallback objectAllocWithCacheCallback
779 , ZF_IN _ZFP_ZFObjectConstructor constructor
780 , ZF_IN _ZFP_ZFObjectDestructor destructor
781 , ZF_IN _ZFP_ZFObjectCheckInitImplementationListCallback checkInitImplListCallback
782 , ZF_IN_OPT zfbool classIsInterface = zffalse
783 , ZF_IN_OPT zfbool classIsDynamicRegister = zffalse
784 , ZF_IN_OPT ZFObject *classDynamicRegisterUserData = zfnull
785 );
786 ~_ZFP_ZFClassRegisterHolder(void);
787public:
788 ZFClass *cls;
789};
790
791// ============================================================
799 ZFClassGetAllT(ret);
800 return ret;
801}
802
803// ============================================================
834
835extern ZFLIB_ZFCore ZFObserver &_ZFP_ZFClassDataUpdateObserverRef(void);
843#define ZFClassDataUpdateObserver() (_ZFP_ZFClassDataUpdateObserverRef())
844
845// ============================================================
846zfclassNotPOD ZFLIB_ZFCore _ZFP_ZFCoreCriticalClassNotTypeOf {
847public:
848 static zfstring classInfo(ZF_IN const ZFClass *cls) {
849 if(cls) {
850 return cls->classNameFull();
851 }
852 else {
853 return ZFTOKEN_zfnull;
854 }
855 }
856};
860#define ZFCoreCriticalClassNotTypeOf(cls, desired) \
861 ZFCoreCriticalMessage("class %s not type of %s", \
862 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(cls), \
863 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(desired))
864
867#define ZFCoreCriticalClassNotTypeOfDetail(callerInfo, cls, desired) \
868 ZFCoreCriticalMessageDetail(callerInfo, "class %s not type of %s", \
869 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(cls), \
870 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(desired))
871
872// ============================================================
890 ZF_IN const ZFClass *cls
891 , ZF_IN const zfstring &aliasNameFull
892 );
897 ZF_IN const ZFClass *cls
898 , ZF_IN const zfstring &aliasNameFull
899 );
900
901// ============================================================
933
938
940#define ZFCONV_REG(dstCls, srcCls) \
941 static zfbool _ZFP_zfconv_##dstCls##_##srcCls(ZF_OUT zfauto &ret, ZF_IN ZFObject *obj); \
942 ZF_STATIC_REGISTER_INIT(zfconv_##dstCls##_##srcCls) { \
943 srcCls::ClassData()->zfconvRegister(dstCls::ClassData(), _ZFP_zfconv_##dstCls##_##srcCls); \
944 } \
945 ZF_STATIC_REGISTER_DESTROY(zfconv_##dstCls##_##srcCls) { \
946 srcCls::ClassData()->zfconvUnregister(dstCls::ClassData()); \
947 } \
948 ZF_STATIC_REGISTER_END(zfconv_##dstCls##_##srcCls) \
949 static zfbool _ZFP_zfconv_##dstCls##_##srcCls(ZF_OUT zfauto &ret, ZF_IN ZFObject *obj)
950
952#endif // #ifndef _ZFI_ZFClass_h_
953
zfbool(* zfconvImpl)(zfauto &ret, ZFObject *obj)
see zfconv
Definition ZFClass.h:15
zfauto zfconv(const zfstring &cls, ZFObject *obj)
object conversion
void ZFClassAliasRemove(const ZFClass *cls, const zfstring &aliasNameFull)
see ZFClassAlias
void ZFClassAlias(const ZFClass *cls, const zfstring &aliasNameFull)
alias class to a new name
zfbool zfconvT(zfauto &ret, const zfstring &cls, ZFObject *obj)
see zfconv
ZFCoreArray< const ZFClass * > ZFClassGetAll(void)
get all class currently registered, for debug use only
Definition ZFClass.h:797
void ZFClassGetAllT(ZFCoreArray< const ZFClass * > &ret)
see ZFClassGetAll
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
_ZFT_t_zfchar zfchar
char wrapper
Definition ZFCoreTypeDef_CharType.h:17
#define ZF_OUT_OPT
dummy macro that shows the param used as optional output
Definition ZFCoreTypeDef_ClassType.h:192
#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_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:188
#define zfclassNotPOD
shows the class is not a POD type, you should not memset it or declare it in stack or copy value by c...
Definition ZFCoreTypeDef_ClassType.h:48
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:196
#define ZFCLASS_DISALLOW_COPY_CONSTRUCTOR(ClassName)
a macro to show that a class doesn't allow copy constructor
Definition ZFCoreTypeDef_ClassType.h:81
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
#define zftrue
bool true type
Definition ZFCoreTypeDef_CoreType.h:107
_ZFT_t_zfint zfint
same as int, see zfindex
Definition ZFCoreTypeDef_CoreType.h:165
_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
#define ZFTOKEN_zfnull
string tokens
Definition ZFCoreTypeDef_OtherType.h:16
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZFCORE_PARAM_DECLARE_SELF(T_self)
see ZFCORE_PARAM
Definition ZFCoreUtilMacro.h:495
#define ZFCORE_PARAM(T_ParamType, paramName,...)
a util macro to generate setter and getter for POD like object
Definition ZFCoreUtilMacro.h:523
ZFLevel
level for logic which depends on order
Definition ZFLevel.h:17
@ ZFLevelAppNormal
app
Definition ZFLevel.h:26
#define ZFMP_DEF()
mark the object as default param
Definition ZFMethodGenericInvoker.h:30
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_END(NameSpace)
end namespace
Definition ZFNamespace.h:60
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define ZF_NAMESPACE_BEGIN(NameSpace)
begin namespace
Definition ZFNamespace.h:40
observer types for ZFObject
#define ZFEVENT_GLOBAL(ZFLIB_, YourEvent)
declare a observer event in global scope, see ZFEVENT
Definition ZFObjectObserver.h:369
listener data used by ZFListener
Definition ZFArgs.h:20
ZFObject's class info.
Definition ZFClass.h:66
const ZFMethod * propertySetterForNameIgnoreParent(const zfstring &propertyName) const
try to get property setter method within this class only
void instanceObserverRemoveAll(void) const
see instanceObserverAdd
friend zfauto zfconv(const zfstring &cls, ZFObject *obj)
object conversion
void classTagGetAllKeyValue(ZFCoreArray< zfstring > &allKey, ZFCoreArray< zfauto > &allValue) const
see classTag
void instanceObserverRemove(const ZFListener &observer) const
see instanceObserverAdd
zfbool propertyInitStepExist(void) const
whether the property has ZFPROPERTY_ON_INIT_DECLARE
zfauto newInstanceGenericEnd(void *&token, zfbool objectOnInitMethodInvokeSuccess) const
see newInstance
zfany classDynamicRegisterUserData(void) const
see ZFClassDynamicRegister
zfbool propertyInitStepIsEqual(const ZFProperty *property, const ZFClass *refClass) const
whether two class has same property init step
zfbool dynamicImplementOf(const ZFClass *parent) const
true if this class dynamic implement specified parent by ZFImplementDynamicRegister
zfauto newInstance(void) const
make a new instance of ZFObject dynamically, which is described by ZFClass
const zfstring & classNamespace(void) const
class namespace, null or empty string for global scope class
Definition ZFClass.h:174
void classTagRemove(const zfstring &key) const
see classTag
Definition ZFClass.h:626
void methodGetAllIgnoreParentT(ZFCoreArray< const ZFMethod * > &ret) const
see methodGetAllIgnoreParent
ZFCoreArray< const ZFMethod * > methodForNameGetAll(const zfstring &methodName) const
get all method with name, ignoring method id
Definition ZFClass.h:479
const ZFProperty * propertyForNameIgnoreParent(const zfstring &propertyName) const
get the property by name within this class only, or zfnull if not exists
void propertyGetAllT(ZFCoreArray< const ZFProperty * > &ret) const
see propertyGetAll
const zfstring & classNameFull(void) const
class full name, e.g. "NS0.NS1.YourObject"
Definition ZFClass.h:186
zfindex propertyCount(void) const
get ZFProperty count registered to this class
const ZFMethod * methodForNameIgnoreParent(const zfstring &methodName) const
see methodForNameIgnoreParent
zfany dataCache(const zfstring &key) const
see dataCache
static const ZFClass * classForName(const zfstring &classNameOrFullName)
get class info by name
void methodForNameGetAllIgnoreParentT(ZFCoreArray< const ZFMethod * > &ret, const zfstring &methodName) const
see methodForNameIgnoreParent
ZFCoreArray< const ZFProperty * > propertyGetAll(void) const
get all property, including properties inherited from parent
Definition ZFClass.h:517
ZFCoreArray< const ZFClass * > parentGetAll(void) const
get all parent (parent/interface/dynamicInterface) excluding self, for debug use only
ZFCoreArray< const ZFClass * > childGetAll(void) const
get all child excluding self, for debug use only
zfconvImpl zfconvCheck(const zfstring &dstCls) const
see zfconv
void instanceObserverAdd(const ZFListener &observer, ZFObject *owner=zft_zfnull, ZFLevel observerLevel=ZFLevelAppNormal, zfbool observeAllChildType=_ZFT_t_zftrue) const
add an observer which would be called if any of this class's instance created
void * newInstanceGenericBegin(void) const
see newInstance
void dataCacheRemoveAll(void) const
see dataCache
zfbool classCanAllocPublic(void) const
whether the class can alloc directly, see ZFOBJECT_PRIVATE_ALLOC
Definition ZFClass.h:252
zfconvImpl zfconvCheck(const ZFClass *dstCls) const
see zfconv
void dataCacheRemove(const zfstring &key) const
see dataCache
Definition ZFClass.h:663
zfiter propertyIter(void) const
see zfiter
const ZFMethod * methodForName(const zfstring &methodName) const
see methodForName
const zfstring & className(void) const
class name, e.g. "ZFObject"
Definition ZFClass.h:180
zfauto newInstance(ZFObject *param0, ZFObject *param1=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param2=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param3=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param4=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param5=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param6=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param7=((ZFObject *const &) _ZFP_ZFMP_DEF)) const
for advanced reflection use only
static const ZFClass * classForName(const zfstring &className, const zfstring &classNamespace)
find class with explicit namespace, see classForName
ZFCoreArray< const ZFProperty * > propertyGetAllIgnoreParent(void) const
get all property, including properties inherited from parent
Definition ZFClass.h:506
zfauto dataCacheRemoveAndGet(const zfstring &key) const
see dataCache
void instanceObserverAdd(const ZFClassInstanceObserverAddParam &param) const
see instanceObserverAdd
Definition ZFClass.h:118
zfbool classIsInternalPrivate(void) const
whether the class is internal private class
Definition ZFClass.h:238
ZFCoreArray< const ZFMethod * > methodGetAll(void) const
get all method, including methods inherited from parent
Definition ZFClass.h:408
friend zfauto zfconv(const ZFClass *cls, ZFObject *obj)
see zfconv
ZFCoreArray< const ZFMethod * > methodForNameGetAllIgnoreParent(const zfstring &methodName) const
see methodForNameIgnoreParent
Definition ZFClass.h:445
const ZFClass * implementedInterfaceAt(zfindex index) const
get implemented interface, see dynamicInterfaceAt
friend zfbool zfconvT(zfauto &ret, const zfstring &cls, ZFObject *obj)
see zfconv
void dataCache(const zfstring &key, ZFObject *tag) const
store class meta data cache, internal use only
zfauto newInstanceDetail(const ZFCoreArray< zfauto > &params, zfbool *success=zft_zfnull, zfstring *errorHint=zft_zfnull) const
see newInstance
zfstring objectInfo(void) const
return object info
Definition ZFClass.h:142
const ZFMethod * propertyGetterForName(const zfstring &propertyName) const
try to get property getter method
const ZFMethod * methodIterValue(const zfiter &it) const
see zfiter
const ZFMethod * methodForNameIgnoreParent(const zfstring &methodName, const zfchar *paramTypeId0, const zfchar *paramTypeId1=zft_zfnull, const zfchar *paramTypeId2=zft_zfnull, const zfchar *paramTypeId3=zft_zfnull, const zfchar *paramTypeId4=zft_zfnull, const zfchar *paramTypeId5=zft_zfnull, const zfchar *paramTypeId6=zft_zfnull, const zfchar *paramTypeId7=zft_zfnull) const
get the method by name within this class only, or zfnull if not exists
void zfconvRegister(const ZFClass *dstCls, zfconvImpl impl) const
see zfconv
zfbool classIsTypeOf(const ZFClass *cls) const
true if class is subclass of cls, or implement cls
zfany classTag(const zfstring &key) const
see classTag
void instanceObserverRemoveByOwner(ZFObject *owner) const
see instanceObserverAdd
void objectInfoOfInheritTreeT(zfstring &ret) const
see objectInfoOfInheritTree
zfiter methodIter(void) const
see zfiter
const ZFCoreArray< zfstring > & classAliasTo(void) const
see ZFClassAlias
Definition ZFClass.h:167
void classTag(const zfstring &key, ZFObject *tag) const
set a classTag for the class, internal use only
zfbool newInstanceGenericCheck(void *&token, const ZFMethod *objectOnInitMethod, const ZFArgs &zfargs) const
see newInstance
const ZFMethod * propertySetterForName(const zfstring &propertyName) const
try to get property setter method
void zfconvUnregister(const ZFClass *dstCls) const
see zfconv
zfindex dynamicInterfaceCount(void) const
get dynamic interface registered by ZFImplementDynamicRegister, see implementedInterfaceAt
zfbool propertyInitStepExist(const ZFProperty *property) const
whether the property has ZFPROPERTY_ON_INIT_DECLARE
zfstring objectInfoOfInheritTree(void) const
return a string describe the class inherit tree, debug use only
Definition ZFClass.h:153
const ZFClass * classParent(void) const
class's parent, zfnull if none
Definition ZFClass.h:193
void classTagRemoveAll(void) const
see classTag
zfbool classIsAbstract(void) const
true if the class is abstract class
Definition ZFClass.h:210
void dataCacheGetAllKeyValue(ZFCoreArray< zfstring > &allKey, ZFCoreArray< zfauto > &allValue) const
see dataCache
void propertyGetAllIgnoreParentT(ZFCoreArray< const ZFProperty * > &ret) const
see propertyGetAllIgnoreParent
const ZFProperty * propertyIterValue(const zfiter &it) const
see zfiter
const ZFMethod * methodForName(const zfstring &methodName, const zfchar *paramTypeId0, const zfchar *paramTypeId1=zft_zfnull, const zfchar *paramTypeId2=zft_zfnull, const zfchar *paramTypeId3=zft_zfnull, const zfchar *paramTypeId4=zft_zfnull, const zfchar *paramTypeId5=zft_zfnull, const zfchar *paramTypeId6=zft_zfnull, const zfchar *paramTypeId7=zft_zfnull) const
get the method by name hierarchically from class inherit tree, or zfnull if not exists
zfidentity classId(void) const
a unique id that represents the class
Definition ZFClass.h:676
const ZFProperty * propertyForName(const zfstring &propertyName) const
get the property by name hierarchically from class inherit tree, or zfnull if not exists
const ZFClass * dynamicInterfaceAt(zfindex index) const
get dynamic interface registered by ZFImplementDynamicRegister, see implementedInterfaceAt
zfauto classTagRemoveAndGet(const zfstring &key) const
see classTag
zfbool classIsDynamicRegister(void) const
true if class is registered by ZFClassDynamicRegister
zfbool classIsInternal(void) const
whether the class is internal class
Definition ZFClass.h:227
zfindex implementedInterfaceCount(void) const
get implemented interface count, see dynamicInterfaceAt
void methodGetAllT(ZFCoreArray< const ZFMethod * > &ret) const
see methodGetAll
zfbool classIsInterface(void) const
true if the class is an interface
Definition ZFClass.h:216
const ZFMethod * propertyGetterForNameIgnoreParent(const zfstring &propertyName) const
try to get property getter method within this class only
zfindex methodCount(void) const
get the count of method registered to this ZFClass
void objectInfoT(zfstring &ret) const
see objectInfo
ZFCoreArray< const ZFMethod * > methodGetAllIgnoreParent(void) const
get all method, excluding methods inherited from parent
Definition ZFClass.h:397
void methodForNameGetAllT(ZFCoreArray< const ZFMethod * > &ret, const zfstring &methodName) const
see methodForNameGetAll
friend zfbool zfconvT(zfauto &ret, const ZFClass *cls, ZFObject *obj)
see zfconv
see ZFClass::instanceObserverAdd
Definition ZFClass.h:28
ZFLevel & observerLevel(void)
see ZFClass::instanceObserverAdd
Definition ZFClass.h:38
zfbool & observeAllChildType(void)
see ZFClass::instanceObserverAdd
Definition ZFClass.h:41
ZFListener & observer(void)
see ZFClass::instanceObserverAdd
Definition ZFClass.h:32
zfany & owner(void)
see ZFClass::instanceObserverAdd
Definition ZFClass.h:35
light weight array
Definition ZFCoreArray.h:331
dummy base of interface types
Definition ZFObjectInterface.h:250
listener as ZFCallback, mostly used by ZFObject::observerNotify
Definition ZFObjectObserver.h:30
reflectable method for ZFObject
Definition ZFMethod.h:252
base class of all objects
Definition ZFObjectCore.h:209
holder object for observer logic, see ZFObject::observerNotify
Definition ZFObjectObserver.h:147
info for a property for ZFObject, see ZFPROPERTY_RETAIN for more info
Definition ZFProperty.h:28
readonly string container for internal use only
Definition ZFSigName.h:17
util method to cast ZFObject types freely
Definition zfany.h:35
a ZFObject holder which would release content object automatically when destroyed
Definition zfautoFwd.h:34
iterator for ZFFramework
Definition zfiter.h:40
Definition ZFApp.h:13
smart pointer for ZFObject