macro utils More...
#include "ZFCoreTypeDef.h"
Go to the source code of this file.
Macros | |
#define | ZFBitTest(var, bit) |
macro to detect whether bit is set, zftrue if any one of test bit has set | |
#define | ZFBitTestAll(var, bit) |
macro to detect whether bit is set, zftrue only if all the bits in bit is set | |
#define | ZFBitGet(var, bit) |
macro to get the value at bit | |
#define | ZFBitSet(var, bit) |
macro to set at bit | |
#define | ZFBitUnset(var, bit) |
clear at bit | |
#define | ZF_HINT(...) |
dummy macro to show a hint | |
#define | ZFM_REPEAT(N, Type, LeftCommaFix, CenterCommaFix) |
macro to repeat something | |
#define | ZFM_REPEAT_TEMPLATE(N) |
usually used by ZFM_REPEAT | |
#define | ZFM_REPEAT_TYPE(N) |
usually used by ZFM_REPEAT | |
#define | ZFM_REPEAT_TYPE_CONST(N) |
usually used by ZFM_REPEAT | |
#define | ZFM_REPEAT_NAME(N) |
usually used by ZFM_REPEAT | |
#define | ZFM_REPEAT_PARAM(N) |
usually used by ZFM_REPEAT | |
#define | ZFM_BRACKET_L() |
macro to ( | |
#define | ZFM_BRACKET_R() |
macro to ) | |
#define | ZFM_EMPTY(...) |
macro to s space | |
#define | ZFM_COMMA() |
macro to a comma | |
#define | ZFM_EXPAND(...) |
macro to expand a macro | |
#define | ZFM_CAT(a, b) |
expand a and b, then concatenate to ab | |
#define | ZFM_TOSTRING(a) |
convert macro to string | |
#define | ZFM_N_INC(n) |
increase n by macro expand | |
#define | ZFM_N_DEC(n) |
decrease n by macro expand | |
#define | ZFM_PARAM_NUM(...) |
get the param num of a certain sequence | |
#define | ZFM_FIX_PARAM(ParamFix, commaFix, ...) |
fix each param in the VA_ARGS | |
#define | ZFM_VA_APPEND(ToExpand, ToAppend, ...) |
util to appending item after VA_ARGS | |
#define | zfidentityHash(hash, ...) |
util method to connect multiple hash value into one hash value | |
#define | ZFUNUSED(v) |
explicit declare v is not used | |
#define | ZFM_ARRAY_SIZE(array) |
calculate the size of an array | |
#define | ZFUniqueName(name) |
declare a unique name | |
#define | ZFM_CLASS_HAS_MEMBER_DECLARE(NameSpace, memberName, memberSig) |
util macro to check whether class has desired member function, for advanced use only | |
#define | ZFM_CLASS_HAS_MEMBER(NameSpace, memberName, ClassToCheck) |
see ZFM_CLASS_HAS_MEMBER_DECLARE | |
#define | ZFCORE_PARAM_DECLARE_SELF(T_self) |
see ZFCORE_PARAM | |
#define | ZFCORE_PARAM(T_ParamType, paramName, ...) |
a util macro to generate setter and getter for POD like object | |
macro utils
#define ZF_HINT | ( | ... | ) |
dummy macro to show a hint
used to make some code more human readable, no actual use
for example, add to function call's param list to make params more readable:
#define ZFM_REPEAT | ( | N, | |
Type, | |||
LeftCommaFix, | |||
CenterCommaFix ) |
macro to repeat something
for example
ZFM_REPEAT(2, ZFM_REPEAT_TEMPLATE, ZFM_EMPTY, ZFM_COMMA)
would be expand as:
typename Type0, typename Type1
and ZFM_REPEAT(3, ZFM_REPEAT_PARAM, ZFM_COMMA, ZFM_COMMA)
would be expand as:
, Type0 param0, Type1 param1, Type2 param2
#define ZFM_PARAM_NUM | ( | ... | ) |
get the param num of a certain sequence
usage:
this macro could calculate 1 ~ 32 param num
#define ZFM_FIX_PARAM | ( | ParamFix, | |
commaFix, | |||
... ) |
fix each param in the VA_ARGS
usage:
#define ZFUniqueName | ( | name | ) |
declare a unique name
typical usage:
this is usually used to declare a tmp variable, such as:
REMARKS:
when used under Windows with embeded macros
a C2065 "__LINE__Var undeclared identifier" may (or may not) occurred
this is a compiler bug
to solve it, turn "Program Database for edit and continue (/ZI)" to "Program Database (/Zi)" in your project setting
or, prevent use it within other macros
#define ZFM_CLASS_HAS_MEMBER_DECLARE | ( | NameSpace, | |
memberName, | |||
memberSig ) |
util macro to check whether class has desired member function, for advanced use only
usage:
limitations:
#define ZFCORE_PARAM | ( | T_ParamType, | |
paramName, | |||
... ) |
a util macro to generate setter and getter for POD like object
usage:
once declared, you can access your param by the generated getter and setter