22 #define ENUM_TYPE DEFINE_ENUM
25 #if !defined(ENUM_LIST) || !defined(ENUM_TYPE)
26 #error "In order to use MacroBasedEnum.h ENUM_LIST and DEFINE_ENUM must be defined"
30 #define CONCAT_SYMBOLS(LEFT, RIGHT) LEFT##RIGHT
31 #define QUOTE(NAME) #NAME
32 #define STR(MACRO) QUOTE(MACRO)
35 const char* CONCAT_SYMBOLS(ENUM_TYPE, ToString)(ENUM_TYPE value) {
37 #ifdef EXPLICIT_VALUE_ENUM
38 #define ENUM_VALUE(LABEL, VALUE) case ENUM_TYPE::LABEL: return #LABEL;
40 #define ENUM_VALUE(LABEL) case ENUM_TYPE::LABEL: return #LABEL;
52 std::ostream&
operator<<(std::ostream& out, ENUM_TYPE value) {
53 auto pLabel = CONCAT_SYMBOLS(ENUM_TYPE, ToString)(value);