[+] Added kNAMEValues array
[*] , at the end of an iterator list is valid, let's use it
This commit is contained in:
parent
157e40398c
commit
96200ed327
@ -59,10 +59,10 @@ using AuConsumer = std::function<void(T...)>;
|
||||
#define AUE_EMIT_ARRAY(val) val,
|
||||
|
||||
/// @hideinitializer
|
||||
#define AUE_EMIT_A(val) #val
|
||||
#define AUE_EMIT_A(val) #val,
|
||||
|
||||
/// @hideinitializer
|
||||
#define AUE_EMIT_B(val) , #val
|
||||
/// @hideinitializer
|
||||
#define AUE_EMIT_D(name, val) name::val,
|
||||
|
||||
/// @hideinitializer
|
||||
#define AUE_EMIT_PAIRNAME(name, val) {#val, name::val},
|
||||
@ -78,7 +78,8 @@ using AuConsumer = std::function<void(T...)>;
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define AUE_DEFINE(name, vals) enum class name { AU_FOR_EACH(AUE_EMIT_ARRAY, AUE_STRIP_BRACKETS(vals)) kEnumCount }; \
|
||||
static inline const AuString k ## name ## ToString[static_cast<AuUInt>(name::kEnumCount)] = {AU_FOR_EACH_FIRST(AUE_EMIT_A, AUE_EMIT_B, AUE_STRIP_BRACKETS(vals)) }; \
|
||||
static inline const AuString k ## name ## ToString[static_cast<AuUInt>(name::kEnumCount)] = {AU_FOR_EACH(AUE_EMIT_A, AUE_STRIP_BRACKETS(vals)) }; \
|
||||
static inline const name k ## name ## Values[static_cast<AuUInt>(name::kEnumCount)] = {AU_FOR_EACH_THAT(AUE_EMIT_D, name, AUE_STRIP_BRACKETS(vals)) }; \
|
||||
inline const AuHashMap<AuString, name> k ## name ## FromString = { AU_FOR_EACH_THAT(AUE_EMIT_PAIRNAME, name, AUE_STRIP_BRACKETS(vals)) {"kEnumCount", name::kEnumCount} }; \
|
||||
static inline name name ## FromString (const AuString &codename) { AU_FOR_EACH_THAT(AUE_EMIT_CHECK, name, AUE_STRIP_BRACKETS(vals)) return name::kEnumCount; } \
|
||||
static inline name name ## FromHashString(const AuString &codename) { auto itr = k ## name ## FromString.find(codename); if (itr == k ## name ## FromString.end()) return name::kEnumCount; return itr->second; } \
|
||||
|
Loading…
Reference in New Issue
Block a user