HikoGUI
A low latency retained GUI
|
#include <hikogui/utility/enum_metadata.hpp>
Public Types | |
using | value_type = ValueType |
using | name_type = NameType |
Public Member Functions | |
constexpr size_t | size () const noexcept |
Get the number of enum values. | |
constexpr value_type | minimum () const noexcept |
Get the minimum value. | |
constexpr value_type | maximum () const noexcept |
Get the maximum value. | |
template<typename... Args> | |
constexpr | enum_metadata (Args const &...args) noexcept |
Construct a enum-names table object. | |
template<std::convertible_to< name_type > Name> | |
constexpr bool | contains (Name &&name) const noexcept |
Check if the enum has a name. | |
constexpr bool | contains (value_type value) const noexcept |
Check if the enum has a value. | |
template<std::convertible_to< name_type > Name> | |
constexpr value_type | at (Name &&name) const |
Get an enum-value from a name. | |
constexpr name_type const & | at (value_type value) const |
Get a name from an enum-value. | |
template<std::convertible_to< name_type > Name> | |
constexpr std::optional< value_type > | at_if (Name &&name) const noexcept |
Get an enum-value from a name. | |
template<std::convertible_to< name_type > Name> | |
constexpr value_type | at (Name &&name, value_type default_value) const noexcept |
Get an enum-value from a name. | |
template<std::convertible_to< name_type > Name> | |
constexpr name_type | at (value_type value, Name &&default_name) const noexcept |
Get a name from an enum-value. | |
template<std::convertible_to< name_type > Name> | |
constexpr value_type | operator[] (Name &&name) const noexcept |
Get an enum-value from a name. | |
constexpr name_type const & | operator[] (value_type value) const noexcept |
Get a name from an enum-value. | |
Data Fields | |
bool | values_are_continues |
The numeric values in the enum do not contain a gap. | |
Static Public Attributes | |
static constexpr std::size_t | count = N |
The number of enum values. | |
A object that holds enum-values and strings.
ValueType | The enum-type. |
NameType | The type used to convert to and from the EnumType. |
N | Number of enum-values. |
|
inlineconstexprnoexcept |
Construct a enum-names table object.
Example usage:
The template parameters of the class will be deduced from the constructor. N = sizeof...(Args) / 2
, T = decltype(args[0])
.
args | A list of a enum-value and names. |
|
inlineconstexpr |
Get an enum-value from a name.
name | The name to lookup in the enum. |
std::out_of_range | When the name does not exist. |
|
inlineconstexprnoexcept |
Get an enum-value from a name.
name | The name to lookup in the enum. |
default_value | The default value to return when the name is not found. |
|
inlineconstexpr |
Get a name from an enum-value.
value | The enum value to lookup. |
std::out_of_range | When the value does not exist. |
|
inlineconstexprnoexcept |
Get a name from an enum-value.
value | The enum value to lookup. |
default_name | The default name to return when value is not found. |
|
inlineconstexprnoexcept |
Get an enum-value from a name.
name | The name to lookup in the enum. |
|
inlineconstexprnoexcept |
Check if the enum has a name.
name | The name to lookup in the enum. |
|
inlineconstexprnoexcept |
Check if the enum has a value.
value | The value to lookup for the enum. |
|
inlineconstexprnoexcept |
Get the maximum value.
|
inlineconstexprnoexcept |
Get the minimum value.
|
inlineconstexprnoexcept |
Get an enum-value from a name.
name | The name to lookup in the enum. |
|
inlineconstexprnoexcept |
Get a name from an enum-value.
value | The enum value to lookup. |
|
inlineconstexprnoexcept |
Get the number of enum values.
|
staticconstexpr |
The number of enum values.
bool hi::v1::enum_metadata< ValueType, NameType, N >::values_are_continues |
The numeric values in the enum do not contain a gap.