Provides methods that perform some operations on values of enum type. This is a static type with no instance services. You should never create instances of it by any means.
More...
#include "format_builder.h"
|
using | UnderlyingType = typename std::underlying_type< E >::type |
| Alias for the enum's underlying type. More...
|
|
|
static const System::TypeInfo & | GetUnderlyingType () |
| Returns the underlying type of the enumeration. More...
|
|
static bool | HasFlag (E value, E mask) |
| Determines if the specified bits are set in a bitary representation of the specified enum value. More...
|
|
static bool | IsDefined (E value) |
| Determines whether the specified value is a member of enumeration type E . More...
|
|
template<class T > |
static std::enable_if< std::is_convertible< T, UnderlyingType >::value, bool >::type | IsDefined (T value) |
| Determines whether the specified value is a member of enumeration type T . More...
|
|
static bool | IsDefined (const String &name) |
| Determines if the value with the specified name is among members of enum E . More...
|
|
template<class T > |
static std::enable_if< std::is_same< T, E >::value||std::is_convertible< T, UnderlyingType >::value, String >::type | GetName (T value) |
| Returns the name of the enumeration constant that has the specified value. More...
|
|
template<class T > |
static std::enable_if< std::is_same< T, E >::value||std::is_convertible< T, UnderlyingType >::value, String >::type | GetDescription (T value) |
| Returns the name of the enumeration constant that has the specified value. More...
|
|
static E | Parse (const String &str, bool ignoreCase=false) |
| Converts the specfied string into equivalent enum constant. More...
|
|
static bool | TryParse (const String &str, E &result) |
| Tries to convert the specified string into equivalent enum constant. More...
|
|
static bool | TryParse (const String &str, bool ignoreCase, E &result) |
| Tries to convert the specified string into equivalent enum constant. More...
|
|
static ArrayPtr< E > | GetValues () |
| Returns an array containing all members of enumeration E . More...
|
|
static ArrayPtr< String > | GetNames () |
| Returns an array containing names of all members of enumeration E . More...
|
|
template<typename T , typename _ = typename std::enable_if<std::is_arithmetic<T>::value || std::is_enum<T>::value>::type> |
static int | Compare (E a, T b) |
| Performs the arithmetic comparison of the values of the specified enumeration constants. More...
|
|
template<class E, class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
struct System::Enum< E, Guard >
Provides methods that perform some operations on values of enum type. This is a static type with no instance services. You should never create instances of it by any means.
- Template Parameters
-
E | The type of enum on values of which the class handles |
Guard | Service type argument whose purpose is to ensure that E is enumerable type |
◆ UnderlyingType
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
Alias for the enum's underlying type.
◆ Compare()
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
template<typename T , typename _ = typename std::enable_if<std::is_arithmetic<T>::value || std::is_enum<T>::value>::type>
Performs the arithmetic comparison of the values of the specified enumeration constants.
- Parameters
-
a | The first comparand |
b | The second comparand |
- Returns
- -1 if
a
is less than b
; 0 if the values are equal; 1 if a
is greater than b
◆ GetDescription()
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
template<class T >
static std::enable_if<std::is_same<T, E>::value || std::is_convertible<T, UnderlyingType>::value, String>::type System::Enum< E, Guard >::GetDescription |
( |
T |
value | ) |
|
|
inlinestatic |
Returns the name of the enumeration constant that has the specified value.
- Parameters
-
value | The value of enum constant whose name is to be returned |
- Returns
- The name of the specified enum constant
◆ GetName()
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
template<class T >
Returns the name of the enumeration constant that has the specified value.
- Parameters
-
value | The value of enum constant whose name is to be returned |
- Returns
- The name of the specified enum constant
◆ GetNames()
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
Returns an array containing names of all members of enumeration E
.
◆ GetUnderlyingType()
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
Returns the underlying type of the enumeration.
◆ GetValues()
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
Returns an array containing all members of enumeration E
.
◆ HasFlag()
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
static bool System::Enum< E, Guard >::HasFlag |
( |
E |
value, |
|
|
E |
mask |
|
) |
| |
|
inlinestatic |
Determines if the specified bits are set in a bitary representation of the specified enum value.
- Parameters
-
value | The enum value to test |
mask | The mask to check value's bits against |
- Returns
- True if bits that are set in
mask
are also set in value
, otherwise - false
◆ IsDefined() [1/3]
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
Determines whether the specified value is a member of enumeration type E
.
- Parameters
-
- Returns
- True if
value
is a member of enumeration E
, otherwise - false
◆ IsDefined() [2/3]
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
template<class T >
Determines whether the specified value is a member of enumeration type T
.
- Parameters
-
- Returns
- True if
value
is a member of enumeration T
, otherwise - false
◆ IsDefined() [3/3]
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
Determines if the value with the specified name is among members of enum E
.
- Parameters
-
- Returns
- True if a member of enum
E
with the specified name exists.
◆ Parse()
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
Converts the specfied string into equivalent enum constant.
- Parameters
-
str | String that is interpreted as containing the name of enum constant |
ignoreCase | Specifies if the case should be ignored when interpreting the string |
- Returns
- The enumeration constant whose name is specified in
str
- Exceptions
-
ArgumentException | If the enum constant with name specifed in str was not found aboung the members of enum E . |
◆ TryParse() [1/2]
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
Tries to convert the specified string into equivalent enum constant.
- Parameters
-
str | String that is interpreted as containing the name of enum constant |
result | The output parameter that if conversion succeeds contains the result of conversion on function |
- Returns
- True if conversion succeeded, otherwise - false
◆ TryParse() [2/2]
template<class E , class Guard = typename std::enable_if<std::is_enum<E>::value>::type>
static bool System::Enum< E, Guard >::TryParse |
( |
const String & |
str, |
|
|
bool |
ignoreCase, |
|
|
E & |
result |
|
) |
| |
|
inlinestatic |
Tries to convert the specified string into equivalent enum constant.
- Parameters
-
str | String that is interpreted as containing the name of enum constant |
ignoreCase | Specifies if the case should be ignored when interpreting the string |
result | The output parameter that if conversion succeeds contains the result of conversion on function return |
- Returns
- True if conversion succeeded, otherwise - false