13 #define DECLARE_ENUM_CLASS(ClassName, ...) \
14 class ClassName : public SmartEnumBase { \
16 enum Value { __VA_ARGS__ } value; \
17 const std::string &toString() { return toString(value); } \
18 static const std::string &toString(Value &v) { return getMap()[v]; } \
21 static std::map<Value, std::string> &getMap() { \
22 static const std::string str[] = {#__VA_ARGS__}; \
23 static const Value val[] = {__VA_ARGS__}; \
24 static std::map<Value, std::string> map; \
26 for (int i = 0; i < sizeof(val) / sizeof(Value); i++) \
27 map[val[i]] = str[i]; \
Definition: SmartEnum.hh:11