ZFObject's class info. More...
#include <ZFClass.h>
Public Member Functions | |
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 | instanceObserverAdd (const ZFClassInstanceObserverAddParam ¶m) const |
see instanceObserverAdd | |
void | instanceObserverRemove (const ZFListener &observer) const |
see instanceObserverAdd | |
void | instanceObserverRemoveByOwner (ZFObject *owner) const |
see instanceObserverAdd | |
void | instanceObserverRemoveAll (void) const |
see instanceObserverAdd | |
void | objectInfoT (zfstring &ret) const |
see objectInfo | |
zfstring | objectInfo (void) const |
return object info | |
void | objectInfoOfInheritTreeT (zfstring &ret) const |
see objectInfoOfInheritTree | |
zfstring | objectInfoOfInheritTree (void) const |
return a string describe the class inherit tree, debug use only | |
zfbool | classIsTypeOf (const ZFClass *cls) const |
true if class is subclass of cls, or implement cls | |
const ZFCoreArray< zfstring > & | classAliasTo (void) const |
see ZFClassAlias | |
const zfstring & | classNamespace (void) const |
class namespace, null or empty string for global scope class | |
const zfstring & | className (void) const |
class name, e.g. "ZFObject" | |
const zfstring & | classNameFull (void) const |
class full name, e.g. "NS0.NS1.YourObject" | |
const ZFClass * | classParent (void) const |
class's parent, zfnull if none | |
zfbool | classIsDynamicRegister (void) const |
true if class is registered by ZFClassDynamicRegister | |
zfany | classDynamicRegisterUserData (void) const |
see ZFClassDynamicRegister | |
zfbool | classIsAbstract (void) const |
true if the class is abstract class | |
zfbool | classIsInterface (void) const |
true if the class is an interface | |
zfbool | classIsInternal (void) const |
whether the class is internal class | |
zfbool | classIsInternalPrivate (void) const |
whether the class is internal private class | |
zfbool | classCanAllocPublic (void) const |
whether the class can alloc directly, see ZFOBJECT_PRIVATE_ALLOC | |
zfauto | newInstance (void) const |
make a new instance of ZFObject dynamically, which is described by ZFClass | |
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 | |
zfauto | newInstanceDetail (const ZFCoreArray< zfauto > ¶ms, zfbool *success=zft_zfnull, zfstring *errorHint=zft_zfnull) const |
see newInstance | |
void * | newInstanceGenericBegin (void) const |
see newInstance | |
zfbool | newInstanceGenericCheck (void *&token, const ZFMethod *objectOnInitMethod, const ZFArgs &zfargs) const |
see newInstance | |
zfauto | newInstanceGenericEnd (void *&token, zfbool objectOnInitMethodInvokeSuccess) const |
see newInstance | |
zfindex | implementedInterfaceCount (void) const |
get implemented interface count, see dynamicInterfaceAt | |
const ZFClass * | implementedInterfaceAt (zfindex index) const |
get implemented interface, see dynamicInterfaceAt | |
zfindex | dynamicInterfaceCount (void) const |
get dynamic interface registered by ZFImplementDynamicRegister, see implementedInterfaceAt | |
const ZFClass * | dynamicInterfaceAt (zfindex index) const |
get dynamic interface registered by ZFImplementDynamicRegister, see implementedInterfaceAt | |
zfbool | dynamicImplementOf (const ZFClass *parent) const |
true if this class dynamic implement specified parent by ZFImplementDynamicRegister | |
ZFCoreArray< const ZFClass * > | childGetAll (void) const |
get all child excluding self, for debug use only | |
ZFCoreArray< const ZFClass * > | parentGetAll (void) const |
get all parent (parent/interface/dynamicInterface) excluding self, for debug use only | |
zfindex | methodCount (void) const |
get the count of method registered to this ZFClass | |
zfiter | methodIter (void) const |
see zfiter | |
const ZFMethod * | methodIterValue (const zfiter &it) const |
see zfiter | |
void | methodGetAllIgnoreParentT (ZFCoreArray< const ZFMethod * > &ret) const |
see methodGetAllIgnoreParent | |
ZFCoreArray< const ZFMethod * > | methodGetAllIgnoreParent (void) const |
get all method, excluding methods inherited from parent | |
void | methodGetAllT (ZFCoreArray< const ZFMethod * > &ret) const |
see methodGetAll | |
ZFCoreArray< const ZFMethod * > | methodGetAll (void) const |
get all method, including methods inherited from parent | |
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 | |
const ZFMethod * | methodForNameIgnoreParent (const zfstring &methodName) const |
see methodForNameIgnoreParent | |
void | methodForNameGetAllIgnoreParentT (ZFCoreArray< const ZFMethod * > &ret, const zfstring &methodName) const |
see methodForNameIgnoreParent | |
ZFCoreArray< const ZFMethod * > | methodForNameGetAllIgnoreParent (const zfstring &methodName) const |
see methodForNameIgnoreParent | |
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 | |
const ZFMethod * | methodForName (const zfstring &methodName) const |
see methodForName | |
void | methodForNameGetAllT (ZFCoreArray< const ZFMethod * > &ret, const zfstring &methodName) const |
see methodForNameGetAll | |
ZFCoreArray< const ZFMethod * > | methodForNameGetAll (const zfstring &methodName) const |
get all method with name, ignoring method id | |
zfindex | propertyCount (void) const |
get ZFProperty count registered to this class | |
zfiter | propertyIter (void) const |
see zfiter | |
const ZFProperty * | propertyIterValue (const zfiter &it) const |
see zfiter | |
void | propertyGetAllIgnoreParentT (ZFCoreArray< const ZFProperty * > &ret) const |
see propertyGetAllIgnoreParent | |
ZFCoreArray< const ZFProperty * > | propertyGetAllIgnoreParent (void) const |
get all property, including properties inherited from parent | |
void | propertyGetAllT (ZFCoreArray< const ZFProperty * > &ret) const |
see propertyGetAll | |
ZFCoreArray< const ZFProperty * > | propertyGetAll (void) const |
get all property, including properties inherited from parent | |
const ZFProperty * | propertyForNameIgnoreParent (const zfstring &propertyName) const |
get the property by name within this class only, or zfnull if not exists | |
const ZFProperty * | propertyForName (const zfstring &propertyName) const |
get the property by name hierarchically from class inherit tree, or zfnull if not exists | |
const ZFMethod * | propertySetterForNameIgnoreParent (const zfstring &propertyName) const |
try to get property setter method within this class only | |
const ZFMethod * | propertySetterForName (const zfstring &propertyName) const |
try to get property setter method | |
const ZFMethod * | propertyGetterForNameIgnoreParent (const zfstring &propertyName) const |
try to get property getter method within this class only | |
const ZFMethod * | propertyGetterForName (const zfstring &propertyName) const |
try to get property getter method | |
zfbool | propertyInitStepExist (void) const |
whether the property has ZFPROPERTY_ON_INIT_DECLARE | |
zfbool | propertyInitStepExist (const ZFProperty *property) const |
whether the property has ZFPROPERTY_ON_INIT_DECLARE | |
zfbool | propertyInitStepIsEqual (const ZFProperty *property, const ZFClass *refClass) const |
whether two class has same property init step | |
void | classTag (const zfstring &key, ZFObject *tag) const |
set a classTag for the class, internal use only | |
zfany | classTag (const zfstring &key) const |
see classTag | |
void | classTagGetAllKeyValue (ZFCoreArray< zfstring > &allKey, ZFCoreArray< zfauto > &allValue) const |
see classTag | |
void | classTagRemove (const zfstring &key) const |
see classTag | |
zfauto | classTagRemoveAndGet (const zfstring &key) const |
see classTag | |
void | classTagRemoveAll (void) const |
see classTag | |
void | dataCache (const zfstring &key, ZFObject *tag) const |
store class meta data cache, internal use only | |
zfany | dataCache (const zfstring &key) const |
see dataCache | |
void | dataCacheGetAllKeyValue (ZFCoreArray< zfstring > &allKey, ZFCoreArray< zfauto > &allValue) const |
see dataCache | |
void | dataCacheRemove (const zfstring &key) const |
see dataCache | |
zfauto | dataCacheRemoveAndGet (const zfstring &key) const |
see dataCache | |
void | dataCacheRemoveAll (void) const |
see dataCache | |
zfidentity | classId (void) const |
a unique id that represents the class | |
Static Public Member Functions | |
static const ZFClass * | classForName (const zfstring &classNameOrFullName) |
get class info by name | |
static const ZFClass * | classForName (const zfstring &className, const zfstring &classNamespace) |
find class with explicit namespace, see classForName | |
get class info by name
typical usage:
void ZFClass::instanceObserverRemoveAll | ( | void | ) | const |
|
inline |
true if the class is abstract class
newInstance would return zfnull if the class is abstract
|
inline |
whether the class is internal class
all class that have "_ZFP_" as prefix (or parent scope prefix) would be treated as internal class
internal class should not be used publicly, however, you may still apply alloc observer or reflection, see classIsInternalPrivate
|
inline |
whether the class is internal private class
all class that have "_ZFP_I_" as prefix (or parent scope prefix) would be treated as internal private class
internal private class should not be used publicly, also, it would be ignored from alloc observer and reflection, see classIsInternal
|
inline |
whether the class can alloc directly, see ZFOBJECT_PRIVATE_ALLOC
when marked by ZFOBJECT_PRIVATE_ALLOC, the class can not be created normally (zfAlloc or ZFDI_alloc), typically it's protected by impl to prevent internal class from being allocated accidently, but you can still create by reflection, i.e. newInstance series
zfauto ZFClass::newInstance | ( | void | ) | const |
make a new instance of ZFObject dynamically, which is described by ZFClass
typical usage:
zfauto ZFClass::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
create object by specified params, the object must have proper ZFObject::objectOnInit declared as ZFOBJECT_ON_INIT_DECLARE_1 series, and params are passed according to ZFMethodGenericInvoker
zfindex ZFClass::methodCount | ( | void | ) | const |
get the count of method registered to this ZFClass
note that parent class's method won't be included
the order is ensured to be the same as ZFMethod declared
const ZFMethod * ZFClass::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
the following optional params are, type id of each param type described by ZFTypeId::TypeId, if more than one method with same name (and or param type id) were found, the first one would be returned
const ZFMethod * ZFClass::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
searching from subclass to parent class, return the first matched
zfindex ZFClass::propertyCount | ( | void | ) | const |
get ZFProperty count registered to this class
note that parent class's property won't be included
the order is ensured to be the same as property declared
const ZFProperty * ZFClass::propertyForNameIgnoreParent | ( | const zfstring & | propertyName | ) | const |
get the property by name within this class only, or zfnull if not exists
propertyName should be "Property" without "set" or "get"
note that parent class's property won't be included
const ZFProperty * ZFClass::propertyForName | ( | const zfstring & | propertyName | ) | const |
get the property by name hierarchically from class inherit tree, or zfnull if not exists
propertyName should be "Property" without "set" or "get"
searching from subclass to parent class, return the first matched
try to get property setter method within this class only
note, the property has no need to exist, we only search method with proper name and param and return type
try to get property setter method
note, the property has no need to exist, we only search method with proper name and param and return type
try to get property getter method within this class only
note, the property has no need to exist, we only search method with proper name and param and return type
try to get property getter method
note, the property has no need to exist, we only search method with proper name and param and return type
set a classTag for the class, internal use only
void ZFClass::classTagRemoveAll | ( | void | ) | const |
see classTag
store class meta data cache, internal use only
|
inline |
a unique id that represents the class