ZFFramework
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Friends | List of all members
ZFObject Class Reference

base class of all objects More...

#include <ZFObjectCore.h>

Inheritance diagram for ZFObject:
ZFAnimationGroupChildData ZFAudio ZFAutoReleasePool ZFBase64 ZFCache ZFContainer ZFDI_WrapperBase ZFHttpResponse ZFIOBuffer ZFImpl_ZFLuaValue ZFKeyValueContainer ZFLogFormat ZFMethodInvokeData ZFMutex ZFObjectHolder ZFPropertyInvokeData ZFRegExp ZFSemaphore ZFStyleableObject ZFTaskMap ZFTcp ZFTestCase ZFThread ZFTime ZFTimeLineCurve ZFTimer ZFUIEvent ZFUIHint ZFUIKeyboardState ZFUIListAdapterBasicParam ZFUIOnScreenKeyboardState ZFUIPage ZFUIPageManager ZFUIScrollerDefault ZFUISysWindow ZFUIViewMeasureResult ZFUIWebJSBridge ZFUIWebJSBridgeRecvData ZFUIWebJSBridgeSendData ZFUdp ZFValueHolder

Public Types

enum  
 

Public Member Functions

virtual const ZFClassclassData (void)
 get instance's class info
 
zfindex objectRetainCount (void)
 return the object's retain count
 
ZFObjectHolderobjectHolder (void)
 return an object holder that hold this object without affecting retain count
 
virtual void objectInfoOfInstanceT (zfstring &ret)
 see objectInfoOfInstance
 
virtual zfstring objectInfoOfInstance (void)
 return a short string describe the object instance
 
virtual void objectInfoT (zfstring &ret)
 see objectInfo
 
virtual zfstring objectInfo (void)
 return object info
 
virtual zfidentity objectHash (void)
 get hash of this object
 
virtual ZFCompareResult objectCompare (ZFObject *anotherObj)
 compare with anotherObj
 
virtual zfbool equalTo (ZFObject *anotherObj)
 util to objectCompare
 
virtual zfauto invoke (const zfchar *methodName)
 util method to perform ZFDI_invoke, do nothing if fail
 
virtual zfauto invoke (const zfchar *methodName, 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))
 util method to perform ZFDI_invoke, do nothing if fail
 
virtual zfauto invokeDetail (const zfchar *methodName, const ZFCoreArray< zfauto > &params, zfbool *success=0, zfstring *errorHint=0)
 util method to perform ZFDI_invoke, do nothing if fail
 
zfbool objectTagExist (void)
 see objectTag, true if this object has tag, and tag can be checked by objectTagGetAllKeyValue
 
void objectTag (const zfchar *key, ZFObject *tag)
 used to hold a object for app's use, auto retained
 
zfany objectTag (const zfchar *key)
 see objectTag
 
void objectTagGetAllKeyValue (ZFCoreArray< zfstring > &allKey, ZFCoreArray< zfauto > &allValue)
 get all key value
 
void objectTagRemove (const zfchar *key)
 remove tag, same as set tag to null
 
zfauto objectTagRemoveAndGet (const zfchar *key)
 remove tag, return removed tag or null if not exist
 
void objectTagRemoveAll (void)
 remove all tag
 
void observerAdd (zfidentity eventId, const ZFListener &observer, ZFLevel observerLevel=ZFLevelAppNormal)
 see observerNotify
 
void observerAddForOnce (zfidentity eventId, const ZFListener &observer, ZFLevel observerLevel=ZFLevelAppNormal)
 see observerNotify
 
void observerRemove (zfidentity eventId, const ZFListener &callback)
 see observerNotify
 
void observerRemoveAll (zfidentity eventId)
 see observerNotify
 
void observerRemoveAll (void)
 see observerNotify
 
zfbool observerHasAdd (void)
 true if any observer has been added
 
zfbool observerHasAdd (zfidentity eventId)
 true if any observer with eventId has been added
 
void observerNotify (zfidentity eventId, ZFObject *param0=0, ZFObject *param1=0)
 notify the observer with eventId
 
void observerNotifyWithSender (ZFObject *customSender, zfidentity eventId, ZFObject *param0=0, ZFObject *param1=0)
 see observerNotify
 
ZFObserverobserverHolder (void)
 access the internal observer holder
 
ZFObjectInstanceState objectInstanceState (void)
 object instance's state
 
