ZFFramework
|
ZFObject's class info. More...
#include <ZFClass.h>
Public Member Functions | |
void | instanceObserverAdd (const ZFListener &observer, ZFObject *owner=0, 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 | classDataChangeAutoRemoveTagAdd (const zfchar *tag) const |
auto remove classTagRemove when class meta data changed | |
void | classDataChangeAutoRemoveTagRemove (const zfchar *tag) const |
see classDataChangeAutoRemoveTagAdd | |
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 zfchar * | classNamespace (void) const |
class namespace, null or empty string for global scope class | |
const zfchar * | className (void) const |
class name, e.g. "ZFObject" | |
const zfchar * | 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_ZFMethodGenericInvokerDefaultParamRef), ZFObject *param2=((ZFObject *const &) _ZFP_ZFMethodGenericInvokerDefaultParamRef), ZFObject *param3=((ZFObject *const &) _ZFP_ZFMethodGenericInvokerDefaultParamRef), ZFObject *param4=((ZFObject *const &) _ZFP_ZFMethodGenericInvokerDefaultParamRef), ZFObject *param5=((ZFObject *const &) _ZFP_ZFMethodGenericInvokerDefaultParamRef), ZFObject *param6=((ZFObject *const &) _ZFP_ZFMethodGenericInvokerDefaultParamRef), ZFObject *param7=((ZFObject *const &) _ZFP_ZFMethodGenericInvokerDefaultParamRef)) const |
for advanced reflection use only | |
zfauto | newInstanceDetail (const ZFCoreArray< zfauto > ¶ms, zfbool *success=0, zfstring *errorHint=0) const |
see newInstance | |
void * | newInstanceGenericBegin (void) const |
see newInstance | |
zfbool | newInstanceGenericCheck (void *&token, const ZFMethod *objectOnInitMethod, zfindex paramCount, zfauto(¶mList)[8], zfstring *errorHint=0) const |
see newInstance | |
zfauto | newInstanceGenericEnd (void *&token, zfbool objectOnInitMethodInvokeSuccess) const |
see newInstance | |
zfindex | implementedInterfaceCount (void) const |
get implemented interface count | |
const ZFClass * | implementedInterfaceAt (zfindex index) const |
get implemented interface | |
zfindex | methodCount (void) const |
get the count of method registered to this ZFClass | |
const ZFMethod * | methodAt (zfindex index) const |
get the method at index, assert fail if out of bounds | |
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 zfchar *methodName, const zfchar *methodParamTypeId0, const zfchar *methodParamTypeId1=0, const zfchar *methodParamTypeId2=0, const zfchar *methodParamTypeId3=0, const zfchar *methodParamTypeId4=0, const zfchar *methodParamTypeId5=0, const zfchar *methodParamTypeId6=0, const zfchar *methodParamTypeId7=0) const |
get the method by name within this class only, or zfnull if not exists | |
const ZFMethod * | methodForNameIgnoreParent (const zfchar *methodName) const |
see methodForNameIgnoreParent | |
void | methodForNameIgnoreParentGetAllT (ZFCoreArray< const ZFMethod * > &ret, const zfchar *methodName) const |
see methodForNameIgnoreParent | |
ZFCoreArray< const ZFMethod * > | methodForNameIgnoreParentGetAll (const zfchar *methodName) const |
see methodForNameIgnoreParent | |
const ZFMethod * | methodForName (const zfchar *methodName, const zfchar *methodParamTypeId0, const zfchar *methodParamTypeId1=0, const zfchar *methodParamTypeId2=0, const zfchar *methodParamTypeId3=0, const zfchar *methodParamTypeId4=0, const zfchar *methodParamTypeId5=0, const zfchar *methodParamTypeId6=0, const zfchar *methodParamTypeId7=0) const |
get the method by name hierarchically from class inherit tree, or zfnull if not exists | |
const ZFMethod * | methodForName (const zfchar *methodName) const |
see methodForName | |
void | methodForNameGetAllT (ZFCoreArray< const ZFMethod * > &ret, const zfchar *methodName) const |
see methodForNameGetAll | |
ZFCoreArray< const ZFMethod * > | methodForNameGetAll (const zfchar *methodName) const |
get all method with name, ignoring method id | |
zfindex | propertyCount (void) const |
get ZFProperty count registered to this class | |
const ZFProperty * | propertyAt (zfindex index) const |
get ZFProperty at index | |
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 zfchar *propertyName) const |
get the property by name within this class only, or zfnull if not exists | |
const ZFProperty * | propertyForName (const zfchar *propertyName) const |
get the property by name hierarchically from class inherit tree, or zfnull if not exists | |
const ZFMethod * | propertySetterForNameIgnoreParent (const zfchar *propertyName) const |
try to get property setter method within this class only | |
const ZFMethod * | propertySetterForName (const zfchar *propertyName) const |
try to get property setter method | |
const ZFMethod * | propertyGetterForNameIgnoreParent (const zfchar *propertyName) const |
try to get property getter method within this class only | |
const ZFMethod * | propertyGetterForName (const zfchar *propertyName) const |
try to get property getter method | |
zfbool | propertyHasOverrideInitStep (void) const |
whether the property has ZFPROPERTY_ON_INIT_DECLARE | |
zfbool | propertyHasOverrideInitStep (const ZFProperty *property) const |
whether the property has ZFPROPERTY_ON_INIT_DECLARE | |
void | classTag (const zfchar *key, ZFObject *tag) const |
set a classTag for the class, internal use only | |
zfany | classTag (const zfchar *key) const |
see classTag | |
void | classTagGetAllKeyValue (ZFCoreArray< zfstring > &allKey, ZFCoreArray< zfauto > &allValue) const |
see classTag | |
void | classTagRemove (const zfchar *key) const |
remove tag, same as set tag to null | |
zfauto | classTagRemoveAndGet (const zfchar *key) const |
remove tag, return removed tag or null if not exist | |
void | classTagRemoveAll (void) const |
see classTag | |
Static Public Member Functions | |
static const ZFClass * | classForName (const zfchar *classNameOrFullName) |
get class info by name | |
static const ZFClass * | classForName (const zfchar *className, const zfchar *classNamespace) |
find class with explicit namespace, see classForName | |
get class info by name
typical usage:
void ZFClass::instanceObserverRemoveAll | ( | void | ) | const |
void ZFClass::classDataChangeAutoRemoveTagAdd | ( | const zfchar * | tag | ) | const |
auto remove classTagRemove when class meta data changed
class meta data would change if:
this method is useful if you cached some data by classTag according to class's method or property list, and want to update it again if meta data changed
see also ZFClassDataChangeObserver
|
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 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 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_ZFMethodGenericInvokerDefaultParamRef), | ||
ZFObject * | param2 = ((ZFObject *const &) _ZFP_ZFMethodGenericInvokerDefaultParamRef), | ||
ZFObject * | param3 = ((ZFObject *const &) _ZFP_ZFMethodGenericInvokerDefaultParamRef), | ||
ZFObject * | param4 = ((ZFObject *const &) _ZFP_ZFMethodGenericInvokerDefaultParamRef), | ||
ZFObject * | param5 = ((ZFObject *const &) _ZFP_ZFMethodGenericInvokerDefaultParamRef), | ||
ZFObject * | param6 = ((ZFObject *const &) _ZFP_ZFMethodGenericInvokerDefaultParamRef), | ||
ZFObject * | param7 = ((ZFObject *const &) _ZFP_ZFMethodGenericInvokerDefaultParamRef) ) 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
get the method at index, assert fail if out of bounds
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 zfchar * | methodName, |
const zfchar * | methodParamTypeId0, | ||
const zfchar * | methodParamTypeId1 = 0, | ||
const zfchar * | methodParamTypeId2 = 0, | ||
const zfchar * | methodParamTypeId3 = 0, | ||
const zfchar * | methodParamTypeId4 = 0, | ||
const zfchar * | methodParamTypeId5 = 0, | ||
const zfchar * | methodParamTypeId6 = 0, | ||
const zfchar * | methodParamTypeId7 = 0 ) 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 zfchar * | methodName, |
const zfchar * | methodParamTypeId0, | ||
const zfchar * | methodParamTypeId1 = 0, | ||
const zfchar * | methodParamTypeId2 = 0, | ||
const zfchar * | methodParamTypeId3 = 0, | ||
const zfchar * | methodParamTypeId4 = 0, | ||
const zfchar * | methodParamTypeId5 = 0, | ||
const zfchar * | methodParamTypeId6 = 0, | ||
const zfchar * | methodParamTypeId7 = 0 ) 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::propertyAt | ( | zfindex | index | ) | const |
get ZFProperty at index
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 zfchar * | 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 zfchar * | 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