[+] Added AUE_NOCPPSTL configuration macro. Scriptability will and kernel drivers shouldn't (but probably will) depend no a nostl assumption
This commit is contained in:
parent
ce9d53f779
commit
0fcca45387
@ -13,31 +13,33 @@
|
||||
|
||||
#if defined(AUE_OUT_OF_ECOSYSTEM)
|
||||
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#if !defined(AUE_NOCPPSTL)
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
|
||||
#if !defined(AU_AuHashMap)
|
||||
#define AU_AuHashMap
|
||||
template<typename T, typename Z>
|
||||
using AuHashMap = std::unordered_map<T, Z>;
|
||||
#endif
|
||||
#if !defined(AU_AuHashMap)
|
||||
#define AU_AuHashMap
|
||||
template<typename T, typename Z>
|
||||
using AuHashMap = std::unordered_map<T, Z>;
|
||||
#endif
|
||||
|
||||
#if !defined(AU_AuString)
|
||||
#define AU_AuString
|
||||
using AuString = std::string;
|
||||
#endif
|
||||
#if !defined(AU_AuString)
|
||||
#define AU_AuString
|
||||
using AuString = std::string;
|
||||
#endif
|
||||
|
||||
#if !defined(AU_UInt)
|
||||
#define AU_UInt
|
||||
using AuUInt = size_t;
|
||||
#endif
|
||||
#if !defined(AU_AuConsumer)
|
||||
#define AU_AuConsumer
|
||||
template<typename ... T>
|
||||
using AuConsumer = std::function<void(T...)>;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(AU_Consumer)
|
||||
#define AU_Consumer
|
||||
template<typename ... T>
|
||||
using AuConsumer = std::function<void(T...)>;
|
||||
#endif
|
||||
#if !defined(AU_AuUInt)
|
||||
#define AU_AuUInt
|
||||
using AuUInt = size_t;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -91,3 +93,20 @@ using AuConsumer = std::function<void(T...)>;
|
||||
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)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Limited support for when there is no STL or STL-like library available
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(AUE_NOCPPSTL)
|
||||
#undef AUE_DEFINE
|
||||
#define AUE_DEFINE(name, vals) enum class name { AU_FOR_EACH(AUE_EMIT_ARRAY, AUE_STRIP_BRACKETS(vals)) kEnumCount }; \
|
||||
static inline const char * 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)) }; \
|
||||
static inline const char * name ## ToString(name val) { static const char * invalid = "kEnumCount"; if (static_cast<AuUInt>(val) >= static_cast<AuUInt>(name::kEnumCount)) return invalid; return k ## name ## ToString[static_cast<AuUInt>(val)]; } \
|
||||
static inline bool name ## IsValid(name val) { return static_cast<AuUInt>(val) < static_cast<AuUInt>(name::kEnumCount); } \
|
||||
static const AuUInt k ## name ## Count = static_cast<AuUInt>(name::kEnumCount); \
|
||||
static const name k ## name ## Invalid = 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);
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user