Created
June 19, 2013 01:43
-
-
Save borisbat/5811081 to your computer and use it in GitHub Desktop.
class name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename ObjectType> | |
string TYPE_NAME() | |
{ | |
// determine type name from typeid | |
// note - if this ever failes, we can always go constexpr route, i.e | |
// constexpr static const char * TYPE_NAME() { return "ClassNameHere"; }; | |
// and maybe even try to parse __FUNCTION__ inside of it somehow | |
regex REG_class_name ( "N\\d*war\\d*(.+)E" ); | |
smatch what; | |
if ( !regex_match( string(typeid(ObjectType).name()), what, REG_class_name) ) | |
{ | |
Log() << "ERROR: AtAppInitialize level class is " << typeid(ObjectType).name() << endl; | |
assert(0 && "revisit class parser"); | |
} | |
return what[1]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment