|
static constexpr std::size_t | count () |
| Returns the number of constants declared in the enumeration type.
|
|
static constexpr const names_array_t & | names () |
| Returns the set of enum constants names. More...
|
|
static constexpr const values_array_t & | values () |
| Returns the set of enum constants values. More...
|
|
static constexpr EnumType | value (std::size_t i) |
| Returns the value of the i-th constant of the enumeration. More...
|
|
static constexpr const char * | name (std::size_t i) |
| Returns the name of the i-th constant of the enumeration. More...
|
|
static constexpr const char * | toString (const EnumType value) |
| Returns a string representation of the given enumeration value. More...
|
|
static constexpr EnumType | fromString (const char *name) |
| Returns an enumeration value from the given enumeration constant name. More...
|
|
static constexpr bool | has (const char *name) |
| Checks if there's an enumeration constant with the given name. More...
|
|
static constexpr bool | has (const UnderlyingType value) |
| Checks if there's an enumeration constant with the given value. More...
|
|
template<typename SourceInfo, typename EnumType, typename Constants, typename ConstantsNames>
class cpp::static_reflection::meta::Enum< SourceInfo, EnumType, Constants, ConstantsNames >
Stores static reflection information of an enumeration type.
This class stores information of a given enumeration type and exposes it as methods that can be used to query for enumeration values, get string representations of enumeration values, indexing the enumeration, etc.
template<typename SourceInfo, typename EnumType, typename Constants, typename ConstantsNames>
Returns an enumeration value from the given enumeration constant name.
This function searches for an enumeration constant with the given name. Is assumed that the given name is not qualified with the enumeration type name. The behavior is undefined if there's no enumeration constant declared with that name. See has().
- Parameters
-
name | Pointer to a null terminated C string with the non-qualified constant name |
template<typename SourceInfo, typename EnumType, typename Constants, typename ConstantsNames>
Checks if there's an enumeration constant with the given name.
This function searches for an enumeration constant with the given name. Is assumed that the given name is not qualified with the enumeration type name.
- Parameters
-
name | Pointer to a null terminated C string with the name |
- Returns
- True if there's a constant declared with that name, false otherwise.
template<typename SourceInfo, typename EnumType, typename Constants, typename ConstantsNames>
Returns a string representation of the given enumeration value.
If the value is the value of the i-th constant of the enumeration, returns the i-th constant name. The behavior is undefined if the enumeration declaration has no constant with that value (Such as when converting an arbitrary integral value to the enumeration). See has().
- Parameters
-
- Returns
- A pointer to a constexpr null terminated C string with the name of the corresponding enumeration constant. This function doesn't qualify its result with the enumeration type name, the name is returned as declared in the enum declaration.
template<typename SourceInfo, typename EnumType, typename Constants, typename ConstantsNames>
Returns the value of the i-th constant of the enumeration.
Equivalent to values()[i]
- Parameters
-
i | Zero-indexed index of the constant |
Note: Constants are indexed from top to bottom:
enum class JoystickAxis
{
X,
Y
};
the behavior is undefined if i >= count()
.