Botcraft 1.21.4
Loading...
Searching...
No Matches
EnumUtilities.hpp File Reference
#include <type_traits>
#include <string_view>
#include <array>
#include <utility>
#include <algorithm>
#include <iostream>

Go to the source code of this file.

Classes

struct  Botcraft::Utilities::EnumMapperRange< Enum, MinVal, MaxVal >
 

Namespaces

namespace  Botcraft
 
namespace  Botcraft::Utilities
 

Macros

#define DECLARE_ENUM_STRINGIFYER(Enum)   ::std::ostream& operator <<(::std::ostream& os, const Enum v)
 
#define DEFINE_ENUM_STRINGIFYER_RANGE(Enum, min_value, max_value)
 
#define DEFINE_ENUM_STRINGIFYER_LIST(Enum, ...)
 

Functions

template<auto V>
constexpr auto Botcraft::Utilities::enum_value_name () noexcept
 
template<class Enum >
constexpr std::underlying_type_t< Enum > Botcraft::Utilities::to_underlying (const Enum e) noexcept
 
template<class Enum , Enum... pack>
constexpr std::array< std::pair< Enum, std::string_view >, sizeof...(pack)> Botcraft::Utilities::GetNamedEnum ()
 

Macro Definition Documentation

◆ DECLARE_ENUM_STRINGIFYER

#define DECLARE_ENUM_STRINGIFYER (   Enum)    ::std::ostream& operator <<(::std::ostream& os, const Enum v)

Definition at line 68 of file EnumUtilities.hpp.

◆ DEFINE_ENUM_STRINGIFYER_LIST

#define DEFINE_ENUM_STRINGIFYER_LIST (   Enum,
  ... 
)
Value:
::std::ostream& operator <<(::std::ostream& os, const Enum v) \
{ \
return os << '(' << #Enum << ')' << static_cast<int>(v); \
} static_assert(true, "") /* To require a ; after macro call */

Definition at line 107 of file EnumUtilities.hpp.

◆ DEFINE_ENUM_STRINGIFYER_RANGE

#define DEFINE_ENUM_STRINGIFYER_RANGE (   Enum,
  min_value,
  max_value 
)
Value:
::std::ostream& operator <<(::std::ostream& os, const Enum v) \
{ \
return os << '(' << #Enum << ')' << static_cast<int>(v); \
} static_assert(true, "") /* To require a ; after macro call */

Definition at line 86 of file EnumUtilities.hpp.