#include <xtd/as>
#include <xtd/console>
#include <xtd/enum_class>
 
 
enum class text_attribute {
  normal = 0b0,
  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 {
  console::write_line("name = {}", text_attribute::bold | text_attribute::italic);
  console::write_line(
"value = {}", 
enum_object(text_attribute::bold | text_attribute::italic).to_int32());
 
  console::write_line("as<int> = {}", as<int>(text_attribute::bold | text_attribute::italic));
}
Provides the base class for enumerations.
Definition enum_object.hpp: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.hpp:22
 
@ flags
Enum flags attribute.
 
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
 
Provides the registration struct for enumerations.
Definition enum_register.hpp:38
 
Provides the set attribute struct for enumerations.
Definition enum_set_attribute.hpp:31