virtual zfbool objectIsInternal (void)
 whether this object is internal object or its class is ZFClass::classIsInternal
 
virtual zfbool objectIsInternalPrivate (void)
 whether this object is internal private object or its class is ZFClass::classIsInternalPrivate
 
ZFV zfv (void)
 see ZFV
 

Static Public Member Functions

static const ZFClassClassData (void)
 get class info
 
static zfidentity EventObjectBeforeAlloc (void)
 see ZFObject::observerNotify
 
static zfidentity EventObjectAfterAlloc (void)
 see ZFObject::observerNotify
 
static zfidentity EventObjectBeforeDealloc (void)
 see ZFObject::observerNotify
 
static zfidentity EventObjectPropertyValueOnUpdate (void)
 see ZFObject::observerNotify
 

Protected Types

typedef _ZFP_Obj_Base zfsuper
 class ref to super
 
typedef ZFObject zfself
 class ref to self
 

Protected Member Functions

virtual void objectInfoOnAppend (zfstring &ret)
 called by objectInfoT to append object info as a chain
 
virtual void observerOnAdd (zfidentity eventId)
 called when add first observer
 
virtual void observerOnRemove (zfidentity eventId)
 called when remove last observer
 
virtual void observerOnEvent (const ZFArgs &zfargs)
 notified when observerNotify
 
virtual void objectOnInit (void)
 override this to init your object
 
virtual void objectOnInitFinish (void)
 called after objectOnInit, safe to call virtual functions here
 
virtual void objectOnDeallocPrepare (void)
 called before objectOnDealloc, safe to call virtual functions here
 
virtual void objectOnDealloc (void)
 override this to destroy your object
 
virtual void objectOnRetain (void)
 called to retain object
 
virtual void objectOnRelease (void)
 called to release object
 
virtual void objectPropertyValueOnUpdate (const ZFProperty *property, const void *oldValue)
 see EventObjectPropertyValueOnUpdate
 

Friends

class ZFClass
 
class ZFObserver
 

Detailed Description

base class of all objects


ADVANCED:
we use macros everywhere to achieve goals, there are many types and functions and whatever-it-is, which are generated by macros and are private, you should never ever access it in your code
here's a list or them:

Member Function Documentation

◆ classData()

virtual const ZFClass * ZFObject::classData ( void )
inlinevirtual

get instance's class info

