ZFFramework
Loading...
Searching...
No Matches
Classes | Macros | Enumerations
ZFCallback.h File Reference

header for ZFCallback More...

#include "ZFMethod.h"
#include "ZFObjectCast.h"
#include "zfany.h"
#include "zfautoFwd.h"
#include "ZFPathInfo.h"

Go to the source code of this file.

Classes

class  ZFCallback
 callback used by ZFFramework More...
 

Macros

#define ZFTOKEN_ZFCallbackTypeDummy
 string tokens
 
#define ZFTOKEN_ZFCallbackTypeMethod
 string tokens
 
#define ZFTOKEN_ZFCallbackTypeMemberMethod
 string tokens
 
#define ZFTOKEN_ZFCallbackTypeRawFunction
 string tokens
 
#define ZFTOKEN_ZFCallbackTypeLambda
 string tokens
 
#define ZFCallbackSerializeCustomTypeDisable
 explicit disable callback serialization
 
#define ZFCallbackForMethod(zfmethod)
 create a callback from ZFMethod
 
#define ZFCallbackForMemberMethod(obj, zfmethod)
 create a callback from ZFMethod of an object
 
#define ZFCallbackForFunc(callbackRawFunction)
 create a callback from static function
 
#define ZFCALLBACK_DECLARE_END(ZFLIB_, CallbackTypeName, ParentType)
 see ZFCALLBACK_DECLARE_BEGIN
 
#define ZFCALLBACK_DECLARE_BEGIN(ZFLIB_, CallbackTypeName, ParentType)
 util macro to declare a child type of ZFCallback
 
#define ZFCALLBACK_DECLARE(ZFLIB_, CallbackTypeName, ParentType)
 see ZFCALLBACK_DECLARE_BEGIN
 
#define ZFCALLBACK_DEFINE(CallbackTypeName, ParentType)
 see ZFCALLBACK_DECLARE_BEGIN
 

Enumerations

enum  ZFCallbackType {
  ZFCallbackTypeDummy , ZFCallbackTypeMethod , ZFCallbackTypeMemberMethod , ZFCallbackTypeRawFunction ,
  ZFCallbackTypeLambda
}
 callback type of ZFCallback More...
 

Detailed Description

header for ZFCallback

Macro Definition Documentation

◆ ZFCallbackSerializeCustomTypeDisable

#define ZFCallbackSerializeCustomTypeDisable

explicit disable callback serialization

manually set to ZFCallback::callbackSerializeCustomType before create the callback
serializing would cause additional data storage and processing, explicitly disable serialization may improve performance for some case

◆ ZFCallbackForMethod

#define ZFCallbackForMethod ( zfmethod)

create a callback from ZFMethod

assert fail if method not valid
method can be local method or class static member method

◆ ZFCallbackForMemberMethod

#define ZFCallbackForMemberMethod ( obj,
zfmethod )

create a callback from ZFMethod of an object

assert fail if method not valid or obj has no such method
obj won't be retained unless ZFCallback::callbackOwnerObjectRetain is called, so you must make sure the obj is alive during callback's invocation

◆ ZFCallbackForFunc

#define ZFCallbackForFunc ( callbackRawFunction)

create a callback from static function

assert fail if function address not valid

◆ ZFCALLBACK_DECLARE_BEGIN

#define ZFCALLBACK_DECLARE_BEGIN ( ZFLIB_,
CallbackTypeName,
ParentType )

util macro to declare a child type of ZFCallback

declaration:

// in header file
// declare by default:
ZFCALLBACK_DECLARE(ZFLIB_APP, CallbackTypeName, ParentType)
// if you need extra functions
ZFCALLBACK_DECLARE_BEGIN(ZFLIB_APP, CallbackTypeName, ParentType)
// your extra functions here
// it's not allowed to add member variables
ZFCALLBACK_DECLARE_END(ZFLIB_APP, CallbackTypeName, ParentType)
// in source file
ZFCALLBACK_DEFINE(CallbackTypeName, ParentType)
#define ZFCALLBACK_DEFINE(CallbackTypeName, ParentType)
see ZFCALLBACK_DECLARE_BEGIN
Definition ZFCallback.h:456
#define ZFCALLBACK_DECLARE_END(ZFLIB_, CallbackTypeName, ParentType)
see ZFCALLBACK_DECLARE_BEGIN
Definition ZFCallback.h:419
#define ZFCALLBACK_DECLARE_BEGIN(ZFLIB_, CallbackTypeName, ParentType)
util macro to declare a child type of ZFCallback
Definition ZFCallback.h:444
#define ZFCALLBACK_DECLARE(ZFLIB_, CallbackTypeName, ParentType)
see ZFCALLBACK_DECLARE_BEGIN
Definition ZFCallback.h:449
#define ZFLIB_APP
used to export symbols
Definition ZFCoreEnvDef.h:35

Enumeration Type Documentation

◆ ZFCallbackType

callback type of ZFCallback

Enumerator
ZFCallbackTypeDummy 

dummy that must not be executed

ZFCallbackTypeMethod 

class static member method described by ZFMethod

ZFCallbackTypeMemberMethod 

class memeber method that need a object instance to execute, described by ZFMethod

ZFCallbackTypeRawFunction 

static function without ZFMethod

ZFCallbackTypeLambda 

lambda function that can capture other vars