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// ============================================================
15typedef zfbool (*zfconvImpl)(ZF_OUT zfauto &ret, ZF_IN const zfany &obj);
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
23// ============================================================
27
28
30
33
36
39
40public:
42 zfbool operator == (ZF_IN ZFClassInstanceObserverAddParam const &ref) const {
43 return (zftrue
44 && this->observer() == ref.observer()
45 && this->owner() == ref.owner()
46 && this->observerLevel() == ref.observerLevel()
47 && this->observeAllChildType() == ref.observeAllChildType()
48 );
49 }
50 zfbool operator != (ZF_IN ZFClassInstanceObserverAddParam const &ref) const {
51 return !(this->operator == (ref));
52 }
54};
55
56// ============================================================
57zfclassFwd _ZFP_ZFClassPrivate;
58zfclassFwd _ZFP_ZFObjectPrivate;
65
66 // ============================================================
67 // static methods
68public:
93 static const ZFClass *classForName(ZF_IN const zfstring &classNameOrFullName);
97 static const ZFClass *classForName(
100 );
101
102 // ============================================================
103 // instance observer
104public:
109 ZF_IN const ZFListener &observer
110 , ZF_IN_OPT ZFObject *owner = zfnull
111 , ZF_IN_OPT ZFLevel observerLevel = ZFLevelAppNormal
112 , ZF_IN_OPT zfbool observeAllChildType = zftrue
113 ) const;
116 this->instanceObserverAdd(param.observer(), param.owner(), param.observerLevel(), param.observeAllChildType());
117 }
118
119 void instanceObserverRemove(ZF_IN const ZFListener &observer) const;
131 void _ZFP_ZFClass_instanceObserverNotify(ZF_IN ZFObject *obj) const;
132
133 // ============================================================
134 // class info
135public:
139 zfstring objectInfo(void) const {
140 zfstring ret;
141 this->objectInfoT(ret);
142 return ret;
143 }
144
151 zfstring ret;
152 this->objectInfoOfInheritTreeT(ret);
153 return ret;
154 }
155
156public:
160 zfbool classIsTypeOf(ZF_IN const ZFClass *cls) const;
161
162public:
165
169 inline const zfstring &classNamespace(void) const {
170 return this->_classNamespace;
171 }
172
175 inline const zfstring &className(void) const {
176 return this->_className;
177 }
178
181 inline const zfstring &classNameFull(void) const {
182 return this->_classNameFull;
183 }
184
188 inline const ZFClass *classParent(void) const {
189 return this->_classParent;
190 }
191
196 return ZFBitTest(_stateFlags, _stateFlags_classContainDynamicRegister);
197 }
198
203 return ZFBitTest(_stateFlags, _stateFlags_classIsDynamicRegister);
204 }
205
214 inline zfbool classIsAbstract(void) const {
215 return ZFBitTest(_stateFlags, _stateFlags_classIsAbstract);
216 }
217
220 inline zfbool classIsInterface(void) const {
221 return ZFBitTest(_stateFlags, _stateFlags_classIsInterface);
222 }
223
231 inline zfbool classIsInternal(void) const {
232 return ZFBitTest(_stateFlags, _stateFlags_classIsInternal);
233 }
234
242 inline zfbool classIsInternalPrivate(void) const {
243 return ZFBitTest(_stateFlags, _stateFlags_classIsInternalPrivate);
244 }
245
256 inline zfbool classCanAllocPublic(void) const {
257 return !this->_ZFP_ZFClass_classCanNotAllocPublic();
258 }
259
275 zfauto newInstance(void) const;
276
277 /* ZFMETHOD_MAX_PARAM */
318 ZF_IN ZFObject *param0
319 , ZF_IN_OPT ZFObject *param1 = ZFMP_DEF()
320 , ZF_IN_OPT ZFObject *param2 = ZFMP_DEF()
321 , ZF_IN_OPT ZFObject *param3 = ZFMP_DEF()
322 , ZF_IN_OPT ZFObject *param4 = ZFMP_DEF()
323 , ZF_IN_OPT ZFObject *param5 = ZFMP_DEF()
324 , ZF_IN_OPT ZFObject *param6 = ZFMP_DEF()
325 , ZF_IN_OPT ZFObject *param7 = ZFMP_DEF()
326 ) const;
329 ZF_IN const ZFCoreArray<zfauto> &params
330 , ZF_OUT_OPT zfbool *success = zfnull
331 , ZF_OUT_OPT zfstring *errorHint = zfnull
332 ) const;
333
335 void *newInstanceGenericBegin(void) const;
338 ZF_IN void *&token
339 , ZF_IN const ZFMethod *objectOnInitMethod
340 , ZF_IN_OUT const ZFArgs &zfargs
341 ) const;
344 ZF_IN void *&token
345 , ZF_IN zfbool objectOnInitMethodInvokeSuccess
346 ) const;
347
348 zffinal zfauto _ZFP_ZFClass_newInstance(ZF_IN _ZFP_ZFObjectPrivate *dObj) const;
349
357 const ZFClass *implementedInterfaceAt(ZF_IN zfindex index) const;
365 const ZFClass *dynamicInterfaceAt(ZF_IN zfindex index) const;
369 zfbool dynamicImplementOf(ZF_IN const ZFClass *parent) const;
370
379
380 // ============================================================
381 // ZFMethod
382public:
390 zfindex methodCount(void) const;
392 zfiter methodIter(void) const;
394 const ZFMethod *methodIterValue(ZF_IN const zfiter &it) const;
395
406
414 this->methodGetAllT(ret);
415 return ret;
416 }
417
418 /* ZFMETHOD_MAX_PARAM */
431 ZF_IN const zfstring &methodName
432 , ZF_IN const zfchar *paramTypeId0
433 , ZF_IN_OPT const zfchar *paramTypeId1 = zfnull
434 , ZF_IN_OPT const zfchar *paramTypeId2 = zfnull
435 , ZF_IN_OPT const zfchar *paramTypeId3 = zfnull
436 , ZF_IN_OPT const zfchar *paramTypeId4 = zfnull
437 , ZF_IN_OPT const zfchar *paramTypeId5 = zfnull
438 , ZF_IN_OPT const zfchar *paramTypeId6 = zfnull
439 , ZF_IN_OPT const zfchar *paramTypeId7 = zfnull
440 ) const;
442 const ZFMethod *methodForNameIgnoreParent(ZF_IN const zfstring &methodName) const;
446 , ZF_IN const zfstring &methodName
447 ) const;
451 this->methodForNameGetAllIgnoreParentT(ret, methodName);
452 return ret;
453 }
454
463 ZF_IN const zfstring &methodName
464 , ZF_IN const zfchar *paramTypeId0
465 , ZF_IN_OPT const zfchar *paramTypeId1 = zfnull
466 , ZF_IN_OPT const zfchar *paramTypeId2 = zfnull
467 , ZF_IN_OPT const zfchar *paramTypeId3 = zfnull
468 , ZF_IN_OPT const zfchar *paramTypeId4 = zfnull
469 , ZF_IN_OPT const zfchar *paramTypeId5 = zfnull
470 , ZF_IN_OPT const zfchar *paramTypeId6 = zfnull
471 , ZF_IN_OPT const zfchar *paramTypeId7 = zfnull
472 ) const;
474 const ZFMethod *methodForName(ZF_IN const zfstring &methodName) const;
478 , ZF_IN const zfstring &methodName
479 ) const;
485 this->methodForNameGetAllT(ret, methodName);
486 return ret;
487 }
488
489 // ============================================================
490 // ZFProperty
491public:
501 zfiter propertyIter(void) const;
503 const ZFProperty *propertyIterValue(ZF_IN const zfiter &it) const;
504
515
523 this->propertyGetAllT(ret);
524 return ret;
525 }
526
535 const ZFProperty *propertyForNameIgnoreParent(ZF_IN const zfstring &propertyName) const;
545 const ZFProperty *propertyForName(ZF_IN const zfstring &propertyName) const;
546
553 const ZFMethod *propertySetterForNameIgnoreParent(ZF_IN const zfstring &propertyName) const;
560 const ZFMethod *propertySetterForName(ZF_IN const zfstring &propertyName) const;
567 const ZFMethod *propertyGetterForNameIgnoreParent(ZF_IN const zfstring &propertyName) const;
574 const ZFMethod *propertyGetterForName(ZF_IN const zfstring &propertyName) const;
575
584
589 ZF_IN const ZFProperty *property
590 , ZF_IN const ZFClass *refClass
591 ) const;
592
593public:
595 void zfconvRegister(ZF_IN const ZFClass *dstCls, ZF_IN zfconvImpl impl) const;
597 void zfconvUnregister(ZF_IN const ZFClass *dstCls) const;
599 zfconvImpl zfconvCheck(ZF_IN const zfstring &dstCls) const;
601 zfconvImpl zfconvCheck(ZF_IN const ZFClass *dstCls) const;
602
603 // ============================================================
604 // class instance methods
605public:
614 ZF_IN const zfstring &key
615 , ZF_IN ZFObject *tag
616 ) const;
618 zfany classTag(ZF_IN const zfstring &key) const;
623 ) const;
625 inline void classTagRemove(ZF_IN const zfstring &key) const {
626 this->classTag(key, zfnull);
627 }
628
638 zffinal void classTagRemoveAll(void) const;
639
640 // ============================================================
651 ZF_IN const zfstring &key
652 , ZF_IN ZFObject *tag
653 ) const;
655 zfany dataCache(ZF_IN const zfstring &key) const;
660 ) const;
662 inline void dataCacheRemove(ZF_IN const zfstring &key) const {
663 this->dataCache(key, zfnull);
664 }
665
668 zffinal void dataCacheRemoveAll(void) const;
669
670 // ============================================================
676 return _classNameFull.sigId();
677 }
678
679 // ============================================================
680 // private
681public:
682 static ZFClass *_ZFP_ZFClassRegister(
683 ZF_IN const zfstring &classNamespace
684 , ZF_IN const zfstring &className
685 , ZF_IN const ZFClass *parent
686 , ZF_IN const ZFClass *outer
687 , ZF_IN zfbool classCanAllocPublic
688 , ZF_IN _ZFP_ZFObjectConstructor constructor
689 , ZF_IN _ZFP_ZFObjectDestructor destructor
690 , ZF_IN _ZFP_ZFObjectCheckInitImplementationListCallback checkInitImplListCallback
691 , ZF_IN zfbool classIsInterface
692 , ZF_IN zfbool classIsDynamicRegister
693 , ZF_IN ZFObject *classDynamicRegisterUserData
694 );
695 static void _ZFP_ZFClassUnregister(ZF_IN const ZFClass *cls);
697 ZFClass(void);
698 ~ZFClass(void);
700 void _ZFP_ZFClass_release(void);
701 void _ZFP_ZFClass_autoRegister(void) const;
702 inline zfbool _ZFP_ZFClass_interfaceHasRegisterCk(void) const {
703 return ZFBitTest(_stateFlags, _stateFlags_interfaceHasRegisterCk);
704 }
705 inline void _ZFP_ZFClass_interfaceHasRegisterCk(ZF_IN zfbool v) {
706 if(v) {
707 ZFBitSet(_stateFlags, _stateFlags_interfaceHasRegisterCk);
708 }
709 else {
710 ZFBitUnset(_stateFlags, _stateFlags_interfaceHasRegisterCk);
711 }
712 }
713 zfbool _ZFP_ZFClass_interfaceHasRegister(void) {
714 return ZFBitTest(_stateFlags, _stateFlags_interfaceHasRegister);
715 }
716 void _ZFP_ZFClass_interfaceRegister(
717 ZF_IN zfint dummy
718 , ZF_IN const ZFClass *cls
719 , ZF_IN _ZFP_ZFObjectToInterfaceCastCallback callback
720 , ...
721 );
722 ZFInterface *_ZFP_ZFClass_interfaceCast(
723 ZF_IN ZFObject *obj
724 , ZF_IN const ZFClass *interfaceClass
725 ) const;
726 ZFObject *_ZFP_ZFClass_objectCast(
727 ZF_IN ZFObject *obj
728 , ZF_IN const ZFClass *objectClass
729 ) const;
730 ZFObject *_ZFP_ZFClass_objectCastNoExt(
731 ZF_IN ZFObject *obj
732 , ZF_IN const ZFClass *objectClass
733 ) const;
734
735 zfbool _ZFP_ZFClass_ZFImplementDynamicRegister(ZF_IN const ZFClass *clsToImplement) const;
736 void _ZFP_ZFClass_ZFImplementDynamicUnregister(ZF_IN const ZFClass *clsToImplement) const;
737
738 void _ZFP_ZFClass_objectDesctuct(ZF_IN ZFObject *obj) const;
739 inline ZFClass *_ZFP_ZFClass_removeConst(void) const {
740 return const_cast<ZFClass *>(this);
741 }
742
743 void _ZFP_ZFClass_methodRegister(ZF_IN const ZFMethod *method) const;
744 void _ZFP_ZFClass_methodUnregister(ZF_IN const ZFMethod *method) const;
745 void _ZFP_ZFClass_propertyRegister(ZF_IN const ZFProperty *zfproperty) const;
746 void _ZFP_ZFClass_propertyUnregister(ZF_IN const ZFProperty *zfproperty) const;
747 void _ZFP_ZFClass_propertyAutoInitRegister(ZF_IN const ZFProperty *property) const;
748 void _ZFP_ZFClass_propertyAutoInitAction(ZF_IN ZFObject *owner) const;
749 void _ZFP_ZFClass_propertyInitStepRegister(ZF_IN const ZFProperty *property) const;
750
751 _ZFP_ZFObjectConstructor _ZFP_objectConstructor(void) const;
752 _ZFP_ZFObjectDestructor _ZFP_objectDestructor(void) const;
753 void _ZFP_classDynamicRegisterObjectInstanceDetach(ZF_IN ZFObject *obj) const;
754
755 inline zfbool _ZFP_ZFClass_classCanNotAllocPublic(void) const {
756 return ZFBitTest(_stateFlags, _stateFlags_classCanNotAllocPublic);
757 }
758 inline void _ZFP_ZFClass_classCanNotAllocPublic(ZF_IN zfbool v) {
759 if(v) {
760 ZFBitSet(_stateFlags, _stateFlags_classCanNotAllocPublic);
761 }
762 else {
763 ZFBitUnset(_stateFlags, _stateFlags_classCanNotAllocPublic);
764 }
765 }
766
767private:
768 friend zfclassFwd _ZFP_ZFClassPrivate;
769 enum {
770 _stateFlags_classIsAbstract = 1 << 0,
771 _stateFlags_classIsInterface = 1 << 1,
772 _stateFlags_classIsInternal = 1 << 2,
773 _stateFlags_classIsInternalPrivate = 1 << 3,
774 _stateFlags_classIsDynamicRegister = 1 << 4,
775 _stateFlags_classContainDynamicRegister = 1 << 5,
776 _stateFlags_classCanNotAllocPublic = 1 << 6,
777 _stateFlags_interfaceHasRegisterCk = 1 << 7,
778 _stateFlags_interfaceHasRegister = 1 << 8,
779 _stateFlags_methodAndPropertyCacheNeedUpdate = 1 << 9,
780 _stateFlags_hasAutoRegister = 1 << 10,
781 };
782private:
783 _ZFP_ZFClassPrivate *d;
784 zfuint _refCount;
785 zfuint _stateFlags;
786 const ZFClass *_classParent;
787 ZFSigName _classNamespace;
788 ZFSigName _className;
789 ZFSigName _classNameFull;
790};
791
801#define ZFObjectTagKeyword_newInstanceGenericFailed zftext("_ZFP_NIGFail")
802
803// ============================================================
804zfclassLikePOD ZFLIB_ZFCore _ZFP_ZFClassRegisterHolder {
805public:
806 _ZFP_ZFClassRegisterHolder(
807 ZF_IN const zfstring &classNamespace
808 , ZF_IN const zfstring &className
809 , ZF_IN const ZFClass *parent
810 , ZF_IN const ZFClass *outer
811 , ZF_IN zfbool classCanAllocPublic
812 , ZF_IN _ZFP_ZFObjectConstructor constructor
813 , ZF_IN _ZFP_ZFObjectDestructor destructor
814 , ZF_IN _ZFP_ZFObjectCheckInitImplementationListCallback checkInitImplListCallback
815 , ZF_IN_OPT zfbool classIsInterface = zffalse
816 , ZF_IN_OPT zfbool classIsDynamicRegister = zffalse
817 , ZF_IN_OPT ZFObject *classDynamicRegisterUserData = zfnull
818 );
819 ~_ZFP_ZFClassRegisterHolder(void);
820public:
821 ZFClass *cls;
822};
823
824// ============================================================
832 ZFClassGetAllT(ret);
833 return ret;
834}
835
836// ============================================================
867
868extern ZFLIB_ZFCore ZFObserver &_ZFP_ZFClassDataUpdateObserverRef(void);
876#define ZFClassDataUpdateObserver() (_ZFP_ZFClassDataUpdateObserverRef())
877
878// ============================================================
879zfclassNotPOD ZFLIB_ZFCore _ZFP_ZFCoreCriticalClassNotTypeOf {
880public:
881 static zfstring classInfo(ZF_IN const ZFClass *cls) {
882 if(cls) {
883 return cls->classNameFull();
884 }
885 else {
886 return ZFTOKEN_zfnull;
887 }
888 }
889};
893#define ZFCoreCriticalClassNotTypeOf(cls, desired) \
894 ZFCoreCriticalMessage("class %s not type of %s", \
895 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(cls), \
896 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(desired))
897
900#define ZFCoreCriticalClassNotTypeOfDetail(callerInfo, cls, desired) \
901 ZFCoreCriticalMessageDetail(callerInfo, "class %s not type of %s", \
902 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(cls), \
903 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(desired))
904
905// ============================================================
923 ZF_IN const ZFClass *cls
924 , ZF_IN const zfstring &aliasNameFull
925 );
930 ZF_IN const ZFClass *cls
931 , ZF_IN const zfstring &aliasNameFull
932 );
933
934// ============================================================
974 ZF_OUT zfauto &ret
975 , ZF_IN const ZFClass *cls
976 , ZF_IN const zfany &obj
977 , ZF_IN_OPT zfbool implicitConv = zftrue
978 );
981 ZF_IN const ZFClass *cls
982 , ZF_IN const zfany &obj
983 , ZF_IN_OPT zfbool implicitConv = zftrue
984 ) {
985 zfauto ret;
986 zfconvT(ret, cls, obj, implicitConv);
987 return ret;
988}
989
991 ZF_OUT zfauto &ret
992 , ZF_IN const zfstring &cls
993 , ZF_IN const zfany &obj
994 , ZF_IN_OPT zfbool implicitConv = zftrue
995 ) {
996 return zfconvT(ret, ZFClass::classForName(cls), obj, implicitConv);
997}
998
1000 ZF_IN const zfstring &cls
1001 , ZF_IN const zfany &obj
1002 , ZF_IN_OPT zfbool implicitConv = zftrue
1003 ) {
1004 zfauto ret;
1005 zfconvT(ret, ZFClass::classForName(cls), obj, implicitConv);
1006 return ret;
1007}
1008
1010#define ZFCONV_REGISTER(dstCls, srcCls) \
1011 static zfbool _ZFP_zfconv_##dstCls##_##srcCls(ZF_OUT zfauto &ret, ZF_IN const zfany &obj); \
1012 ZF_STATIC_REGISTER_INIT(zfconv_##dstCls##_##srcCls) { \
1013 srcCls::ClassData()->zfconvRegister(dstCls::ClassData(), _ZFP_zfconv_##dstCls##_##srcCls); \
1014 } \
1015 ZF_STATIC_REGISTER_DESTROY(zfconv_##dstCls##_##srcCls) { \
1016 srcCls::ClassData()->zfconvUnregister(dstCls::ClassData()); \
1017 } \
1018 ZF_STATIC_REGISTER_END(zfconv_##dstCls##_##srcCls) \
1019 static zfbool _ZFP_zfconv_##dstCls##_##srcCls(ZF_OUT zfauto &ret, ZF_IN const zfany &obj)
1020
1022#endif // #ifndef _ZFI_ZFClass_h_
1023
zfbool zfconvT(zfauto &ret, const ZFClass *cls, const zfany &obj, zfbool implicitConv=_ZFT_t_zftrue)
object conversion
zfauto zfconv(const ZFClass *cls, const zfany &obj, zfbool implicitConv=_ZFT_t_zftrue)
see zfconvT
Definition ZFClass.h:980
void ZFClassAliasRemove(const ZFClass *cls, const zfstring &aliasNameFull)
see ZFClassAlias
void ZFClassAlias(const ZFClass *cls, const zfstring &aliasNameFull)
alias class to a new name
ZFCoreArray< const ZFClass * > ZFClassGetAll(void)
get all class currently registered, for debug use only
Definition ZFClass.h:830
zfbool(* zfconvImpl)(zfauto &ret, const zfany &obj)
see zfconv
Definition ZFClass.h:15
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:208
#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 ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:200
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:204
#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:212
#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
_ZFT_t_zfuint zfuint
same as unsigned int, see zfindex
Definition ZFCoreTypeDef_CoreType.h:169
#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:467
#define ZFBitTest(var, bit)
macro to detect whether bit is set, zftrue if any one of test bit has set
Definition ZFCoreUtilMacro.h:16
#define ZFBitSet(var, bit)
macro to set at bit
Definition ZFCoreUtilMacro.h:28
#define ZFBitUnset(var, bit)
clear at bit
Definition ZFCoreUtilMacro.h:32
#define ZFCORE_PARAM(T_ParamType, paramName,...)
a util macro to generate setter and getter for POD like object
Definition ZFCoreUtilMacro.h:495
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:357
listener data used by ZFListener
Definition ZFArgs.h:20
ZFObject's class info.
Definition ZFClass.h:63
const ZFMethod * propertySetterForNameIgnoreParent(const zfstring &propertyName) const
try to get property setter method within this class only
void instanceObserverRemoveAll(void) const
see instanceObserverAdd
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:169
void classTagRemove(const zfstring &key) const
see classTag
Definition ZFClass.h:625
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:483
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:181
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:521
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:256
zfbool classContainDynamicRegister(void) const
true if this class or any of parent of this class is classIsDynamicRegister
Definition ZFClass.h:195
zfconvImpl zfconvCheck(const ZFClass *dstCls) const
see zfconv
void dataCacheRemove(const zfstring &key) const
see dataCache
Definition ZFClass.h:662
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:175
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:510
zfauto dataCacheRemoveAndGet(const zfstring &key) const
see dataCache
void instanceObserverAdd(const ZFClassInstanceObserverAddParam &param) const
see instanceObserverAdd
Definition ZFClass.h:115
zfbool classIsInternalPrivate(void) const
whether the class is internal private class
Definition ZFClass.h:242
ZFCoreArray< const ZFMethod * > methodGetAll(void) const
get all method, including methods inherited from parent
Definition ZFClass.h:412
ZFCoreArray< const ZFMethod * > methodForNameGetAllIgnoreParent(const zfstring &methodName) const
see methodForNameIgnoreParent
Definition ZFClass.h:449
const ZFClass * implementedInterfaceAt(zfindex index) const
get implemented interface, see dynamicInterfaceAt
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:139
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
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:150
const ZFClass * classParent(void) const
class's parent, zfnull if none
Definition ZFClass.h:188
void classTagRemoveAll(void) const
see classTag
zfbool classIsAbstract(void) const
true if the class is abstract class
Definition ZFClass.h:214
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:675
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
Definition ZFClass.h:202
zfbool classIsInternal(void) const
whether the class is internal class
Definition ZFClass.h:231
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:220
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:401
void methodForNameGetAllT(ZFCoreArray< const ZFMethod * > &ret, const zfstring &methodName) const
see methodForNameGetAll
see ZFClass::instanceObserverAdd
Definition ZFClass.h:25
ZFLevel & observerLevel(void)
see ZFClass::instanceObserverAdd
Definition ZFClass.h:35
zfbool & observeAllChildType(void)
see ZFClass::instanceObserverAdd
Definition ZFClass.h:38
ZFListener & observer(void)
see ZFClass::instanceObserverAdd
Definition ZFClass.h:29
zfany & owner(void)
see ZFClass::instanceObserverAdd
Definition ZFClass.h:32
light weight array
Definition ZFCoreArray.h:292
dummy base of interface types
Definition ZFObjectInterface.h:249
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:195
holder object for observer logic, see ZFObject::observerNotify
Definition ZFObjectObserver.h:129
info for a property for ZFObject, see ZFPROPERTY_RETAIN for more info
Definition ZFProperty.h:27
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