#include <hikogui/enum_metadata.hpp>
|
| 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.
|
| |
| constexpr bool | contains (std::string_view 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.
|
| |
| constexpr value_type | at (std::string_view name) const |
| | Get an enum-value from a name.
|
| |
| constexpr std::string_view const & | at (value_type value) const |
| | Get a name from an enum-value.
|
| |
| constexpr value_type | at (std::string_view name, value_type default_value) const noexcept |
| | Get an enum-value from a name.
|
| |
| constexpr std::string_view | at (value_type value, std::string_view default_name) const noexcept |
| | Get a name from an enum-value.
|
| |
| constexpr value_type | operator[] (std::string_view name) const noexcept |
| | Get an enum-value from a name.
|
| |
| constexpr std::string_view const & | operator[] (value_type value) const noexcept |
| | Get a name from an enum-value.
|
| |
template<typename T,
std::size_t N>
class v1::enum_metadata< T, N >
A object that holds enum-values and strings.
- Template Parameters
-
| T | The enum-type. |
| N | Number of enum-values. |
◆ enum_metadata()
template<typename... Args>
Construct a enum-names table object.
Example usage:
enum class my_bool { yes, no };
constexpr auto my_bool_names =
enum_metadata(my_bool::no,
"no", my_bool::yes,
"yes");
constexpr enum_metadata(Args const &...args) noexcept
Construct a enum-names table object.
Definition enum_metadata.hpp:66
The template parameters of the class will be deduced from the constructor. N = sizeof...(Args) / 2, T = decltype(args[0]).
- Parameters
-
| Args | A list of a enum-value and names. |
◆ at() [1/4]
Get an enum-value from a name.
- Parameters
-
| name | The name to lookup in the enum. |
- Returns
- The enum-value belonging with the name.
- Exceptions
-
◆ at() [2/4]
| constexpr value_type v1::enum_metadata< T, N >::at |
( |
std::string_view | name, |
|
|
value_type | default_value ) const |
|
inlineconstexprnoexcept |
Get an enum-value from a name.
- Parameters
-
| name | The name to lookup in the enum. |
| default_value | The default value to return when the name is not found. |
- Returns
- The enum-value belonging with the name.
◆ at() [3/4]
| constexpr std::string_view const & v1::enum_metadata< T, N >::at |
( |
value_type | value | ) |
const |
|
inlineconstexpr |
Get a name from an enum-value.
- Parameters
-
| value | The enum value to lookup. |
- Returns
- The name belonging with the enum value.
- Exceptions
-
◆ at() [4/4]
| constexpr std::string_view v1::enum_metadata< T, N >::at |
( |
value_type | value, |
|
|
std::string_view | default_name ) const |
|
inlineconstexprnoexcept |
Get a name from an enum-value.
- Parameters
-
| value | The enum value to lookup. |
- Returns
- The name belonging with the enum value.
- Exceptions
-
◆ contains() [1/2]
Check if the enum has a name.
- Parameters
-
| name | The name to lookup in the enum. |
- Returns
- True if the name is found.
◆ contains() [2/2]
Check if the enum has a value.
- Parameters
-
| name | The name to lookup in the enum. |
- Returns
- True if the name is found.
◆ maximum()
◆ minimum()
◆ operator[]() [1/2]
| constexpr value_type v1::enum_metadata< T, N >::operator[] |
( |
std::string_view | name | ) |
const |
|
inlineconstexprnoexcept |
Get an enum-value from a name.
- Note
- It is undefined-behavior to lookup a name that does not exist in the table.
- Parameters
-
| name | The name to lookup in the enum. |
- Returns
- The enum-value belonging with the name.
◆ operator[]() [2/2]
| constexpr std::string_view const & v1::enum_metadata< T, N >::operator[] |
( |
value_type | value | ) |
const |
|
inlineconstexprnoexcept |
Get a name from an enum-value.
- Note
- It is undefined-behavior to lookup a value that does not exist in the table.
- Parameters
-
| value | The enum value to lookup. |
- Returns
- The name belonging with the enum value.
◆ count
The number of enum values.
◆ values_are_continues
The numeric values in the enum do not contain a gap.
The documentation for this class was generated from the following file: