From 5041e67cf4ee111e9e5f14a9e06f0a598b3eb9ac Mon Sep 17 00:00:00 2001 From: "HoĆ  V. DINH" Date: Mon, 24 Nov 2014 23:43:39 -0800 Subject: Fixed className() on win32. --- src/core/basetypes/MCObject.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/core/basetypes/MCObject.cpp b/src/core/basetypes/MCObject.cpp index 7c1d83bb..fbb7cb68 100644 --- a/src/core/basetypes/MCObject.cpp +++ b/src/core/basetypes/MCObject.cpp @@ -93,6 +93,10 @@ String * Object::className() int status; #ifdef _MSC_VER String * result = String::uniquedStringWithUTF8Characters(typeid(*this).name()); + // typeid(*this).name() will return "class mailcore::Object". Therefore, we'll strip the prefix "class " from it. + if (result->hasPrefix(MCSTR("class "))) { + result = result->substringFromIndex(6); + } #else char * unmangled = abi::__cxa_demangle(typeid(* this).name(), NULL, NULL, &status); String * result = String::uniquedStringWithUTF8Characters(unmangled); -- cgit v1.2.3