template<typename enum_t>
struct xtd::enum_register< enum_t >
Provides the registration struct for enumerations.
template<typename enum_t>
Provides the registration struct for enumerations.
Definition enum_register.h:38
- Header
#include <xtd/enum_register>
- Namespace
- xtd
- Library
- xtd.core
- Examples
- The following code show how to use xtd::enum_register operator for an enum.
#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...
Provides the base class for enumerations.
Definition enum_object.h:42
std::vector< xtd::collections::generic::key_value_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.h:22
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
The following code show how to use xtd::enum_register operator for an enum flags. #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.
@ normal
Represent the exit mode when the terminates normally (via xtd::environment::exit or returning from th...
Provides the set attribute struct for enumerations.
Definition enum_set_attribute.h:31
- Examples
- enum_class_flags_without_helpers.cpp, enum_class_without_helper.cpp, format_enum.cpp, format_enum_class.cpp, format_enum_class_flags.cpp, format_enum_class_flags_without_helper.cpp, sprintf_enum.cpp, and sprintf_enum_class.cpp.