ZFFramework
Loading...
Searching...
No Matches
ZFMethod.h File Reference

reflectable method definination for ZFFramework More...

Go to the source code of this file.

Classes

class  ZFMethod
 reflectable method for ZFObject More...

Macros

#define ZFTOKEN_ZFMethodAccessTypePublic
 string tokens
#define ZFTOKEN_ZFMethodAccessTypeProtected
 string tokens
#define ZFTOKEN_ZFMethodAccessTypePrivate
 string tokens
#define ZFTOKEN_ZFMethodTypeNormal
 string tokens
#define ZFTOKEN_ZFMethodTypeStatic
 string tokens
#define ZFTOKEN_ZFMethodTypeVirtual
 string tokens
#define ZFMP_IN(ParamType, paramName)
 macro to wrap param types for ZFMETHOD_INLINE_0 series
#define ZFMP_IN_OPT(ParamType, paramName, DefaultValue)
 see ZFMP_IN
#define ZFMP_OUT(ParamType, paramName)
 see ZFMP_IN
#define ZFMP_OUT_OPT(ParamType, paramName, DefaultValue)
 see ZFMP_IN
#define ZFMP_IN_OUT(ParamType, paramName)
 see ZFMP_IN
#define ZFMP_IN_OUT_OPT(ParamType, paramName, DefaultValue)
 see ZFMP_IN

Enumerations

enum  ZFMethodAccessType { ZFMethodAccessTypePublic , ZFMethodAccessTypeProtected , ZFMethodAccessTypePrivate }
 access type for ZFMethod More...
enum  ZFMethodType { ZFMethodTypeNormal , ZFMethodTypeStatic , ZFMethodTypeVirtual }
 the method type More...

Functions

void ZFMethodGetAllT (ZFCoreArray< const ZFMethod * > &ret)
 see ZFMethodGetAll
ZFCoreArray< const ZFMethod * > ZFMethodGetAll (void)
 get all method currently registered
const ZFMethodZFMethodForName (const zfstring &classNameOrNamespace, const zfstring &methodName)
 util method to find method
const ZFMethodZFMethodForName (const zfstring &classNameOrNamespace, 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)
 see ZFMethodForName
void ZFMethodForNameGetAllT (ZFCoreArray< const ZFMethod * > &ret, const zfstring &classNameOrNamespace, const zfstring &methodName)
 util method to find method, see ZFMethodForName
ZFCoreArray< const ZFMethod * > ZFMethodForNameGetAll (const zfstring &classNameOrNamespace, const zfstring &methodName)
 see ZFMethodForNameGetAllT
const ZFMethodZFMethodAlias (const ZFMethod *method, const zfstring &aliasName)
 create new ZFMethod and alias to existing method
void ZFMethodAliasRemove (const ZFMethod *aliasMethod)
 see ZFMethodAlias
ZFListener ZFMethodImplReplace (const ZFMethod *method, const ZFListener &impl)
 dynamically replace impl for method
void ZFMethodImplRestore (const ZFMethod *method, const ZFListener &impl)
 see ZFMethodImplReplace

Detailed Description

reflectable method definination for ZFFramework

Macro Definition Documentation

◆ ZFMP_IN

#define ZFMP_IN ( ParamType,
paramName )

macro to wrap param types for ZFMETHOD_INLINE_0 series

similar to ZF_IN for normal methods, here's a list of these macros used for ZFMETHOD_INLINE_0 series:

Enumeration Type Documentation

◆ ZFMethodAccessType

access type for ZFMethod

Enumerator
ZFMethodAccessTypePublic 

public

ZFMethodAccessTypeProtected 

protected

ZFMethodAccessTypePrivate 

private

◆ ZFMethodType

the method type

Enumerator
ZFMethodTypeNormal 

normal method

ZFMethodTypeStatic 

static method

ZFMethodTypeVirtual 

virtual method

Function Documentation

◆ ZFMethodGetAll()

ZFCoreArray< const ZFMethod * > ZFMethodGetAll ( void )
inline

get all method currently registered

note, this method may cause performance issue if you have many method registered, use with caution
use ZFClass::methodForName or ZFMethodFuncForName if necessary

◆ ZFMethodForName()

const ZFMethod * ZFMethodForName ( const zfstring & classNameOrNamespace,
const zfstring & methodName )
extern

util method to find method

method can be class member or function type method, return first registered one if more than one method found, use ZFMethodForNameGetAll to check if you have overloaded method, use ZFMethodFuncForName to explicitly find function type method

◆ ZFMethodAlias()

const ZFMethod * ZFMethodAlias ( const ZFMethod * method,
const zfstring & aliasName )
extern

create new ZFMethod and alias to existing method

ZFMETHOD_DECLARE_0(void, foo)
};
ZFMETHOD_DEFINE_0(MyClass, void, foo) {
ZFLogTrim() << "foo()";
}
ZFMethodAlias(ZFMethodAccess(MyClass, foo), "bar");
ZFLogTrim() << MyClass::ClassData()->methodForName("foo");
ZFLogTrim() << MyClass::ClassData()->methodForName("bar");
obj->invoke("foo");
obj->invoke("bar");
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define ZFLogTrim(...)
see ZFLog
Definition ZFLog.h:79
const ZFMethod * ZFMethodAlias(const ZFMethod *method, const zfstring &aliasName)
create new ZFMethod and alias to existing method
#define ZFMETHOD_DECLARE_0(ReturnType, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:693
#define ZFMethodAccess(OwnerClass, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:16
#define ZFMETHOD_DEFINE_0(OwnerClass, ReturnType, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:821
#define zfclass
same as class, shows that this class is a ZFObject type
Definition ZFObjectClassTypeFwd.h:38
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:126
#define ZFOBJECT_REGISTER(T_ZFObject,...)
register ZFObject to ZFClass map
Definition ZFObjectDeclare.h:209
base class of all objects
Definition ZFObjectCore.h:196
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:79
See also
ZFClassAlias

◆ ZFMethodImplReplace()

ZFListener ZFMethodImplReplace ( const ZFMethod * method,
const ZFListener & impl )
extern

dynamically replace impl for method

the zfargs of original method generic invoker would be passed to impl, the impl may (and may not) call original method by ZFArgs::callOrigMethod
it's possible to replace more than one time, and can be restored by ZFMethodImplRestore