Provides the base class for enumerations.
Public Aliases | |
using | enum_type = enum_t |
Represents the enumeration type. | |
using | value_type = enum_t |
Represents the enumeration type. | |
Public Properties | |
enum_type | value |
Gets or sets the value of the enum. | |
bool | has_flag (enum_type flag) const noexcept |
Retrieves an array of the values of the constants in a specified enumeration. | |
Public Constructors | |
enum_object () noexcept=default | |
Initializes a new instance of the xtd::enum_object class. | |
enum_object (enum_type value) | |
Initializes a new instance of the xtd::enum_object class with specified value. | |
Public Methods | |
int32 | compare_to (const enum_object &value) const noexcept override |
Compares the current instance with another object of the same type. | |
bool | equals (const object &obj) const noexcept override |
Determines whether the specified object is equal to the current object. | |
bool | equals (const enum_object &value) const noexcept override |
Determines whether the specified object is equal to the current object. | |
bool | equals (enum_type value) const noexcept |
Indicates whether the current object is equal to another object of the same type. | |
template<class attribute_t > | |
bool | equals (attribute_t value) const noexcept |
Indicates whether the current object is equal to another object with defferent type. | |
xtd::size | get_hash_code () const noexcept override |
Serves as a hash function for a particular type. | |
xtd::byte | to_byte () const noexcept |
Converts this instance to byte. | |
int16 | to_int16 () const noexcept |
Converts this instance to int16. | |
int32 | to_int32 () const noexcept |
Converts this instance to int32. | |
int64 | to_int64 () const noexcept |
Converts this instance to int64. | |
sbyte | to_sbyte () const noexcept |
Converts this instance to signed byte. | |
uint16 | to_uint16 () const noexcept |
Converts this instance to unsigned int16. | |
uint32 | to_uint32 () const noexcept |
Converts this instance to unsigned int32. | |
uint64 | to_uint64 () const noexcept |
Converts this instance to unsigned int64. | |
xtd::string | to_string () const noexcept override |
Returns a xtd::string that represents the current object. | |
xtd::string | to_string (const xtd::string &format) const |
Converts the value of this instance to its equivalent string representation using the specified format. | |
xtd::string | to_string (const xtd::string &format, const std::locale &loc) const override |
Converts the value of this instance to its equivalent string representation using the specified format, and locale. | |
Public Static Methods | |
static enum_type | parse (const xtd::string &str) |
Converts the string to its enum_type equivalent. | |
static enum_type | parse (const xtd::string &str, bool ignore_case) |
Converts the string to its enum_type equivalent with a specified boolean to ignore case. | |
Additional Inherited Members | |
![]() | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. | |
template<class object_t > | |
xtd::uptr< object_t > | memberwise_clone () const |
Creates a shallow copy of the current object. | |
![]() | |
virtual int32 | compare_to (const type_t &obj) const noexcept=0 |
Compares the current instance with another object of the same type. | |
![]() | |
virtual bool | equals (const type_t &) const noexcept=0 |
Indicates whether the current object is equal to another object of the same type. | |
![]() | |
![]() | |
template<class object_a_t , class object_b_t > | |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
template<class object_a_t , class object_b_t > | |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are the same instance. | |
using xtd::enum_object< enum_t >::enum_type = enum_t |
Represents the enumeration type.
using xtd::enum_object< enum_t >::value_type = enum_t |
Represents the enumeration type.
|
defaultnoexcept |
Initializes a new instance of the xtd::enum_object class.
|
inlineexplicit |
Initializes a new instance of the xtd::enum_object class with specified value.
value | Value to set to this instance. |
|
inlinenoexcept |
Retrieves an array of the values of the constants in a specified enumeration.
flag | An enumeration value. |
true
if the bit field or bit fields that are set in flag are also set in the current instance; otherwise, false
.
|
inlineoverridenoexcept |
Compares the current instance with another object of the same type.
value | An object to compare with this instance. |
Value | Condition |
---|---|
Less than zero | This instance is less than obj. |
Zero | This instance is equal to obj. |
Greater than zero | This instance is greater than obj. |
|
inlineoverridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
obj | The object to compare with the current object. |
true
if the specified object is equal to the current object. otherwise, false
. Reimplemented from xtd::object.
|
inlineoverridenoexcept |
Determines whether the specified object is equal to the current object.
obj | The object to compare with the current object. |
true
if the specified object is equal to the current object. otherwise, false
.
|
inlinenoexcept |
Indicates whether the current object is equal to another object of the same type.
obj | An object to compare with this object. |
true
if the current object is equal to the other parameter; otherwise, false
.
|
inlinenoexcept |
Indicates whether the current object is equal to another object with defferent type.
obj | An object to compare with this object. |
false
.
|
inlineoverridevirtualnoexcept |
Serves as a hash function for a particular type.
Reimplemented from xtd::object.
|
inlinenoexcept |
Converts this instance to byte.
|
inlinenoexcept |
Converts this instance to int16.
|
inlinenoexcept |
Converts this instance to int32.
|
inlinenoexcept |
Converts this instance to int64.
|
inlinenoexcept |
Converts this instance to signed byte.
|
inlinenoexcept |
Converts this instance to unsigned int16.
|
inlinenoexcept |
Converts this instance to unsigned int32.
|
inlinenoexcept |
Converts this instance to unsigned int64.
|
inlineoverridevirtualnoexcept |
Returns a xtd::string that represents the current object.
Reimplemented from xtd::object.
|
inline |
Converts the value of this instance to its equivalent string representation using the specified format.
format | A format string. |
xtd::format_exception | format contains an invalid specification. |
|
overridevirtual |
Converts the value of this instance to its equivalent string representation using the specified format, and locale.
format | A format string. |
loc | An std::locale object that contains locale information (see std::locale). |
xtd::format_exception | format contains an invalid specification. |
Implements xtd::iformatable.
|
inlinestatic |
Converts the string to its enum_type
equivalent.
value | A string containing a enum_type to convert. |
enum_type
equivalent to the native value contained in value.
|
inlinestatic |
Converts the string to its enum_type
equivalent with a specified boolean to ignore case.
value | A string containing a enum_type to convert. |
ignore_case | 'trueto ingore case; otherwise false. @return A enum_type` equivalent to the native value contained in value. |
enum_type xtd::enum_object< enum_t >::value |
Gets or sets the value of the enum.
value | The value of the enum. |