Reimplemented in ZFBase64, ZFCompressLevel, v_ZFCurve, ZFJsonType, v_ZFJsonOutputToken, v_ZFJson, ZFRegExpOption, v_ZFRegExpOptionFlags, v_ZFRegExpResult, ZFRegExp, v_ZFTextTemplateRunParam, ZFTextTemplateIndexFlag, v_ZFTextTemplateIndexData, v_ZFTextTemplateParam, ZFXmlType, v_ZFXml, v_ZFXmlOutputToken, ZFThreadMainThread, ZFArray, ZFAutoReleasePool, ZFContainer, v_ZFDynamic, ZFFileOpenOption, v_ZFFileOpenOptionFlags, v_ZFFileFindData, ZFHashMap, ZFHashSet, ZFIOBuffer, ZFIOBufferByCacheFile, ZFIOBufferByMemory, ZFKeyValueContainer, ZFLogFormat, ZFLogLevel, ZFMap, ZFMutex, v_ZFCallback, v_ZFListener, v_ZFIOCallback, v_ZFOutput, v_ZFInput, v_ZFClassInstanceObserverAddParam, v_ZFClass, ZFDI_WrapperBase, ZFDI_Wrapper, ZFDI_WrapperRaw, ZFEnum, ZFMethodInvokeData, v_ZFMethod, ZFObjectHolder, ZFPropertyInvokeData, v_ZFProperty, ZFStyleableObject, v_zfbool, v_zfbyte, v_zfchar, v_zfstring, v_cString, v_ZFPtr, v_ZFPtrConst, v_zfint, v_zfuint, v_zfindex, v_zffloat, v_zfdouble, v_zflongdouble, v_zftimet, v_zfflags, v_zfidentity, v_ZFCompareResult, v_ZFSeekPos, v_ZFIndexRange, v_ZFLevel, v_ZFFrameworkState, v_ZFFuncAddrType, v_zfiterator, v_ZFBuffer, v_ZFCallerInfo, v_ZFIdentityGenerator, v_ZFFilterType, v_ZFFilterCallbackResult, v_ZFFilterForNumber, v_ZFFilterForIndex, v_ZFFilterForIdentity, v_ZFFilterForString, v_ZFPathInfo, v_ZFTokenForContainer, v_ZFTokenForKeyValueContainer, v_ZFClassDataChangeType, v_ZFClassDataChangeData, v_ZFFilterForZFClassType, v_ZFMethodPrivilegeType, v_ZFMethodType, v_ZFMethodParamDefaultValueCallback, v_ZFArgs, v_ZFObserver, v_ZFFilterForZFClass, v_ZFFilterForZFMethod, v_ZFFilterForZFProperty, v_ZFFilterForZFObject, v_ZFMethodGenericInvoker, v_ZFMethodDynamicRegisterParam, v_ZFMP, v_ZFPropertyCallbackDynamicRegisterInitValueGetter, v_ZFPropertyDynamicRegisterParam, v_ZFComparer_ZFObject, v_ZFObjectInstanceState, v_ZFCallbackType, v_ZFSerializableData, v_ZFCoreArray, ZFTypeIdWrapper, ZFValueHolder, v_zfweak, v_ZFObserverGroupHolder, ZFOutputFormatStep, ZFOutputFormatBasic, ZFProtocolLevel, ZFProtocolInstanceState, v_ZFProtocol, v_ZFProtocolImplInfo, ZFResultType, ZFSemaphore, ZFSet, ZFStringEncoding, ZFStyleList, ZFTaskMap, ZFThread, v_ZFTimeValue, v_ZFTimeInfo, ZFTime, ZFTimer, ZFImpl_ZFLuaValue, ZFHttpMethod, ZFHttpResponse, ZFHttpRequest, ZFTcpType, ZFTcp, v_ZFUdpAddr, ZFUdp, ZFUIImageImplNinePatchPos, ZFAnimationNativeViewCurve, ZFAnimationNativeView, ZFAudio, ZFEnvDeviceUIType, ZFTimeLineCurveEaseIn, ZFTimeLineCurveEaseOut, ZFTimeLineCurveEaseInOut, ZFTimeLineCurveBounceIn, ZFTimeLineCurveBounceOut, ZFTimeLineCurveBounceInOut, ZFUIDrawableView, ZFUIEvent, ZFUIGlobalStyle, ZFUIImage, ZFUIImageView, ZFUIKeyboardState, ZFUIKeyAction, ZFUIKeyCode, ZFUIKeyEvent, ZFUIMouseAction, ZFUIMouseButton, ZFUIMouseEvent, ZFUINativeViewWrapper, ZFUIOnScreenKeyboardState, ZFUIRootView, ZFUIScrollerDefault, ZFUIScrollThumbDefault, ZFUIScrollViewState, ZFUIScrollView, ZFUISysWindow, ZFUITextEditKeyboardType, ZFUITextEditKeyboardReturnType, ZFUITextEditKeyboardReturnAction, ZFUITextEdit, ZFUITextView, v_ZFUIPoint, v_ZFUIMargin, v_ZFUISize, v_ZFUIRect, ZFUIAlign, v_ZFUIAlignFlags, ZFUIOrientation, v_ZFUIOrientationFlags, v_ZFUIColor, ZFUITextAppearance, ZFUITextTruncateMode, ZFUIContentScaleType, ZFUIView, v_ZFUIViewBlinkParam, v_ZFUIViewFocusNextParam, ZFUISizeType, v_ZFUISizeParam, ZFUILayoutParam, ZFUIViewChildLayer, ZFUIViewMeasureResult, ZFUITransform, v_ZFUITransformFlags, ZFUIWheelEvent, ZFUIWindowLevel, ZFUIWindow, ZFUIWebJSBridgeSendData, ZFUIWebJSBridgeRecvData, ZFUIWebJSBridge, ZFUIWebView, ZFUIAniImageData, ZFUIAniImageView, ZFUIAutoLayoutPos, v_ZFUIAutoLayoutRule, ZFUIAutoLayoutParam, ZFUIAutoLayout, ZFUIButtonState, ZFUIButton, ZFUIButtonBasic, ZFUIButtonCheckBox, ZFUIButtonGroupType, ZFUIButtonGroupArray, ZFUIButtonGroupBasic, ZFUIButtonRatio, ZFUIDialog, ZFUIFlowLayoutParam, ZFUIFlowLayout, ZFUIHint, ZFUIHintContentBasic, ZFUILinearLayoutParam, ZFUILinearLayout, ZFUIListAdapterArray, ZFUIListAdapterBasicParam, ZFUIListAdapterBasic, ZFUIListCell, v_ZFUIListCellUpdaterParam, ZFUIListCellUpdaterBasic, ZFUIListCellView, ZFUIListCellViewBasic, ZFUIListView, ZFUIOnScreenKeyboardAutoFitLayout, ZFUIPageResumeReason, ZFUIPagePauseReason, ZFUIPage, ZFUIPageManager, ZFUITextEditWidget, ZFUIViewLayout, ZFAniForCustomAni, ZFAniForGeneric, v_ZFAniBuilder, ZFAnimation, ZFAnimationGroupChildData, ZFAnimationGroup, ZFAnimationTimeLine, ZFCache, ZFResCache, ZFTestCase, ZFTimeLineCurve, and ZFTimeLineCurveLinear.

