#include <xtd/as>
#include <xtd/console>
#include <xtd/enum_class>
enum class enum_test {
value_one,
value_two,
value_three,
value_four
};
explicit operator auto()
const noexcept {
return xtd::enum_collection<enum_test> {{enum_test::value_one,
"value_one"}, {enum_test::value_two,
"value_two"}, {enum_test::value_three,
"value_three"}, {enum_test::value_four,
"value_four"}};}
};
auto main() -> int {
}
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
std::vector< std::pair< enum_t, xtd::string > > enum_collection
Represents a pair of an enum_t value and a string of an enum of type enum_t.
Definition enum_collection.hpp:24
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Provides the base class for enumerations.
Definition enum_object.hpp:48
The following code show how to use #include <xtd/as>
#include <xtd/console>
#include <xtd/enum_class>
enum class text_attribute {
bold = 0b1,
italic = 0b10,
underline = 0b100,
strikeout = 0b1000
};
text_attribute operator|(text_attribute lhs, text_attribute rhs) {return static_cast<text_attribute>(static_cast<std::underlying_type<text_attribute>::type>(lhs) | static_cast<std::underlying_type<text_attribute>::type>(rhs));}
};
explicit operator auto()
const noexcept {
return xtd::enum_collection<text_attribute> {{text_attribute::normal,
"normal"}, {text_attribute::bold,
"bold"}, {text_attribute::italic,
"italic"}, {text_attribute::underline,
"underline"}, {text_attribute::strikeout,
"strikeout"}};}
};
auto main() -> int {
}
@ flags
Enum flags attribute.
Definition enum_attribute.hpp:26
@ normal
Represent the exit mode when the terminates normally (via xtd::environment::exit or returning from th...
Definition exit_mode.hpp:20
Provides the set attribute struct for enumerations.
Definition enum_set_attribute.hpp:31