6#ifndef _ZFI_ZFProperty_h_
7#define _ZFI_ZFProperty_h_
16typedef void (*_ZFP_ZFPropertyCallbackEnsureInit)(
20typedef void (*_ZFP_ZFPropertyCallbackDealloc)(
47 return _propertyId.sigId();
53 return ZFBitTest(_stateFlags, _stateFlags_isUserRegister);
59 return ZFBitTest(_stateFlags, _stateFlags_isDynamicRegister);
65 return _dynamicRegisterUserData;
100 return _propertyTypeName ? _propertyTypeName : _propertyTypeId;
111 return _propertyTypeId;
117 return _setterMethod;
123 return _getterMethod;
133 return (_propertyClassOfRetainProperty !=
zfnull);
141 return _propertyClassOfRetainProperty;
156 return ZFBitTest(_stateFlags, _stateFlags_isInternal);
169 return ZFBitTest(_stateFlags, _stateFlags_isInternalPrivate);
191 static ZFProperty *_ZFP_ZFPropertyRegister(
207 ,
ZF_IN _ZFP_ZFPropertyCallbackEnsureInit callbackEnsureInit
208 ,
ZF_IN _ZFP_ZFPropertyCallbackDealloc callbackDealloc
210 static void _ZFP_ZFPropertyUnregister(
ZF_IN const ZFProperty *propertyInfo);
212 void _ZFP_ZFPropertyInit(
224 ZFProperty *_ZFP_ZFProperty_removeConst(
void)
const {
225 return const_cast<ZFProperty *
>(
this);
227 inline ZFObject *_ZFP_ZFProperty_dynamicRegisterUserDataWrapper(
void)
const {
228 return _dynamicRegisterUserDataWrapper;
230 void _ZFP_ZFProperty_dynamicRegisterUserDataWrapper(
ZF_IN ZFObject *v)
const;
232 _ZFP_ZFPropertyCallbackEnsureInit _ZFP_ZFProperty_callbackEnsureInit(
void)
const {
233 return _callbackEnsureInit;
235 _ZFP_ZFPropertyCallbackDealloc _ZFP_ZFProperty_callbackDealloc(
void)
const {
236 return _callbackDealloc;
241 _stateFlags_isInternal = 1 << 0,
242 _stateFlags_isInternalPrivate = 1 << 1,
243 _stateFlags_isUserRegister = 1 << 2,
244 _stateFlags_isDynamicRegister = 1 << 3,
251 ZFObject *_dynamicRegisterUserDataWrapper;
258 const ZFClass *_propertyClassOfRetainProperty;
259 _ZFP_ZFPropertyCallbackEnsureInit _callbackEnsureInit;
260 _ZFP_ZFPropertyCallbackDealloc _callbackDealloc;
283 _ZFP_ZFPropertyRegisterHolder(
299 ,
ZF_IN _ZFP_ZFPropertyCallbackEnsureInit callbackEnsureInit
300 ,
ZF_IN _ZFP_ZFPropertyCallbackDealloc callbackDealloc
302 : propertyInfo(
ZFProperty::_ZFP_ZFPropertyRegister(
305 , dynamicRegisterUserData
312 , propertyClassOfRetainProperty
313 , callbackIsValueAccessed
314 , callbackIsInitValue
316 , callbackUserRegisterInitValueSetup
317 , callbackDynamicRegisterInitValueGetter
322 ~_ZFP_ZFPropertyRegisterHolder(
void) {
323 ZFProperty::_ZFP_ZFPropertyUnregister(this->propertyInfo);
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
#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:184
#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:200
#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_zfidentity zfidentity
identity type, ensured at least 32 bit, ensured unsigned
Definition ZFCoreTypeDef_CoreType.h:225
#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
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZFBitTest(var, bit)
macro to detect whether bit is set, zftrue if any one of test bit has set
Definition ZFCoreUtilMacro.h:16
reflectable method definination for ZFFramework
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
ZFCoreArray< const ZFProperty * > ZFPropertyGetAll(void)
get all property currently registered, for debug use only
Definition ZFProperty.h:274
void ZFPropertyGetAllT(ZFCoreArray< const ZFProperty * > &ret)
see ZFPropertyGetAll
property for ZFObject type
zfauto(* ZFPropertyCallbackDynamicRegisterInitValueGetter)(const ZFProperty *property)
callback to setup init value for ZFPropertyDynamicRegister
Definition ZFPropertyFwd.h:86
zfbool(* ZFPropertyCallbackIsValueAccessed)(const ZFProperty *property, zfany const &ownerObj)
used to check whether the property has been accessed
Definition ZFPropertyFwd.h:27
void(* ZFPropertyCallbackValueReset)(const ZFProperty *property, zfany const &ownerObj)
used to reset the property to its init state
Definition ZFPropertyFwd.h:63
zfbool(* ZFPropertyCallbackIsInitValue)(const ZFProperty *property, zfany const &ownerObj, zfauto *outInitValue)
used to check whether the property is in init value state
Definition ZFPropertyFwd.h:48
void(* ZFPropertyCallbackUserRegisterInitValueSetup)(const ZFProperty *property, void *v)
for user registered property only, used to setup a property's init value
Definition ZFPropertyFwd.h:77
ZFObject's class info.
Definition ZFClass.h:66
light weight array
Definition ZFCoreArray.h:344
reflectable method for ZFObject
Definition ZFMethod.h:252
base class of all objects
Definition ZFObjectCore.h:196
info for a property for ZFObject, see ZFPROPERTY_RETAIN for more info
Definition ZFProperty.h:27
const ZFMethod * getterMethod(void) const
get the getter method
Definition ZFProperty.h:122
void objectInfoT(zfstring &ret) const
see objectInfo
const ZFMethod * setterMethod(void) const
get the getter method
Definition ZFProperty.h:116
zfstring objectInfo(void) const
get info about this property
Definition ZFProperty.h:36
ZFPropertyCallbackValueReset callbackValueReset
see ZFPropertyCallbackValueReset
Definition ZFProperty.h:178
const zfstring & propertyTypeId(void) const
type id string declared in ZFPROPERTY_XXX
Definition ZFProperty.h:110
ZFPropertyCallbackIsValueAccessed callbackIsValueAccessed
see ZFPropertyCallbackIsValueAccessed
Definition ZFProperty.h:174
zfbool isUserRegister(void) const
true if this property is registered by ZFPropertyUserRegisterRetain
Definition ZFProperty.h:52
zfbool isInternalPrivate(void) const
whether the property is internal private property
Definition ZFProperty.h:168
ZFPropertyCallbackDynamicRegisterInitValueGetter callbackDynamicRegisterInitValueGetter
see ZFPropertyDynamicRegister
Definition ZFProperty.h:182
zfbool isRetainProperty(void) const
true if the property is retain property
Definition ZFProperty.h:132
ZFPropertyCallbackUserRegisterInitValueSetup callbackUserRegisterInitValueSetup
see ZFPropertyUserRegisterAssign
Definition ZFProperty.h:180
const zfstring & propertyTypeName(void) const
type string for the property
Definition ZFProperty.h:99
const ZFClass * ownerClass(void) const
get the property's owner class
Definition ZFProperty.h:82
ZFPropertyCallbackIsInitValue callbackIsInitValue
see ZFPropertyCallbackIsInitValue
Definition ZFProperty.h:176
zfbool propertySerializable(void) const
true if the property is serializable
zfany dynamicRegisterUserData(void) const
see ZFPropertyDynamicRegister
Definition ZFProperty.h:64
const ZFClass * propertyClassOfRetainProperty(void) const
for retain property only, get the retain property's declared class
Definition ZFProperty.h:140
zfbool isInternal(void) const
whether the property is internal property
Definition ZFProperty.h:155
const zfstring & propertyName(void) const
name for the property
Definition ZFProperty.h:88
zfbool isDynamicRegister(void) const
true if this property is registered by ZFPropertyDynamicRegister
Definition ZFProperty.h:58
zfidentity propertyId(void) const
internal property id, for debug use only
Definition ZFProperty.h:46
readonly string container for internal use only
Definition ZFSigName.h:17
util method to cast ZFObject types freely
Definition zfany.h:35
util class to cast ZFObject types freely