16 #include "fwCore/Demangler.hpp" 21 #define COLONS std::string("::") 22 #define LT std::string("<") 48 std::string demangled(this->
demangle());
50 const size_t lt_pos = demangled.find(LT);
51 size_t colons_pos = demangled.rfind(COLONS, lt_pos);
53 colons_pos = (colons_pos == std::string::npos) ? 0 : colons_pos+COLONS.size();
54 return demangled.replace(0, colons_pos,
"");
61 const std::string demangled(this->
demangle());
62 return COLONS + demangled;
69 const char* mangled =
m_name.c_str();
71 char* c_demangled = abi::__cxa_demangle( mangled, 0, 0, 0);
85 static std::vector<std::string> keywords;
86 typedef std::vector<std::string>::iterator keyword_iterator;
87 if ( keywords.empty() )
89 keywords.push_back(
"__cdecl");
90 keywords.push_back(
"class ");
91 keywords.push_back(
"enum ");
92 keywords.push_back(
"struct ");
93 keywords.push_back(
"union ");
95 std::string res(mangled);
96 for (keyword_iterator iter = keywords.begin(); iter != keywords.end(); ++iter )
98 while (res.find(*iter) != std::string::npos)
100 res = res.replace(res.find(*iter), iter->size(),
"");
102 while (res.find(
" *") != std::string::npos)
104 res = res.replace(res.find(
" *"), 2,
"*");
106 while (res.find(
" &") != std::string::npos)
108 res = res.replace(res.find(
" &"), 2,
"&");
FWCORE_API std::string getClassname() const
Returns "::some::long::namespace::Object" from "::some::long::namespace::Object". ...
This namespace fwCore provides common foundations for FW4SPL.
virtual FWCORE_API ~Demangler()
Destructor.
FWCORE_API Demangler(const std::type_info &t)
Constructor from a typeinfo object.
FWCORE_API std::string getLeafClassname() const
Returns "Object" from "::some::long::namespace::Object".
std::string demangle() const
Process the name to demangle and return the same string whatever the OS is.
const std::string m_name
Store the name to demangle.