18typedef ZFObject *(*_ZFP_ZFObjectConstructor)(void);
20typedef void (*_ZFP_ZFObjectCheckInitImplementationListCallback)(
ZF_IN_OUT ZFClass *cls);
44 && this->
observer() == ref.observer()
45 && this->owner() == ref.owner()
46 && this->observerLevel() == ref.observerLevel()
47 && this->observeAllChildType() == ref.observeAllChildType()
51 return !(this->operator == (ref));
116 this->
instanceObserverAdd(param.observer(), param.owner(), param.observerLevel(), param.observeAllChildType());
131 void _ZFP_ZFClass_instanceObserverNotify(
ZF_IN ZFObject *obj)
const;
170 return this->_classNamespace;
176 return this->_className;
182 return this->_classNameFull;
189 return this->_classParent;
196 return ZFBitTest(_stateFlags, _stateFlags_classIsDynamicRegister);
208 return ZFBitTest(_stateFlags, _stateFlags_classIsAbstract);
214 return ZFBitTest(_stateFlags, _stateFlags_classIsInterface);
225 return ZFBitTest(_stateFlags, _stateFlags_classIsInternal);
236 return ZFBitTest(_stateFlags, _stateFlags_classIsInternalPrivate);
250 return !this->_ZFP_ZFClass_classCanNotAllocPublic();
583 ,
ZF_IN const ZFClass *refClass
669 return _classNameFull.sigId();
675 static ZFClass *_ZFP_ZFClassRegister(
681 ,
ZF_IN _ZFP_ZFObjectConstructor constructor
682 ,
ZF_IN _ZFP_ZFObjectDestructor destructor
683 ,
ZF_IN _ZFP_ZFObjectCheckInitImplementationListCallback checkInitImplListCallback
688 static void _ZFP_ZFClassUnregister(
ZF_IN const ZFClass *cls);
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);
698 inline void _ZFP_ZFClass_interfaceHasRegisterCk(
ZF_IN zfbool v) {
700 ZFBitSet(_stateFlags, _stateFlags_interfaceHasRegisterCk);
703 ZFBitUnset(_stateFlags, _stateFlags_interfaceHasRegisterCk);
706 zfbool _ZFP_ZFClass_interfaceHasRegister(
void) {
707 return ZFBitTest(_stateFlags, _stateFlags_interfaceHasRegister);
709 void _ZFP_ZFClass_interfaceRegister(
712 ,
ZF_IN _ZFP_ZFObjectToInterfaceCastCallback callback
724 zfbool _ZFP_ZFClass_ZFImplementDynamicRegister(
ZF_IN const ZFClass *clsToImplement)
const;
725 void _ZFP_ZFClass_ZFImplementDynamicUnregister(
ZF_IN const ZFClass *clsToImplement)
const;
728 inline ZFClass *_ZFP_ZFClass_removeConst(
void)
const {
729 return const_cast<ZFClass *
>(
this);
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;
740 _ZFP_ZFObjectConstructor _ZFP_objectConstructor(
void)
const;
741 _ZFP_ZFObjectDestructor _ZFP_objectDestructor(
void)
const;
742 void _ZFP_classDynamicRegisterObjectInstanceDetach(
ZF_IN ZFObject *obj)
const;
744 inline zfbool _ZFP_ZFClass_classCanNotAllocPublic(
void)
const {
745 return ZFBitTest(_stateFlags, _stateFlags_classCanNotAllocPublic);
747 inline void _ZFP_ZFClass_classCanNotAllocPublic(
ZF_IN zfbool v) {
749 ZFBitSet(_stateFlags, _stateFlags_classCanNotAllocPublic);
752 ZFBitUnset(_stateFlags, _stateFlags_classCanNotAllocPublic);
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,
771 _ZFP_ZFClassPrivate *d;
789#define ZFObjectTagKeyword_newInstanceGenericFailed "_ZFP_NIGFail"
794 _ZFP_ZFClassRegisterHolder(
800 ,
ZF_IN _ZFP_ZFObjectConstructor constructor
801 ,
ZF_IN _ZFP_ZFObjectDestructor destructor
802 ,
ZF_IN _ZFP_ZFObjectCheckInitImplementationListCallback checkInitImplListCallback
807 ~_ZFP_ZFClassRegisterHolder(
void);
864#define ZFClassDataUpdateObserver() (_ZFP_ZFClassDataUpdateObserverRef())
871 return cls->classNameFull();
881#define ZFCoreCriticalClassNotTypeOf(cls, desired) \
882 ZFCoreCriticalMessage("class %s not type of %s", \
883 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(cls), \
884 _ZFP_ZFCoreCriticalClassNotTypeOf::classInfo(desired))
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))
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); \
994 ZF_STATIC_REGISTER_DESTROY(zfconv_##dstCls##_##srcCls) { \
995 srcCls::ClassData()->zfconvUnregister(dstCls::ClassData()); \
997 ZF_STATIC_REGISTER_END(zfconv_##dstCls##_##srcCls) \
998 static zfbool _ZFP_zfconv_##dstCls##_##srcCls(ZF_OUT zfauto &ret, ZF_IN ZFObject *obj)
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 ¶m) 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 > ¶ms, 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
smart pointer for ZFObject