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

meta data for ZFObject More...

#include "zfautoFwd.h"
#include "ZFObjectObserver.h"

Go to the source code of this file.

Classes

class  ZFClassInstanceObserverAddParam
 see ZFClass::instanceObserverAdd More...
 
class  ZFClass
 ZFObject's class info. More...
 

Namespaces

namespace  ZFGlobalEvent
 

 

Macros

#define ZFObjectTagKeyword_newInstanceGenericFailed
 used to mark object allocation failed for ZFClass::newInstanceGenericCheck
 
#define ZFClassDataUpdateObserver()
 see ZFGlobalEvent::E_ClassDataUpdate
 
#define ZFCoreCriticalClassNotTypeOf(cls, desired)
 log that likes "[file function (line)] class xxx not type of xxx"
 
#define ZFCoreCriticalClassNotTypeOfDetail(callerInfo, cls, desired)
 see ZFCoreCriticalClassNotTypeOf
 
#define ZFCONV_REG(dstCls, srcCls)
 see zfconv
 

Typedefs

typedef zfbool(* zfconvImpl) (zfauto &ret, ZFObject *obj)
 see zfconv
 

Functions

void ZFClassGetAllT (ZFCoreArray< const ZFClass * > &ret)
 see ZFClassGetAll
 
ZFCoreArray< const ZFClass * > ZFClassGetAll (void)
 get all class currently registered, for debug use only
 
zfidentity ZFGlobalEvent::E_ClassDataUpdate (void)
 see ZFObject::observerNotify
 
void ZFClassAlias (const ZFClass *cls, const zfstring &aliasNameFull)
 alias class to a new name
 
void ZFClassAliasRemove (const ZFClass *cls, const zfstring &aliasNameFull)
 see ZFClassAlias
 
zfauto zfconv (const zfstring &cls, ZFObject *obj)
 object conversion
 
zfauto zfconv (const ZFClass *cls, ZFObject *obj)
 see zfconv
 
zfbool zfconvT (zfauto &ret, const zfstring &cls, ZFObject *obj)
 see zfconv
 
zfbool zfconvT (zfauto &ret, const ZFClass *cls, ZFObject *obj)
 see zfconv
 

Detailed Description

meta data for ZFObject

Macro Definition Documentation

◆ ZFObjectTagKeyword_newInstanceGenericFailed

#define ZFObjectTagKeyword_newInstanceGenericFailed

used to mark object allocation failed for ZFClass::newInstanceGenericCheck

when object created by ZFClass::newInstanceGenericBegin, it's possible to have mismatch param for generic invoke of objectOnInit, you may set an error message to the allocated object by ZFObject::objectTag with this as key and the error message (v_zfstring) as value, to tell ZFClass::newInstanceGenericCheck that the allocation failed

◆ ZFClassDataUpdateObserver

#define ZFClassDataUpdateObserver ( )

see ZFGlobalEvent::E_ClassDataUpdate

Warning
app code can add observer to this event, but must not manually notify this event
also, take care of performance

Function Documentation

◆ ZFClassAlias()

void ZFClassAlias ( const ZFClass * cls,
const zfstring & aliasNameFull )
extern

alias class to a new name

class alias only affects reflection, typically used for script binding
you can alias more than one name to same class, all of the aliased class points to same original ZFClass

// the aliased class is exactly same of the original,
// so the reflected class name still prints "ZFObject"
void ZFClassAlias(const ZFClass *cls, const zfstring &aliasNameFull)
alias class to a new name
#define ZFLogTrim(...)
see ZFLog
Definition ZFLog.h:80
static const ZFClass * classForName(const zfstring &classNameOrFullName)
get class info by name
const zfstring & className(void) const
class name, e.g. "ZFObject"
Definition ZFClass.h:180
static const ZFClass * ClassData(void)
get class info
Definition ZFObjectCore.h:211
See also
ZFMethodAlias

◆ zfconv()

zfauto zfconv ( const zfstring & cls,
ZFObject * obj )
extern

object conversion

some objects can be cast implicitly, zfstring to const void * for example, this method was designed for this, usage:

// register once
ret = zfobj<v_zfptr>(obj->zfv.cString());
// usually, the result object should retain the obj,
// to prevent unsafe pointer reference
ret->objectTag("zfconv", obj);
return zftrue;
}
// use
// note, when convert failed, the original object would be returned
zfauto converted = zfconv("void", zfobj<v_zfstring>());
// or use with explicit check
zfauto ret;
if(zfconvT(ret, "void", zfobj<v_zfstring>())) {
// conversion was success
}
zfauto zfconv(const zfstring &cls, ZFObject *obj)
object conversion
#define ZFCONV_REG(dstCls, srcCls)
see zfconv
Definition ZFClass.h:940
zfbool zfconvT(zfauto &ret, const zfstring &cls, ZFObject *obj)
see zfconv
#define zftrue
bool true type
Definition ZFCoreTypeDef_CoreType.h:107
type wrapper for ZFTypeId::Value
Definition ZFTypeId_spec.h:82
type wrapper for ZFTypeId::Value
Definition ZFTypeId_CoreType.h:198
a ZFObject holder which would release content object automatically when destroyed
Definition zfautoFwd.h:34
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:157