|
VoltMod
C++23 framework for CS2 server plugins
|
Enumerator names without a hand-written switch. More...
#include <cstddef>#include <magic_enum/magic_enum.hpp>#include <optional>#include <string_view>Go to the source code of this file.
Namespaces | |
| namespace | VoltMod |
Macros | |
| #define | MAGIC_ENUM_RANGE_MIN 0 |
| #define | MAGIC_ENUM_RANGE_MAX 255 |
Functions | |
| template<class E > | |
| constexpr std::string_view | VoltMod::Name (E value) noexcept |
| template<class E > | |
| constexpr std::optional< E > | VoltMod::Parse (std::string_view name) noexcept |
| template<class E > | |
| constexpr std::size_t | VoltMod::EnumIndex (E value) noexcept |
| template<class E > | |
| constexpr auto | VoltMod::EnumValues () noexcept |
Variables | |
| template<class E > | |
| constexpr std::size_t | VoltMod::EnumCount = magic_enum::enum_count<E>() |
Enumerator names without a hand-written switch.
Every framework enum spells its enumerators the way the log and the JSON status want to read them, so the name is the compiler's copy of the identifier. A switch that maps them to strings is one more thing to forget when an enumerator is added.
Definition in file EnumNames.hpp.
| #define MAGIC_ENUM_RANGE_MAX 255 |
Definition at line 11 of file EnumNames.hpp.
| #define MAGIC_ENUM_RANGE_MIN 0 |
Definition at line 8 of file EnumNames.hpp.