NebulaStream  0.6.213
NebulaStream is a data and application management framework for the internet of things
magic_enum.hpp File Reference
#include <array>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <type_traits>
#include <utility>
#include <optional>
#include <string>
#include <string_view>
#include <iosfwd>
Include dependency graph for magic_enum.hpp:
This graph shows which files directly or indirectly include this file:

Classes

struct  magic_enum::customize::enum_range< E >
 
class  magic_enum::customize::customize_t
 
struct  magic_enum::detail::supported< T >
 
struct  magic_enum::detail::has_is_flags< T, typename >
 
struct  magic_enum::detail::has_is_flags< T, std::void_t< decltype(customize::enum_range< T >::is_flags)> >
 
struct  magic_enum::detail::range_min< T, typename >
 
struct  magic_enum::detail::range_min< T, std::void_t< decltype(customize::enum_range< T >::min)> >
 
struct  magic_enum::detail::range_max< T, typename >
 
struct  magic_enum::detail::range_max< T, std::void_t< decltype(customize::enum_range< T >::max)> >
 
class  magic_enum::detail::static_string< N >
 
class  magic_enum::detail::static_string< 0 >
 
class  magic_enum::detail::case_insensitive
 
struct  magic_enum::detail::enable_if_enum< bool, R >
 
struct  magic_enum::detail::enable_if_enum< true, R >
 
struct  magic_enum::detail::is_scoped_enum< T, bool >
 
struct  magic_enum::detail::is_scoped_enum< T, true >
 
struct  magic_enum::detail::is_unscoped_enum< T, bool >
 
struct  magic_enum::detail::is_unscoped_enum< T, true >
 
struct  magic_enum::detail::underlying_type< T, bool >
 
struct  magic_enum::detail::underlying_type< T, true >
 
struct  magic_enum::is_unscoped_enum< T >
 
struct  magic_enum::is_scoped_enum< T >
 
struct  magic_enum::underlying_type< T >
 

Namespaces

 magic_enum
 
 magic_enum::customize
 
 magic_enum::customize::detail
 
 magic_enum::detail
 
 magic_enum::ostream_operators
 
 magic_enum::istream_operators
 
 magic_enum::iostream_operators
 
 magic_enum::bitwise_operators
 

Macros

#define MAGIC_ENUM_VERSION_MAJOR   0
 
#define MAGIC_ENUM_VERSION_MINOR   8
 
#define MAGIC_ENUM_VERSION_PATCH   2
 
#define MAGIC_ENUM_RANGE_MIN   -128
 
#define MAGIC_ENUM_RANGE_MAX   128
 

Typedefs

template<auto V, typename E = std::decay_t<decltype(V)>, std::enable_if_t< std::is_enum_v< E >, int > = 0>
using magic_enum::detail::enum_constant = std::integral_constant< E, V >
 
template<typename E , typename D = std::decay_t<E>>
using magic_enum::detail::values_t = decltype((values_v< D >))
 
template<typename E , typename D = std::decay_t<E>>
using magic_enum::detail::names_t = decltype((names_v< D >))
 
template<typename E , typename D = std::decay_t<E>>
using magic_enum::detail::entries_t = decltype((entries_v< D >))
 
template<typename T , typename R , typename BinaryPredicate = std::equal_to<>, typename D = std::decay_t<T>>
using magic_enum::detail::enable_if_t = typename enable_if_enum< std::is_enum_v< D > &&std::is_invocable_r_v< bool, BinaryPredicate, char, char >, R >::type
 
template<typename T , typename R , value_type VT, typename BinaryPredicate = std::equal_to<>, typename D = std::decay_t<T>>
using magic_enum::detail::enable_if_default_t = typename enable_if_enum< std::is_enum_v< D > &&VT==value_type::default_value &&std::is_invocable_r_v< bool, BinaryPredicate, char, char >, R >::type
 
template<typename T , typename R , value_type VT, typename BinaryPredicate = std::equal_to<>, typename D = std::decay_t<T>>
using magic_enum::detail::enable_if_flags_t = typename enable_if_enum< std::is_enum_v< D > &&VT==value_type::flags_value &&std::is_invocable_r_v< bool, BinaryPredicate, char, char >, R >::type
 
template<typename T , std::enable_if_t< std::is_enum_v< std::decay_t< T >>, int > = 0>
using magic_enum::detail::enum_concept = T
 
template<typename T >
using magic_enum::Enum = detail::enum_concept< T >
 
template<typename T >
using magic_enum::underlying_type_t = typename underlying_type< T >::type
 
template<auto V>
using magic_enum::enum_constant = detail::enum_constant< V >
 

