+#define ENUM_STRING_MAPPING(t, x) \
+ { \
+#x, t::x \
+ }
+
+#define ENUM_TYPE_FROM_STRING(structName, table) \
+ structName::Type structName::FromString(const char* s, size_t len) \
+ { \
+ std::string target(s, len); \
+ std::transform(target.begin(), target.end(), target.begin(), ::toupper); \
+ \
+ auto iFind = table.find(std::string_view(target.c_str(), len)); \
+ if(iFind != table.end()) \
+ { \
+ return iFind->second; \
+ } \
+ return structName::INVALID; \
+ }
+