Added additional constants and utilities
[+] AUE_ITERATE [+] kEnumCount [+] kEnumMaxLegal [+] kEnumMinLegal
This commit is contained in:
parent
64a2774c6b
commit
59c2f1c646
@ -84,4 +84,9 @@ using AuConsumer = std::function<void(T...)>;
|
||||
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; } \
|
||||
static inline const AuString & name ## ToString(name val) { static const AuString invalid = "kEnumCount"; if (static_cast<AuUInt>(val) >= static_cast<AuUInt>(name::kEnumCount)) return invalid; return k ## name ## ToString[static_cast<AuUInt>(val)]; } \
|
||||
static inline void name ## ForEach(const AuConsumer<name> &consumer) { AU_FOR_EACH_THAT(AUE_EMIT_CALL, name, AUE_STRIP_BRACKETS(vals)) }
|
||||
static inline void name ## ForEach(const AuConsumer<name> &consumer) { AU_FOR_EACH_THAT(AUE_EMIT_CALL, name, AUE_STRIP_BRACKETS(vals)) } \
|
||||
static const AuUInt k ## name ## Count = static_cast<AuUInt>(name::kEnumCount); \
|
||||
static const name k ## name ## MaxLegal = static_cast<name>(k ## name ## Count - 1); \
|
||||
static const name k ## name ## MinLegal = static_cast<name>(0);
|
||||
|
||||
#define AUE_ITERATE(name, index) name index = static_cast<name>(0); static_cast<AuUInt>(index) < static_cast<AuUInt>(name::kEnumCount); index = static_cast<name>(static_cast<AuUInt>(index) + 1)
|
Loading…
Reference in New Issue
Block a user