Enumerations

enum class  magic_enum::customize::detail::customize_tag { magic_enum::customize::detail::default_tag , magic_enum::customize::detail::invalid_tag , magic_enum::customize::detail::custom_tag }
 
enum class  magic_enum::detail::value_type { magic_enum::detail::default_value , magic_enum::detail::flags_value }
 

Functions

template<typename E >
constexpr customize_t magic_enum::customize::enum_name (E) noexcept
 
template<typename E >
constexpr customize_t magic_enum::customize::enum_type_name () noexcept
 
constexpr string_view magic_enum::detail::pretty_name (string_view name) noexcept
 
constexpr std::size_t magic_enum::detail::find (string_view str, char c) noexcept
 
template<typename T , std::size_t N, std::size_t... I>
constexpr std::array< std::remove_cv_t< T >, N > magic_enum::detail::to_array (T(&a)[N], std::index_sequence< I... >) noexcept
 
template<typename BinaryPredicate >
constexpr bool magic_enum::detail::is_default_predicate () noexcept
 
template<typename BinaryPredicate >
constexpr bool magic_enum::detail::is_nothrow_invocable ()
 
template<typename BinaryPredicate >
constexpr bool magic_enum::detail::cmp_equal (string_view lhs, string_view rhs, [[maybe_unused]] BinaryPredicate &&p) noexcept(is_nothrow_invocable< BinaryPredicate >())
 
template<typename L , typename R >
constexpr bool magic_enum::detail::cmp_less (L lhs, R rhs) noexcept
 
template<typename I >
constexpr I magic_enum::detail::log2 (I value) noexcept
 
template<typename E >
constexpr auto magic_enum::detail::n () noexcept
 
template<typename E >
constexpr auto magic_enum::detail::type_name () noexcept
 
template<typename E , E V>
constexpr auto magic_enum::detail::n () noexcept
 
template<typename E , E V>
constexpr auto magic_enum::detail::enum_name () noexcept
 
template<typename E , auto V>
constexpr bool magic_enum::detail::is_valid () noexcept
 
template<typename E , int O, bool IsFlags, typename U = std::underlying_type_t<E>>
constexpr U magic_enum::detail::ualue (std::size_t i) noexcept
 
template<typename E , int O, bool IsFlags, typename U = std::underlying_type_t<E>>
constexpr E magic_enum::detail::value (std::size_t i) noexcept
 
template<typename E , bool IsFlags, typename U = std::underlying_type_t<E>>
constexpr int magic_enum::detail::reflected_min () noexcept
 
template<typename E , bool IsFlags, typename U = std::underlying_type_t<E>>
constexpr int magic_enum::detail::reflected_max () noexcept
 
template<std::size_t N>
constexpr std::size_t magic_enum::detail::values_count (const bool(&valid)[N]) noexcept
 
template<typename E , bool IsFlags, int Min, std::size_t... I>
constexpr auto magic_enum::detail::values (std::index_sequence< I... >) noexcept
 
template<typename E , bool IsFlags, typename U = std::underlying_type_t<E>>
constexpr auto magic_enum::detail::values () noexcept
 
template<typename E , typename U = std::underlying_type_t<E>>
constexpr bool magic_enum::detail::is_flags_enum () noexcept
 
template<typename E , std::size_t... I>
constexpr auto magic_enum::detail::names (std::index_sequence< I... >) noexcept
 
template<typename E , std::size_t... I>
constexpr auto magic_enum::detail::entries (std::index_sequence< I... >) noexcept
 
template<typename E , typename U = std::underlying_type_t<E>>
constexpr bool magic_enum::detail::is_sparse () noexcept
 
template<typename E , typename U = std::underlying_type_t<E>>
constexpr U magic_enum::detail::values_ors () noexcept
 
template<typename E , typename F , std::size_t... I>
constexpr auto magic_enum::detail::for_each (F &&f, std::index_sequence< I... >)
 
template<typename E , typename F , std::size_t... I>
constexpr bool magic_enum::detail::all_invocable (std::index_sequence< I... >)
 
template<typename E >
constexpr auto magic_enum::enum_type_name () noexcept -> detail::enable_if_t< E, string_view >
 
template<typename E >
constexpr auto magic_enum::enum_count () noexcept -> detail::enable_if_t< E, std::size_t >
 
template<typename E >
constexpr auto magic_enum::enum_value (std::size_t index) noexcept -> detail::enable_if_t< E, std::decay_t< E >>
 
template<typename E , std::size_t I>
constexpr auto magic_enum::enum_value () noexcept -> detail::enable_if_t< E, std::decay_t< E >>
 
template<typename E >
constexpr auto magic_enum::enum_values () noexcept -> detail::enable_if_t< E, detail::values_t< E >>
 
template<typename E >
constexpr auto magic_enum::enum_integer (E value) noexcept -> detail::enable_if_t< E, underlying_type_t< E >>
 
template<typename E >
constexpr auto magic_enum::enum_underlying (E value) noexcept -> detail::enable_if_t< E, underlying_type_t< E >>
 
template<typename E >
constexpr auto magic_enum::enum_index (E value) noexcept -> detail::enable_if_t< E, optional< std::size_t >>
 
template<auto V>
constexpr auto magic_enum::enum_index () noexcept -> detail::enable_if_t< decltype(V), std::size_t >
 
template<auto V>
constexpr auto magic_enum::enum_name () noexcept -> detail::enable_if_t< decltype(V), string_view >
 
template<typename E , detail::value_type VT = detail::value_type::default_value>
constexpr auto magic_enum::enum_name (E value) noexcept -> detail::enable_if_default_t< E, string_view, VT >
 
template<typename E , detail::value_type VT>
auto magic_enum::enum_name (E value) -> detail::enable_if_flags_t< E, string, VT >
 
template<typename E >
auto magic_enum::enum_flags_name (E value) -> detail::enable_if_t< E, string >
 
template<typename E >
constexpr auto magic_enum::enum_names () noexcept -> detail::enable_if_t< E, detail::names_t< E >>
 
template<typename E >
constexpr auto magic_enum::enum_entries () noexcept -> detail::enable_if_t< E, detail::entries_t< E >>
 
template<typename E , detail::value_type VT = detail::value_type::default_value>
constexpr auto magic_enum::enum_cast (underlying_type_t< E > value) noexcept -> detail::enable_if_t< E, optional< std::decay_t< E >>>
 
template<typename E >
constexpr auto magic_enum::enum_flags_cast (underlying_type_t< E > value) noexcept -> detail::enable_if_t< E, optional< std::decay_t< E >>>
 
template<typename E , detail::value_type VT = detail::value_type::default_value, typename BinaryPredicate = std::equal_to<>>
constexpr auto magic_enum::enum_cast (string_view value, [[maybe_unused]] BinaryPredicate p={}) noexcept(detail::is_nothrow_invocable< BinaryPredicate >()) -> detail::enable_if_t< E, optional< std::decay_t< E >>, BinaryPredicate >
 
template<typename E , typename BinaryPredicate = std::equal_to<>>
constexpr auto magic_enum::enum_flags_cast (string_view value, [[maybe_unused]] BinaryPredicate p={}) noexcept(detail::is_nothrow_invocable< BinaryPredicate >()) -> detail::enable_if_t< E, optional< std::decay_t< E >>, BinaryPredicate >
 
template<typename E , detail::value_type VT = detail::value_type::default_value>
constexpr auto magic_enum::enum_contains (E value) noexcept -> detail::enable_if_t< E, bool >
 
template<typename E >
constexpr auto magic_enum::enum_flags_contains (E value) noexcept -> detail::enable_if_t< E, bool >
 
template<typename E , detail::value_type VT = detail::value_type::default_value>
constexpr auto magic_enum::enum_contains (underlying_type_t< E > value) noexcept -> detail::enable_if_t< E, bool >
 
template<typename E >
constexpr auto magic_enum::enum_flags_contains (underlying_type_t< E > value) noexcept -> detail::enable_if_t< E, bool >
 
template<typename E , detail::value_type VT = detail::value_type::default_value, typename BinaryPredicate = std::equal_to<>>
constexpr auto magic_enum::enum_contains (string_view value, BinaryPredicate p={}) noexcept(detail::is_nothrow_invocable< BinaryPredicate >()) -> detail::enable_if_t< E, bool, BinaryPredicate >
 
template<typename E , typename BinaryPredicate = std::equal_to<>>
constexpr auto magic_enum::enum_flags_contains (string_view value, BinaryPredicate p={}) noexcept(detail::is_nothrow_invocable< BinaryPredicate >()) -> detail::enable_if_t< E, bool, BinaryPredicate >
 
template<typename E , typename F , detail::enable_if_t< E, int > = 0>
constexpr auto magic_enum::enum_for_each (F &&f)
 
template<typename Char , typename Traits , typename E , detail::enable_if_t< E, int > = 0>
std::basic_ostream< Char, Traits > & magic_enum::ostream_operators::operator<< (std::basic_ostream< Char, Traits > &os, E value)
 
template<typename Char , typename Traits , typename E , detail::enable_if_t< E, int > = 0>
std::basic_ostream< Char, Traits > & magic_enum::ostream_operators::operator<< (std::basic_ostream< Char, Traits > &os, optional< E > value)
 
template<typename Char , typename Traits , typename E , detail::enable_if_t< E, int > = 0>
std::basic_istream< Char, Traits > & magic_enum::istream_operators::operator>> (std::basic_istream< Char, Traits > &is, E &value)
 
template<typename E , detail::enable_if_t< E, int > = 0>
constexpr E magic_enum::bitwise_operators::operator~ (E rhs) noexcept
 
template<typename E , detail::enable_if_t< E, int > = 0>
constexpr E magic_enum::bitwise_operators::operator| (E lhs, E rhs) noexcept
 
template<typename E , detail::enable_if_t< E, int > = 0>
constexpr E magic_enum::bitwise_operators::operator& (E lhs, E rhs) noexcept
 
template<typename E , detail::enable_if_t< E, int > = 0>
constexpr E magic_enum::bitwise_operators::operator^ (E lhs, E rhs) noexcept
 
template<typename E , detail::enable_if_t< E, int > = 0>
constexpr E & magic_enum::bitwise_operators::operator|= (E &lhs, E rhs) noexcept
 
template<typename E , detail::enable_if_t< E, int > = 0>
constexpr E & magic_enum::bitwise_operators::operator&= (E &lhs, E rhs) noexcept
 
template<typename E , detail::enable_if_t< E, int > = 0>
constexpr E & magic_enum::bitwise_operators::operator^= (E &lhs, E rhs) noexcept
 

Variables

constexpr auto magic_enum::customize::default_tag = customize_t{detail::customize_tag::default_tag}
 
constexpr auto magic_enum::customize::invalid_tag = customize_t{detail::customize_tag::invalid_tag}
 
template<typename... T>
constexpr bool magic_enum::detail::always_false_v = false
 
template<typename T >
constexpr bool magic_enum::detail::is_enum_v = std::is_enum_v<T> && std::is_same_v<T, std::decay_t<T>>
 
template<typename E >
constexpr auto magic_enum::detail::type_name_v = type_name<E>()
 
template<typename E , E V>
constexpr auto magic_enum::detail::enum_name_v = enum_name<E, V>()
 
template<typename E , bool IsFlags>
constexpr auto magic_enum::detail::reflected_min_v = reflected_min<E, IsFlags>()
 
template<typename E , bool IsFlags>
constexpr auto magic_enum::detail::reflected_max_v = reflected_max<E, IsFlags>()
 
template<typename E >
constexpr bool magic_enum::detail::is_flags_v = is_flags_enum<E>()
 
template<typename E >
constexpr std::array magic_enum::detail::values_v = values<E, is_flags_v<E>>()
 
template<typename E >
constexpr auto magic_enum::detail::count_v = values_v<E>.size()
 
template<typename E , typename U = std::underlying_type_t<E>>
constexpr auto magic_enum::detail::min_v = (count_v<E> > 0) ? static_cast<U>(values_v<E>.front()) : U{0}
 
template<typename E , typename U = std::underlying_type_t<E>>
constexpr auto magic_enum::detail::max_v = (count_v<E> > 0) ? static_cast<U>(values_v<E>.back()) : U{0}
 
template<typename E >
constexpr std::array magic_enum::detail::names_v = names<E>(std::make_index_sequence<count_v<E>>{})
 
template<typename E >
constexpr std::array magic_enum::detail::entries_v = entries<E>(std::make_index_sequence<count_v<E>>{})
 
template<typename E >
constexpr bool magic_enum::detail::is_sparse_v = is_sparse<E>()
 
template<typename T >
constexpr bool magic_enum::detail::has_hash = false
 
constexpr bool magic_enum::is_magic_enum_supported = detail::supported<void>::value
 
constexpr auto magic_enum::case_insensitive = detail::case_insensitive{}
 
template<bool AsFlags = true>
constexpr auto magic_enum::as_flags = AsFlags ? detail::value_type::flags_value : detail::value_type::default_value
 

Macro Definition Documentation

◆ MAGIC_ENUM_RANGE_MAX

#define MAGIC_ENUM_RANGE_MAX   128

◆ MAGIC_ENUM_RANGE_MIN

#define MAGIC_ENUM_RANGE_MIN   -128

◆ MAGIC_ENUM_VERSION_MAJOR

#define MAGIC_ENUM_VERSION_MAJOR   0

◆ MAGIC_ENUM_VERSION_MINOR

#define MAGIC_ENUM_VERSION_MINOR   8

◆ MAGIC_ENUM_VERSION_PATCH

#define MAGIC_ENUM_VERSION_PATCH   2