CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
StructEnum.hpp File Reference

Go to the source code of this file.

Classes

class  CeresEngine::StructEnum< T, Underlying >
 

Namespaces

namespace  CeresEngine
 

Concepts

concept  CeresEngine::CStructEnum
 

Macros

#define CE_STRUCT_ENUM_DECL(T)
 
#define CE_STRUCT_ENUM_FOREACH(T, F)   CE_STRUCT_ENUM_FOREACH_##T(F)
 
#define CE_STRUCT_ENUM_TO_STRING_IMPL(T)
 
#define CE_STRUCT_ENUM_TO_STRING(T, M)
 
#define CE_STRUCT_ENUM_FROM_STRING_IMPL(T)
 
#define CE_STRUCT_ENUM_FROM_STRING(T, M)
 
#define CE_STRUCT_ENUM_DEF(T)
 
#define CE_STRUCT_ENUM_DEF2(T, M)
 

Macro Definition Documentation

◆ CE_STRUCT_ENUM_DECL

#define CE_STRUCT_ENUM_DECL (   T)
Value:
using RawType = decltype(raw); \
constexpr T() = default; \
CE_EXPLICIT(false) constexpr T(RawType raw) : raw(raw) {} \
explicit constexpr T(UnderlyingType raw) : T(RawType(raw)) {} \
\
public: \
\
[[nodiscard]] StringView toString() const noexcept; \
\
\
[[nodiscard]] static Optional<T> fromString(StringView string) noexcept;
BasicStringView< char > StringView
Narrow string view used for handling narrow encoded text in UTF-8.
Definition String.hpp:190
StringView toString(Button button) noexcept
Returns a string representation for the given button

◆ CE_STRUCT_ENUM_DEF

#define CE_STRUCT_ENUM_DEF (   T)
Value:
CE_STRUCT_ENUM_FROM_STRING(T, T)
#define CE_STRUCT_ENUM_TO_STRING(T, M)
Definition StructEnum.hpp:67

◆ CE_STRUCT_ENUM_DEF2

#define CE_STRUCT_ENUM_DEF2 (   T,
 
)
Value:
CE_STRUCT_ENUM_FROM_STRING(T, M)

◆ CE_STRUCT_ENUM_FOREACH

#define CE_STRUCT_ENUM_FOREACH (   T,
 
)    CE_STRUCT_ENUM_FOREACH_##T(F)

◆ CE_STRUCT_ENUM_FROM_STRING

#define CE_STRUCT_ENUM_FROM_STRING (   T,
 
)
Value:
Optional<T> T::fromString(StringView string) noexcept { \
CE_STRUCT_ENUM_FOREACH(M, CE_STRUCT_ENUM_FROM_STRING_IMPL); \
return {}; \
}
#define CE_STRUCT_ENUM_FROM_STRING_IMPL(T)
Definition StructEnum.hpp:73

◆ CE_STRUCT_ENUM_FROM_STRING_IMPL

#define CE_STRUCT_ENUM_FROM_STRING_IMPL (   T)
Value:
if(string == #T) \
return T;

◆ CE_STRUCT_ENUM_TO_STRING

#define CE_STRUCT_ENUM_TO_STRING (   T,
 
)
Value:
StringView T::toString() const noexcept { \
return "<unknown>"; \
}
#define CE_STRUCT_ENUM_TO_STRING_IMPL(T)
Definition StructEnum.hpp:64
#define CE_STRUCT_ENUM_FOREACH(T, F)
Definition StructEnum.hpp:62

◆ CE_STRUCT_ENUM_TO_STRING_IMPL

#define CE_STRUCT_ENUM_TO_STRING_IMPL (   T)
Value:
case T: \
return #T;