◆ EventObjectBeforeAlloc()

static zfidentity ZFObject::EventObjectBeforeAlloc ( void )
inlinestatic

see ZFObject::observerNotify

notified when object allocated (before objectOnInitFinish
this event is only designed for convenient and for debug use only, usually you should use ZFClass::instanceObserverAdd

◆ EventObjectAfterAlloc()

static zfidentity ZFObject::EventObjectAfterAlloc ( void )
inlinestatic

see ZFObject::observerNotify

notified when object allocated (after objectOnInitFinish
this event is only designed for convenient and for debug use only, usually you should use ZFClass::instanceObserverAdd

◆ EventObjectBeforeDealloc()

static zfidentity ZFObject::EventObjectBeforeDealloc ( void )
inlinestatic

see ZFObject::observerNotify

notified before object dealloc
note: the object's retain count should be 1 when this event is notified, it's safe to retain the object during this event, but it's your responsibility to ensure logic valid, after notified this event, all observer of this event would be removed, so that it's safe to release the object again to finally destroy the object

◆ EventObjectPropertyValueOnUpdate()

static zfidentity ZFObject::EventObjectPropertyValueOnUpdate ( void )
inlinestatic

see ZFObject::observerNotify

param0 is v_ZFProperty that value changes
param1 is v_ZFPtrConst holds the old property value (holds null when first time accessed)
the param1 holds these types:

  • for retain property, it points to (const zfauto *)
  • for assign property, it points to (const YourPropertyType *)

called when first time accessed, and each time setter is called

◆ objectRetainCount()

zfindex ZFObject::objectRetainCount ( void )

return the object's retain count

See also
zfRetain, zfRelease

◆ objectHolder()

ZFObjectHolder * ZFObject::objectHolder ( void )

return an object holder that hold this object without affecting retain count

the holder would be cached, you have no need to care about performance
when owner object destroyed, the holder object's content is ensured reset to null, it's safe to retain the holder for future use or check

◆ objectInfoOfInstance()

virtual zfstring ZFObject::objectInfoOfInstance ( void )
inlinevirtual

return a short string describe the object instance

may looks like this: ClassName(0x123456)

See also
objectInfo

◆ objectInfoT()

virtual void ZFObject::objectInfoT ( zfstring & ret)
virtual

see objectInfo

Reimplemented in v_ZFCurve, v_ZFJsonOutputToken, v_ZFJson, v_ZFRegExpResult, v_ZFTextTemplateRunParam, v_ZFTextTemplateIndexData, v_ZFTextTemplateParam, v_ZFXml, v_ZFXmlOutputToken, ZFContainer, v_ZFDynamic, v_ZFFileFindData, ZFKeyValueContainer, v_ZFCallback, v_ZFClassInstanceObserverAddParam, v_ZFClass, ZFDI_WrapperBase, ZFEnum, v_ZFMethod, v_ZFProperty, v_zfbool, v_zfbyte, v_zfchar, v_zfstring, v_ZFPtr, v_ZFPtrConst, v_zfint, v_zfuint, v_zfindex, v_zffloat, v_zfdouble, v_zflongdouble, v_zftimet, v_zfflags, v_zfidentity, v_ZFCompareResult, v_ZFSeekPos, v_ZFIndexRange, v_ZFLevel, v_ZFFrameworkState, v_ZFFuncAddrType, v_zfiterator, v_ZFBuffer, v_ZFCallerInfo, v_ZFIdentityGenerator, v_ZFFilterType, v_ZFFilterCallbackResult, v_ZFFilterForNumber, v_ZFFilterForIndex, v_ZFFilterForIdentity, v_ZFFilterForString, v_ZFPathInfo, v_ZFTokenForContainer, v_ZFTokenForKeyValueContainer, v_ZFClassDataChangeType, v_ZFClassDataChangeData, v_ZFFilterForZFClassType, v_ZFMethodPrivilegeType, v_ZFMethodType, v_ZFMethodParamDefaultValueCallback, v_ZFArgs, v_ZFObserver, v_ZFFilterForZFClass, v_ZFFilterForZFMethod, v_ZFFilterForZFProperty, v_ZFFilterForZFObject, v_ZFMethodGenericInvoker, v_ZFMethodDynamicRegisterParam, v_ZFMP, v_ZFPropertyCallbackDynamicRegisterInitValueGetter, v_ZFPropertyDynamicRegisterParam, v_ZFComparer_ZFObject, v_ZFObjectInstanceState, v_ZFCallbackType, v_ZFSerializableData, v_ZFCoreArray, v_zfweak, v_ZFObserverGroupHolder, v_ZFProtocol, v_ZFProtocolImplInfo, v_ZFTimeValue, v_ZFTimeInfo, ZFTcp, v_ZFUdpAddr, ZFUdp, v_ZFUIPoint, v_ZFUIMargin, v_ZFUISize, v_ZFUIRect, v_ZFUIColor, v_ZFUIViewBlinkParam, v_ZFUIViewFocusNextParam, v_ZFUISizeParam, v_ZFUIAutoLayoutRule, v_ZFUIListCellUpdaterParam, v_ZFAniBuilder, and ZFAnimationGroupChildData.

◆ objectInfoOnAppend()

virtual void ZFObject::objectInfoOnAppend ( zfstring & ret)
protectedvirtual

◆ objectHash()

virtual zfidentity ZFObject::objectHash ( void )
virtual

◆ objectCompare()

virtual ZFCompareResult ZFObject::objectCompare ( ZFObject * anotherObj)
virtual

compare with anotherObj

Returns
ZFCompareTheSame if this == anotherObj
ZFCompareUncomparable otherwise
Warning
if your override objectCompare, you must also override objectHash, and follow the rules described in objectHash

Reimplemented in v_ZFCurve, v_ZFJsonOutputToken, v_ZFJson, v_ZFRegExpResult, ZFRegExp, v_ZFTextTemplateRunParam, v_ZFTextTemplateIndexData, v_ZFTextTemplateParam, v_ZFXml, v_ZFXmlOutputToken, ZFContainer, v_ZFDynamic, v_ZFFileFindData, ZFKeyValueContainer, v_ZFCallback, v_ZFClassInstanceObserverAddParam, v_ZFClass, ZFDI_WrapperBase, ZFEnum, v_ZFMethod, ZFObjectHolder, v_ZFProperty, v_zfbool, v_zfbyte, v_zfchar, v_zfstring, v_ZFPtr, v_ZFPtrConst, v_zfint, v_zfuint, v_zfindex, v_zffloat, v_zfdouble, v_zflongdouble, v_zftimet, v_zfflags, v_zfidentity, v_ZFCompareResult, v_ZFSeekPos, v_ZFIndexRange, v_ZFLevel, v_ZFFrameworkState, v_ZFFuncAddrType, v_zfiterator, v_ZFBuffer, v_ZFCallerInfo, v_ZFIdentityGenerator, v_ZFFilterType, v_ZFFilterCallbackResult, v_ZFFilterForNumber, v_ZFFilterForIndex, v_ZFFilterForIdentity, v_ZFFilterForString, v_ZFPathInfo, v_ZFTokenForContainer, v_ZFTokenForKeyValueContainer, v_ZFClassDataChangeType, v_ZFClassDataChangeData, v_ZFFilterForZFClassType, v_ZFMethodPrivilegeType, v_ZFMethodType, v_ZFMethodParamDefaultValueCallback, v_ZFArgs, v_ZFObserver, v_ZFFilterForZFClass, v_ZFFilterForZFMethod, v_ZFFilterForZFProperty, v_ZFFilterForZFObject, v_ZFMethodGenericInvoker, v_ZFMethodDynamicRegisterParam, v_ZFMP, v_ZFPropertyCallbackDynamicRegisterInitValueGetter, v_ZFPropertyDynamicRegisterParam, v_ZFComparer_ZFObject, v_ZFObjectInstanceState, v_ZFCallbackType, v_ZFSerializableData, v_ZFCoreArray, ZFValueHolder, v_zfweak, v_ZFObserverGroupHolder, v_ZFProtocol, v_ZFProtocolImplInfo, v_ZFTimeValue, v_ZFTimeInfo, ZFTime, v_ZFUdpAddr, ZFAnimationNativeView, ZFUIImage, v_ZFUIPoint, v_ZFUIMargin, v_ZFUISize, v_ZFUIRect, v_ZFUIColor, ZFUIView, v_ZFUIViewBlinkParam, v_ZFUIViewFocusNextParam, v_ZFUISizeParam, ZFUILayoutParam, ZFUIAniImageData, v_ZFUIAutoLayoutRule, ZFUIAutoLayoutParam, v_ZFUIListCellUpdaterParam, v_ZFAniBuilder, ZFAnimationGroupChildData, ZFAnimationGroup, and ZFAnimationTimeLine.

◆ objectTag()

void ZFObject::objectTag ( const zfchar * key,
ZFObject * tag )

used to hold a object for app's use, auto retained

replace if existing, remove if tag is null

◆ objectTagRemoveAll()

void ZFObject::objectTagRemoveAll ( void )

remove all tag

Note
it's unsafe to remove all tag manually, which may break unrelated modules' additional logic, remove only if necessary
typically, you should remove exactly the one you have added
this method would be called during EventObjectBeforeDealloc and objectOnDeallocPrepare

◆ observerRemoveAll() [1/2]

void ZFObject::observerRemoveAll ( zfidentity eventId)

see observerNotify

Note
it's unsafe to remove all observer manually, which may break unrelated modules' observer logic, remove only if necessary
typically, you should remove exactly the one you have added

◆ observerRemoveAll() [2/2]

void ZFObject::observerRemoveAll ( void )

see observerNotify

Note
it's unsafe to remove all observer manually, which may break unrelated modules' observer logic, remove only if necessary
typically, you should remove exactly the one you have added

◆ observerNotify()

void ZFObject::observerNotify ( zfidentity eventId,
ZFObject * param0 = 0,
ZFObject * param1 = 0 )

notify the observer with eventId

the ZFListener would be executed
it's ensured the first added observer would be executed first
use ZFGlobalObserver for global observer
for instance observer:

zfclass YourClass {
// declare your event here,
// which would generate a method:
// static const zfchar *EventYourEvent(void)
ZFEVENT(YourEvent)
};
// notify using declared event
yourClass->observerNotify(YourClass::EventYourEvent(), params...);
#define ZFEVENT(YourEvent)
see ZFObject::observerNotify
Definition ZFObjectObserver.h:260
Note
observers would be compared by ZFCallback::objectCompareByInstance when add or remove


to pass extra params to the callback, see ZFLISTENER for more info

◆ observerHolder()

ZFObserver & ZFObject::observerHolder ( void )

access the internal observer holder

usually for internal use only
calling owner object's observerAdd series is ensured same with calling the observerHolder's proper method

◆ observerOnAdd()

virtual void ZFObject::observerOnAdd ( zfidentity eventId)
protectedvirtual

called when add first observer

Reimplemented in ZFUIView, and ZFUIAniImageView.

◆ observerOnRemove()

virtual void ZFObject::observerOnRemove ( zfidentity eventId)
protectedvirtual

called when remove last observer

Reimplemented in ZFUIView, and ZFUIAniImageView.

◆ observerOnEvent()

virtual void ZFObject::observerOnEvent ( const ZFArgs & zfargs)
inlineprotectedvirtual

notified when observerNotify

ensured called before any other registered observer

◆ objectOnInit()

virtual void ZFObject::objectOnInit ( void )
protectedvirtual

override this to init your object

subclass must call superclass's objectOnInit before any other code if override
you may also declare objectOnInit with params like this:

zfclass Parent : ... {
...
protected:
virtual void objectOnInit(void) {...};
};
zfclass Child : Parent {
protected:
// override all parent's objectOnInit is also required,
// because of function hiding of C++
virtual void objectOnInit(void) {
zfsuper::objectOnInit();
}
// custom init entry
virtual void objectOnInit(Params...) {
this->objectOnInit();
// your extra init steps
...
}
};
virtual void objectOnInit(void)
override this to init your object
Warning
objectOnInit and objectOnDealloc is called as a virtual function, take good care of other virtual function call, use zfself::func() instead of this->func() if necessary, or use objectOnInitFinish/objectOnDeallocPrepare, or declare your own constructor with ZFOBJECT_DECLARE_WITH_CUSTOM_CTOR
Note
(ZFTAG_LIMITATION) due to limitations of C++, if your parent type declared objectOnInit with different params, and your child type want to override part of those objectOnInit, then your child type must also override all objectOnInit that parent declared, otherwise, some may be hidden
for objects that designed not to be allocated by user, you should use ZFOBJECT_PRIVATE_ALLOC, typically usage:
ZFOBJECT_PRIVATE_ALLOC("should be created by MyObject::instanceForXxx only")
public:
static zfauto instanceForXxx(xxx) {
// can only be allocated by reflection
}
};
static void func(void) {
// MyObject *obj = zfAlloc(MyObject); // would compile error
zfauto obj = MyObject::instanceForXxx(xxx); // OK
}
#define ZFOBJECT_PRIVATE_ALLOC(...)
mark this object can not be allocated directly
Definition ZFObjectDeclare.h:240
zfauto newInstance(void) const
make a new instance of ZFObject dynamically, which is described by ZFClass
static const ZFClass * ClassData(void)
get class info
Definition ZFObjectCore.h:211
a ZFObject holder which would release content object automatically when destroyed
Definition zfautoFwd.h:34

Reimplemented in v_ZFCurve, v_ZFJsonOutputToken, v_ZFJson, v_ZFRegExpResult, ZFRegExp, v_ZFTextTemplateRunParam, v_ZFTextTemplateIndexData, v_ZFTextTemplateParam, v_ZFXml, v_ZFXmlOutputToken, ZFArray, ZFAutoReleasePool, v_ZFDynamic, v_ZFFileFindData, ZFHashMap, ZFHashSet, ZFIOBufferByCacheFile, ZFIOBufferByMemory, ZFMap, v_ZFCallback, v_ZFClassInstanceObserverAddParam, v_ZFClass, ZFDI_WrapperBase, ZFEnum, v_ZFMethod, ZFObjectHolder, v_ZFProperty, v_zfbool, v_zfbyte, v_zfchar, v_zfstring, v_ZFPtr, v_ZFPtrConst, v_zfint, v_zfuint, v_zfindex, v_zffloat, v_zfdouble, v_zflongdouble, v_zftimet, v_zfflags, v_zfidentity, v_ZFCompareResult, v_ZFSeekPos, v_ZFIndexRange, v_ZFLevel, v_ZFFrameworkState, v_ZFFuncAddrType, v_zfiterator, v_ZFBuffer, v_ZFCallerInfo, v_ZFIdentityGenerator, v_ZFFilterType, v_ZFFilterCallbackResult, v_ZFFilterForNumber, v_ZFFilterForIndex, v_ZFFilterForIdentity, v_ZFFilterForString, v_ZFPathInfo, v_ZFTokenForContainer, v_ZFTokenForKeyValueContainer, v_ZFClassDataChangeType, v_ZFClassDataChangeData, v_ZFFilterForZFClassType, v_ZFMethodPrivilegeType, v_ZFMethodType, v_ZFMethodParamDefaultValueCallback, v_ZFArgs, v_ZFObserver, v_ZFFilterForZFClass, v_ZFFilterForZFMethod, v_ZFFilterForZFProperty, v_ZFFilterForZFObject, v_ZFMethodGenericInvoker, v_ZFMethodDynamicRegisterParam, v_ZFMP, v_ZFPropertyCallbackDynamicRegisterInitValueGetter, v_ZFPropertyDynamicRegisterParam, v_ZFComparer_ZFObject, v_ZFObjectInstanceState, v_ZFCallbackType, v_ZFSerializableData, v_ZFCoreArray, ZFValueHolder, v_zfweak, v_ZFObserverGroupHolder, ZFOutputFormatBasic, v_ZFProtocol, v_ZFProtocolImplInfo, ZFSemaphore, ZFSet, ZFStyleList, ZFTaskMap, ZFThread, v_ZFTimeValue, v_ZFTimeInfo, ZFTime, ZFTimer, ZFImpl_ZFLuaValue, ZFHttpResponse, ZFHttpRequest, ZFTcp, v_ZFUdpAddr, ZFUdp, ZFAnimationNativeView, ZFAudio, ZFUIDrawableView, ZFUIImage, ZFUIImageView, ZFUINativeViewWrapper, ZFUIScrollerDefault, ZFUIScrollThumbDefault, ZFUIScrollView, ZFUISysWindow, ZFUITextEdit, ZFUITextView, v_ZFUIPoint, v_ZFUIMargin, v_ZFUISize, v_ZFUIRect, v_ZFUIColor, ZFUIView, v_ZFUIViewBlinkParam, v_ZFUIViewFocusNextParam, v_ZFUISizeParam, ZFUIWindow, ZFUIWebJSBridge, ZFUIWebView, ZFUIAniImageData, ZFUIAniImageView, v_ZFUIAutoLayoutRule, ZFUIAutoLayout, ZFUIButton, ZFUIButtonBasic, ZFUIDialog, ZFUIHint, ZFUIListAdapterArray, v_ZFUIListCellUpdaterParam, ZFUIListCellViewBasic, ZFUIListView, ZFUIOnScreenKeyboardAutoFitLayout, ZFUIPageManager, ZFUITextEditWidget, ZFAniForCustomAni, ZFAniForGeneric, v_ZFAniBuilder, ZFAnimation, ZFAnimationGroup, ZFAnimationTimeLine, and ZFCache.

◆ objectOnInitFinish()

virtual void ZFObject::objectOnInitFinish ( void )
inlineprotectedvirtual

called after objectOnInit, safe to call virtual functions here

usually used to initialize independent resources other than self's internal resources

Reimplemented in ZFUIImage, ZFUIScrollThumbDefault, ZFUISysWindow, ZFUITextEdit, ZFUITextView, ZFUIButton, ZFUIHint, ZFUIListCellView, and ZFUIOnScreenKeyboardAutoFitLayout.

◆ objectOnDeallocPrepare()

virtual void ZFObject::objectOnDeallocPrepare ( void )
inlineprotectedvirtual

called before objectOnDealloc, safe to call virtual functions here

usually used to cleanup resources attached to this object other than self's internal resources

Reimplemented in ZFAutoReleasePool, ZFContainer, ZFKeyValueContainer, ZFValueHolder, ZFThread, ZFTimer, ZFImpl_ZFLuaValue, ZFTcp, ZFUIImage, ZFUIScrollThumbDefault, ZFUIScrollView, ZFUISysWindow, ZFUIView, ZFUIWebView, ZFUIListAdapterArray, ZFUIListView, ZFAnimation, ZFAnimationGroup, ZFCache, and ZFTestCase.

◆ objectOnDealloc()

virtual void ZFObject::objectOnDealloc ( void )
protectedvirtual

◆ objectOnRetain()

virtual void ZFObject::objectOnRetain ( void )
protectedvirtual

called to retain object

subclass must call superclass's objectOnRetain before any other code if override
usually you should not override this method

◆ objectOnRelease()

virtual void ZFObject::objectOnRelease ( void )
protectedvirtual

called to release object

subclass must call superclass's onRelase after any other code if override
usually you should not override this method

◆ objectIsInternal()

virtual zfbool ZFObject::objectIsInternal ( void )
virtual

whether this object is internal object or its class is ZFClass::classIsInternal

if objectIsInternalPrivate, then it is also objectIsInternal

Reimplemented in ZFDI_WrapperBase, ZFEnum, ZFMethodInvokeData, ZFObjectHolder, ZFTypeIdWrapper, and ZFImpl_ZFLuaValue.

◆ objectIsInternalPrivate()

virtual zfbool ZFObject::objectIsInternalPrivate ( void )
virtual

whether this object is internal private object or its class is ZFClass::classIsInternalPrivate

if objectIsInternalPrivate, then it is also objectIsInternal

Reimplemented in ZFDI_WrapperBase, ZFEnum, ZFMethodInvokeData, ZFObjectHolder, and ZFImpl_ZFLuaValue.

◆ objectPropertyValueOnUpdate()

virtual void ZFObject::objectPropertyValueOnUpdate ( const ZFProperty * property,
const void * oldValue )
protectedvirtual

The documentation for this class was generated from the following file: