3.8.0
Freundlich's C++ toolkit
Classes | Typedefs | Functions
fcppt::enum_ Namespace Reference

Classes

class  array
 An array indexed with an enum. More...
 
struct  from_string_impl
 
class  iterator
 
class  range
 A range over a contiguous enum. More...
 
struct  size_type_impl
 
struct  to_string_impl
 Customization point for fcppt::enum_::to_string. More...
 

Typedefs

template<typename Enum >
using has_maximum = typename fcppt::enum_::detail::has_maximum< Enum >::type
 Tests if an enum has fcppt_maximum as a member. More...
 
template<typename Enum >
using is_object = std::conjunction< std::is_enum< Enum >, fcppt::enum_::has_maximum< Enum > >
 Checks if a type is usable with fcppt.enum. More...
 
template<typename Type , typename = std::enable_if_t<fcppt::enum_::is_object<Type>::value>>
using max_value = std::integral_constant< Type, Type::fcppt_maximum >
 The maximum enumerator in an enum. More...
 
template<typename Type , typename = std::enable_if_t<fcppt::enum_::is_object<Type>::value>>
using min_value = std::integral_constant< Type, fcppt::cast::int_to_enum< Type >(0)>
 The minimum enumerator in an enum. More...
 
template<typename Enum >
using names_array = fcppt::enum_::array< Enum, std::string_view >
 Array type for The names of an enum. More...
 
template<typename Type , typename = std::enable_if_t<fcppt::enum_::is_object<Type>::value>>
using size = std::integral_constant< fcppt::enum_::size_type< Type >, fcppt::cast::enum_to_int< fcppt::enum_::size_type< Type > >(fcppt::enum_::max_value< Type >::value)+1U >
 The number of enumerators in an enum. More...
 
template<typename Type >
using size_type = typename fcppt::enum_::size_type_impl< Type >::type
 The size type used to count the number of enumerators in an enum. More...
 

Functions

template<typename Enum , typename Value >
bool operator== (fcppt::enum_::array< Enum, Value > const &_a, fcppt::enum_::array< Enum, Value > const &_b)
 Compares two enum arrays for equality. More...
 
template<typename Enum , typename Value >
bool operator!= (fcppt::enum_::array< Enum, Value > const &_a, fcppt::enum_::array< Enum, Value > const &_b)
 Compares two enum arrays for inequality. More...
 
template<typename Array , typename Function >
Array array_init (Function const &_function)
 Constructs an array by calling a function with static enumerators. More...
 
template<typename Ch , typename Traits , typename Enum , typename Value , typename = std::enable_if_t<fcppt::enum_::is_object<Enum>::value>>
std::basic_ostream< Ch, Traits > & operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::enum_::array< Enum, Value > const &_array)
 Outputs an enum array. More...
 
template<typename Enum , typename Value , typename = std::enable_if_t< std::conjunction_v<std::is_unsigned<Value>, fcppt::enum_::is_object<Enum>>>>
fcppt::optional::object< Enum > from_int (Value const &_value) noexcept
 Cast an unsigned value to an enum. More...
 
template<typename Enum , typename = std::enable_if_t<fcppt::enum_::is_object<Enum>::value>>
fcppt::optional::object< Enum > from_string (std::string_view const &_string)
 Converts a string to an enum. More...
 
template<typename Enum , typename Value >
fcppt::optional::object< Enum > index_of_array (fcppt::enum_::array< Enum, Value > const &_array, Value const &_value)
 Returns the enum of the first element found in an enum array. More...
 
template<typename Ch , typename Traits , typename Enum , typename = std::enable_if_t<fcppt::enum_::is_object<Enum>::value>>
std::basic_istream< Ch, Traits > & input (std::basic_istream< Ch, Traits > &_stream, Enum &_result)
 Reads an enum value from a stream. More...
 
template<typename Enum >
fcppt::enum_::range< Enum > make_range () noexcept
 Creates an enum range over the whole enum. More...
 
template<typename Enum >
fcppt::enum_::range< Enum > make_range_start (Enum const _start) noexcept
 Creates an enum range with a custom start value. More...
 
template<typename Enum >
fcppt::enum_::range< Enum > make_range_start_end (Enum const _start, Enum const _end) noexcept
 Creates a closed enum range. More...
 
template<typename Enum , typename = std::enable_if_t<fcppt::enum_::is_object<Enum>::value>>
fcppt::enum_::names_array< Enum > names ()
 The names of an enum type. More...
 
template<typename Ch , typename Traits , typename Enum , typename = std::enable_if<fcppt::enum_::is_object<Enum>::value>>
std::basic_ostream< Ch, Traits > & output (std::basic_ostream< Ch, Traits > &_stream, Enum const _value)
 Outputs an enum value to a stream. More...
 
template<typename Enum , typename Function , typename = std::enable_if_t<fcppt::enum_::is_object<Enum>::value>>
decltype(auto) to_static (Enum const _enum, Function const &_function)
 Converts a runtime enum value into a compile time one, passing it to a function. More...
 
template<typename Enum , typename = std::enable_if<fcppt::enum_::is_object<Enum>::value>>
std::string_view to_string (Enum const _enum)
 Converts an enum to a string. More...
 

Typedef Documentation

◆ is_object

template<typename Enum >
using fcppt::enum_::is_object = typedef std::conjunction<std::is_enum<Enum>,fcppt::enum_::has_maximum<Enum> >

Checks if a type is usable with fcppt.enum.