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
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_classIsDynamicRegister);
197 }
198
207 inline zfbool classIsAbstract(void) const {
208 return ZFBitTest(_stateFlags, _stateFlags_classIsAbstract);
209 }
210
213 inline zfbool classIsInterface(void) const {
214 return ZFBitTest(_stateFlags, _stateFlags_classIsInterface);
215 }
216
224 inline zfbool classIsInternal(void) const {
225 return ZFBitTest(_stateFlags, _stateFlags_classIsInternal);
226 }
227
235 inline zfbool classIsInternalPrivate(void) const {
236 return ZFBitTest(_stateFlags, _stateFlags_classIsInternalPrivate);
237 }
238
249 inline zfbool classCanAllocPublic(void) const {
250 return !this->_ZFP_ZFClass_classCanNotAllocPublic();
251 }
252
268 zfauto newInstance(void) const;
269
270 /* ZFMETHOD_MAX_PARAM */
311 ZF_IN ZFObject *param0
312 , ZF_IN_OPT ZFObject *param1 = ZFMP_DEF()
313 , ZF_IN_OPT ZFObject *param2 = ZFMP_DEF()
314 , ZF_IN_OPT ZFObject *param3 = ZFMP_DEF()
315 , ZF_IN_OPT ZFObject *param4 = ZFMP_DEF()
316 , ZF_IN_OPT ZFObject *param5 = ZFMP_DEF()
317 , ZF_IN_OPT ZFObject *param6 = ZFMP_DEF()
318 , ZF_IN_OPT ZFObject *param7 = ZFMP_DEF()
319 ) const;
322 ZF_IN const ZFCoreArray<zfauto> &params
323 , ZF_OUT_OPT zfbool *success = zfnull
324 , ZF_OUT_OPT zfstring *errorHint = zfnull
325 ) const;
326
328 void *newInstanceGenericBegin(void) const;
331 ZF_IN void *&token
332 , ZF_IN const ZFMethod *objectOnInitMethod
333 , ZF_IN_OUT const ZFArgs &zfargs
334 ) const;
337 ZF_IN void *&token
338 , ZF_IN zfbool objectOnInitMethodInvokeSuccess
339 ) const;
340
341 zffinal zfauto _ZFP_ZFClass_newInstance(ZF_IN _ZFP_ZFObjectPrivate *dObj) const;
342
350 const ZFClass *implementedInterfaceAt(ZF_IN zfindex index) const;
358 const ZFClass *dynamicInterfaceAt(ZF_IN zfindex index) const;
362 zfbool dynamicImplementOf(ZF_IN const ZFClass *parent) const;
363
372
373 // ============================================================
374 // ZFMethod
375public:
383 zfindex methodCount(void) const;
385 zfiter methodIter(void) const;
387 const ZFMethod *methodIterValue(ZF_IN const zfiter &it) const;
388
399
407 this->methodGetAllT(ret);
408 return ret;
409 }
410
411 /* ZFMETHOD_MAX_PARAM */
424 ZF_IN const zfstring &methodName
425 , ZF_IN const zfchar *paramTypeId0
426 , ZF_IN_OPT const zfchar *paramTypeId1 = zfnull
427 , ZF_IN_OPT const zfchar *paramTypeId2 = zfnull
428 , ZF_IN_OPT const zfchar *paramTypeId3 = zfnull
429 , ZF_IN_OPT const zfchar *paramTypeId4 = zfnull
430 , ZF_IN_OPT const zfchar *paramTypeId5 = zfnull
431 , ZF_IN_OPT const zfchar *paramTypeId6 = zfnull
432 , ZF_IN_OPT const zfchar *paramTypeId7 = zfnull
433 ) const;
435 const ZFMethod *methodForNameIgnoreParent(ZF_IN const zfstring &methodName) const;
439 , ZF_IN const zfstring &methodName
440 ) const;
444 this->methodForNameGetAllIgnoreParentT(ret, methodName);
445 return ret;
446 }
447
456 ZF_IN const zfstring &methodName
457 , ZF_IN const zfchar *paramTypeId0
458 , ZF_IN_OPT const zfchar *paramTypeId1 = zfnull
459 , ZF_IN_OPT const zfchar *paramTypeId2 = zfnull
460 , ZF_IN_OPT const zfchar *paramTypeId3 = zfnull
461 , ZF_IN_OPT const zfchar *paramTypeId4 = zfnull
462 , ZF_IN_OPT const zfchar *paramTypeId5 = zfnull
463 , ZF_IN_OPT const zfchar *paramTypeId6 = zfnull
464 , ZF_IN_OPT const zfchar *paramTypeId7 = zfnull
465 ) const;
467 const ZFMethod *methodForName(ZF_IN const zfstring &methodName) const;
471 , ZF_IN const zfstring &methodName
472 ) const;
478 this->methodForNameGetAllT(ret, methodName);
479 return ret;
480 }
481
482 // ============================================================
483 // ZFProperty
484public:
494 zfiter propertyIter(void) const;
496 const ZFProperty *propertyIterValue(ZF_IN const zfiter &it) const;
497
508
516 this->propertyGetAllT(ret);
517 return ret;
518 }
519
528 const ZFProperty *propertyForNameIgnoreParent(ZF_IN const zfstring &propertyName) const;
538 const ZFProperty *propertyForName(ZF_IN const zfstring &propertyName) const;
539
546 const ZFMethod *propertySetterForNameIgnoreParent(ZF_IN const zfstring &propertyName) const;
553 const ZFMethod *propertySetterForName(ZF_IN const zfstring &propertyName) const;
560 const ZFMethod *propertyGetterForNameIgnoreParent(ZF_IN const zfstring &propertyName) const;
567 const ZFMethod *propertyGetterForName(ZF_IN const zfstring &propertyName) const;
568
577
582 ZF_IN const ZFProperty *property
583 , ZF_IN const ZFClass *refClass
584 ) const;
585
586public:
588 void zfconvRegister(ZF_IN const ZFClass *dstCls, ZF_IN zfconvImpl impl) const;
590 void zfconvUnregister(ZF_IN const ZFClass *dstCls) const;
592 zfconvImpl zfconvCheck(ZF_IN const zfstring &dstCls) const;
594 zfconvImpl zfconvCheck(ZF_IN const ZFClass *dstCls) const;
595
596 // ============================================================
597 // class instance methods
598public:
607 ZF_IN const zfstring &key
608 , ZF_IN ZFObject *tag
609 ) const;
611 zfany classTag(ZF_IN const zfstring &key) const;
616 ) const;
618 inline void classTagRemove(ZF_IN const zfstring &key) const {
619 this->classTag(key, zfnull);
620 }
621
631 zffinal void classTagRemoveAll(void) const;
632
633 // ============================================================
644 ZF_IN const zfstring &key
645 , ZF_IN ZFObject *tag
646 ) const;
648 zfany dataCache(ZF_IN const zfstring &key) const;
653 ) const;
655 inline void dataCacheRemove(ZF_IN const zfstring &key) const {
656 this->dataCache(key, zfnull);
657 }
658
661 zffinal void dataCacheRemoveAll(void) const;
662
663 // ============================================================
669 return _classNameFull.sigId();
670 }
671
672 // ============================================================
673 // private
674public:
675 static ZFClass *_ZFP_ZFClassRegister(
676 ZF_IN const zfstring &classNamespace
677 , ZF_IN const zfstring &className
678 , ZF_IN const ZFClass *parent
679 , ZF_IN const ZFClass *outer
680 , ZF_IN zfbool classCanAllocPublic
681 , ZF_IN _ZFP_ZFObjectConstructor constructor
682 , ZF_IN _ZFP_ZFObjectDestructor destructor
683 , ZF_IN _ZFP_ZFObjectCheckInitImplementationListCallback checkInitImplListCallback
684 , ZF_IN zfbool classIsInterface
685 , ZF_IN zfbool classIsDynamicRegister
686 , ZF_IN ZFObject *classDynamicRegisterUserData
687 );
688 static void _ZFP_ZFClassUnregister(ZF_IN const ZFClass *cls);
690 ZFClass(void);
691 ~ZFClass(void);
693 void _ZFP_ZFClass_release(void);
694 void _ZFP_ZFClass_autoRegister(void) const;
695 inline zfbool _ZFP_ZFClass_interfaceHasRegisterCk(void) const {
696 return ZFBitTest(_stateFlags, _stateFlags_interfaceHasRegisterCk);
697 }
698 inline void _ZFP_ZFClass_interfaceHasRegisterCk(ZF_IN zfbool v) {
699 if(v) {
700 ZFBitSet(_stateFlags, _stateFlags_interfaceHasRegisterCk);
701 }
702 else {
703 ZFBitUnset(_stateFlags, _stateFlags_interfaceHasRegisterCk);
704 }
705 }
706 zfbool _ZFP_ZFClass_interfaceHasRegister(void) {
707 return ZFBitTest(_stateFlags, _stateFlags_interfaceHasRegister);
708 }
709 void _ZFP_ZFClass_interfaceRegister(
710 ZF_IN zfint dummy
711 , ZF_IN const ZFClass *cls
712 , ZF_IN _ZFP_ZFObjectToInterfaceCastCallback callback
713 , ...
714 );
715 ZFInterface *_ZFP_ZFClass_interfaceCast(
716 ZF_IN ZFObject *obj
717 , ZF_IN const ZFClass *interfaceClass
718 ) const;
719 ZFObject *_ZFP_ZFClass_objectCast(
720 ZF_IN ZFObject *obj
721 , ZF_IN const ZFClass *objectClass
722 ) const;
723
724 zfbool _ZFP_ZFClass_ZFImplementDynamicRegister(ZF_IN const ZFClass *clsToImplement) const;
725 void _ZFP_ZFClass_ZFImplementDynamicUnregister(ZF_IN const ZFClass *clsToImplement) const;
726
727 void _ZFP_ZFClass_objectDesctuct(ZF_IN ZFObject *obj) const;
728 inline ZFClass *_ZFP_ZFClass_removeConst(void) const {
729 return const_cast<ZFClass *>(this);
730 }
731
732 void _ZFP_ZFClass_methodRegister(ZF_IN const ZFMethod *method) const;
733 void _ZFP_ZFClass_methodUnregister(ZF_IN const ZFMethod *method) const;
734 void _ZFP_ZFClass_propertyRegister(ZF_IN const ZFProperty *zfproperty) const;
735 void _ZFP_ZFClass_propertyUnregister(ZF_IN const ZFProperty *zfproperty) const;
736 void _ZFP_ZFClass_propertyAutoInitRegister(ZF_IN const ZFProperty *property) const;
737 void _ZFP_ZFClass_propertyAutoInitAction(ZF_IN ZFObject *owner) const;
738 void _ZFP_ZFClass_propertyInitStepRegister(ZF_IN const ZFProperty *property) const;
739
740 _ZFP_ZFObjectConstructor _ZFP_objectConstructor(void) const;
741 _ZFP_ZFObjectDestructor _ZFP_objectDestructor(void) const;
742 void _ZFP_classDynamicRegisterObjectInstanceDetach(ZF_IN ZFObject *obj) const;
743
744 inline zfbool _ZFP_ZFClass_classCanNotAllocPublic(void) const {
745 return ZFBitTest(_stateFlags, _stateFlags_classCanNotAllocPublic);
746 }
747 inline void _ZFP_ZFClass_classCanNotAllocPublic(ZF_IN zfbool v) {
748 if(v) {
749 ZFBitSet(_stateFlags, _stateFlags_classCanNotAllocPublic);
750 }
751 else {
752 ZFBitUnset(_stateFlags, _stateFlags_classCanNotAllocPublic);
753 }
754 }
755
756private:
757 friend zfclassFwd _ZFP_ZFClassPrivate;
758 enum {
759 _stateFlags_classIsAbstract = 1 << 0,
760 _stateFlags_classIsInterface = 1 << 1,
761 _stateFlags_classIsInternal = 1 << 2,
762 _stateFlags_classIsInternalPrivate = 1 << 3,
763 _stateFlags_classIsDynamicRegister = 1 << 4,
764 _stateFlags_classCanNotAllocPublic = 1 << 5,
765 _stateFlags_interfaceHasRegisterCk = 1 << 6,
766 _stateFlags_interfaceHasRegister = 1 << 7,
767 _stateFlags_methodAndPropertyCacheNeedUpdate = 1 << 8,
768 _stateFlags_hasAutoRegister = 1 << 9,
769 };
770private:
771 _ZFP_ZFClassPrivate *d;
772 zfuint _refCount;
773 zfuint _stateFlags;
774 const ZFClass *_classParent;
775 ZFSigName _classNamespace;
776 ZFSigName _className;
777 ZFSigName _classNameFull;
778};
779
789#define ZFObjectTagKeyword_newInstanceGenericFailed "_ZFP_NIGFail"
790
791// ============================================================
792zfclassLikePOD ZFLIB_ZFCore _ZFP_ZFClassRegisterHolder {
793public:
794 _ZFP_ZFClassRegisterHolder(
795 ZF_IN const zfstring &classNamespace
796 , ZF_IN const zfstring &className
797 , ZF_IN const ZFClass *parent
798 , ZF_IN const ZFClass *outer
799 , ZF_IN zfbool classCanAllocPublic
800 , ZF_IN _ZFP_ZFObjectConstructor constructor
801 , ZF_IN _ZFP_ZFObjectDestructor destructor
802 , ZF_IN _ZFP_ZFObjectCheckInitImplementationListCallback checkInitImplListCallback
803 , ZF_IN_OPT zfbool classIsInterface = zffalse
804 , ZF_IN_OPT zfbool classIsDynamicRegister = zffalse
805 , ZF_IN_OPT ZFObject *classDynamicRegisterUserData = zfnull
806 );
807 ~_ZFP_ZFClassRegisterHolder(void);
808public:
809 ZFClass *cls;
810};
811
812// ============================================================
820 ZFClassGetAllT(ret);
821 return ret;
822}
823
824// ============================================================
855
856extern ZFLIB_ZFCore ZFObserver &_ZFP_ZFClassDataUpdateObserverRef(void);
864#define ZFClassDataUpdateObserver() (_ZFP_ZFClassDataUpdateObserverRef())
865
866// ============================================================
867zfclassNotPOD ZFLIB_ZFCore _ZFP_ZFCoreCriticalClassNotTypeOf {
868public:
869 static zfstring classInfo(ZF_IN const ZFClass *cls) {
870 if(cls) {
871 return cls->classNameFull();
872 }
873 else {
874 return ZFTOKEN_zfnull;
875 }
876 }
877};
881#define ZFCoreCriticalClassNotTypeOf(cls, desired) \
882 ZFCoreCriticalMessage("class %s not type of %s", \
883 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(cls), \
884 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(desired))
885
888#define ZFCoreCriticalClassNotTypeOfDetail(callerInfo, cls, desired) \
889 ZFCoreCriticalMessageDetail(callerInfo, "class %s not type of %s", \
890 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(cls), \
891 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(desired))
892
893// ============================================================
911 ZF_IN const ZFClass *cls
912 , ZF_IN const zfstring &aliasNameFull
913 );
918 ZF_IN const ZFClass *cls
919 , ZF_IN const zfstring &aliasNameFull
920 );
921
922// ============================================================
962 ZF_IN const zfstring &cls
963 , ZF_IN ZFObject *obj
964 , ZF_IN_OPT zfbool implicitConv = zftrue
965 );
968 ZF_IN const ZFClass *cls
969 , ZF_IN ZFObject *obj
970 , ZF_IN_OPT zfbool implicitConv = zftrue
971 );
972
975 ZF_OUT zfauto &ret
976 , ZF_IN const zfstring &cls
977 , ZF_IN ZFObject *obj
978 , ZF_IN_OPT zfbool implicitConv = zftrue
979 );
982 ZF_OUT zfauto &ret
983 , ZF_IN const ZFClass *cls
984 , ZF_IN ZFObject *obj
985 , ZF_IN_OPT zfbool implicitConv = zftrue
986 );
987
989#define ZFCONV_REG(dstCls, srcCls) \
990 static zfbool _ZFP_zfconv_##dstCls##_##srcCls(ZF_OUT zfauto &ret, ZF_IN ZFObject *obj); \
991 ZF_STATIC_REGISTER_INIT(zfconv_##dstCls##_##srcCls) { \
992 srcCls::ClassData()->zfconvRegister(dstCls::ClassData(), _ZFP_zfconv_##dstCls##_##srcCls); \
993 } \
994 ZF_STATIC_REGISTER_DESTROY(zfconv_##dstCls##_##srcCls) { \
995 srcCls::ClassData()->zfconvUnregister(dstCls::ClassData()); \
996 } \
997 ZF_STATIC_REGISTER_END(zfconv_##dstCls##_##srcCls) \
998 static zfbool _ZFP_zfconv_##dstCls##_##srcCls(ZF_OUT zfauto &ret, ZF_IN ZFObject *obj)
999
1001#endif // #ifndef _ZFI_ZFClass_h_
1002
zfbool(* zfconvImpl)(zfauto &ret, ZFObject *obj)
see zfconv
Definition ZFClass.h:15
void ZFClassAliasRemove(const ZFClass *cls, const zfstring &aliasNameFull)
see ZFClassAlias
zfbool zfconvT(zfauto &ret, const zfstring &cls, ZFObject *obj, zfbool implicitConv=_ZFT_t_zftrue)
see zfconv
void ZFClassAlias(const ZFClass *cls, const zfstring &aliasNameFull)
alias class to a new name
zfauto zfconv(const zfstring &cls, ZFObject *obj, zfbool implicitConv=_ZFT_t_zftrue)
object conversion
ZFCoreArray< const ZFClass * > ZFClassGetAll(void)
get all class currently registered, for debug use only
Definition ZFClass.h:818
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:203
#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:191
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:195
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:199
#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:207
#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:618
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:476
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:514
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:249
zfconvImpl zfconvCheck(const ZFClass *dstCls) const
see zfconv
void dataCacheRemove(const zfstring &key) const
see dataCache
Definition ZFClass.h:655
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:503
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:235
ZFCoreArray< const ZFMethod * > methodGetAll(void) const
get all method, including methods inherited from parent
Definition ZFClass.h:405
ZFCoreArray< const ZFMethod * > methodForNameGetAllIgnoreParent(const zfstring &methodName) const
see methodForNameIgnoreParent
Definition ZFClass.h:442
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:207
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:668
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:195
zfbool classIsInternal(void) const
whether the class is internal class
Definition ZFClass.h:224
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:213
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:394
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:348
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: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