ZFFramework
|
id to string map util, useful to define extendable string enum More...
#include "../ZFCoreDef.h"
Go to the source code of this file.
Macros | |
#define | ZFIDMAP(YourIdName) |
declare an id within ZFObject class scope | |
#define | ZFIDMAP_DETAIL(prefix, YourIdName) |
see ZFIDMAP | |
#define | ZFIDMAP_INLINE(YourIdName) |
auto register version of ZFIDMAP | |
#define | ZFIDMAP_DETAIL_INLINE(prefix, YourIdName) |
see ZFIDMAP_INLINE | |
#define | ZFIDMAP_GLOBAL(YourIdName) |
declare an id in global scope, see ZFIDMAP | |
#define | ZFIDMAP_GLOBAL_DETAIL(prefix, YourIdName) |
see ZFIDMAP_GLOBAL | |
#define | ZFIDMAP_REGISTER(Scope, YourIdName) |
see ZFIDMAP | |
#define | ZFIDMAP_REGISTER_DETAIL(Scope, prefix, YourIdName) |
see ZFIDMAP | |
#define | ZFIDMAP_GLOBAL_REGISTER(YourIdName) |
see ZFIDMAP | |
#define | ZFIDMAP_GLOBAL_REGISTER_DETAIL(prefix, YourIdName) |
see ZFIDMAP | |
Functions | |
const zfchar * | ZFIdMapNameForId (zfidentity idValue) |
get id name from id value, or null if no such id, see ZFIdMapIdForName | |
zfidentity | ZFIdMapIdForName (const zfchar *idName) |
get id value from id name, or zfidentityInvalid if no such id name, see ZFIDMAP | |
void | ZFIdMapGetAll (ZFCoreArray< zfidentity > &idValues, ZFCoreArray< zfstring > &idNames) |
see ZFIDMAP | |
zfidentity | ZFIdMapDynamicRegister (const zfchar *idName) |
dynamically register your own id | |
void | ZFIdMapDynamicUnregister (zfidentity idValue) |
unregister id that was registered by ZFIdMapDynamicRegister | |
id to string map util, useful to define extendable string enum
#define ZFIDMAP | ( | YourIdName | ) |
declare an id within ZFObject class scope
usage:
declared id can be accessed by:
note that subclass may declare an id same as parent, while the final id name is different:
ParentClass::IdYourSth() => "ParentClass.IdYourSth"
ChildClass::IdYourSth() => "ChildClass.IdYourSth"
#define ZFIDMAP_INLINE | ( | YourIdName | ) |
auto register version of ZFIDMAP
note: this would create a dummy class to perform register, which would increase your owner object's size
#define ZFIDMAP_GLOBAL | ( | YourIdName | ) |
declare an id in global scope, see ZFIDMAP
usage:
unlike ZFIDMAP, this macro would declare id outside of class scope
|
extern |
get id value from id name, or zfidentityInvalid if no such id name, see ZFIDMAP
the id name should looks like YourClass.YourIdName
or YourNamespace.YourIdName
note: can be found only if:
|
extern |
see ZFIDMAP
get all registered id data, for debug use only
|
extern |
dynamically register your own id
assert fail if already registered
|
extern |
unregister id that was registered by ZFIdMapDynamicRegister
do nothing if no such id, assert fail if the id is not dynamically registered