24std::string clean_allocator (std::string f)
26 std::string::size_type ipos = 0;
27 while ((ipos =
f.find (
", std::allocator", ipos)) != std::string::npos) {
28 const char*
p =
f.c_str() + ipos + 16;
29 while (isspace (*p)) ++
p;
33 while (nest > 0 && *p) {
41 if (ipos > 0 && f[ipos-1] !=
'>') {
42 while (isspace (*p)) ++
p;
44 f.erase (ipos, p-
f.c_str()-ipos);
54std::string munge_string_name (
const std::string& str_in)
56 std::string
s = str_in;
58 std::string::size_type ipos = 0;
59 while ((ipos =
s.find (
"std::basic_string<", ipos)) != std::string::npos) {
60 std::string::size_type
beg = ipos;
63 while (inest > 0 && ipos <
s.size()) {
64 if (s[ipos] ==
'<') ++inest;
65 else if (s[ipos] ==
'>') --inest;
68 s.replace (beg, ipos-beg,
"std::string");
72 for (
size_t i = 0;
i <
s.size();
i++) {
73 if ((i == 0 || (s[i-1] !=
':' && !isalnum(s[i-1]))) &&
74 strncmp (
s.c_str()+i,
"string", 6) == 0 &&
77 s.replace (i, 6,
"std::string");
84std::string munge_punct (
const std::string& str_in)
86 std::string
s = str_in;
87 for (
size_t i = 0;
i <
s.size()-1;
i++) {
88 if (s[i] ==
' ' && (s[i+1] ==
'*' || s[i+1] ==
'&'))
95std::string do_replace (std::string s,
96 const std::string& pat,
97 const std::string& rep)
99 std::string::size_type ipos = 0;
100 while ((ipos =
s.find (pat, ipos)) != std::string::npos)
101 s.replace (ipos,
pat.size(), rep);
106std::string munge_names (
const std::string& str_in)
109 do_replace (str_in,
"SG::DataProxyStorageData::pointer",
"void*");
110 s = do_replace (s,
"DPSD::pointer",
"void*");
111 s = do_replace (s,
"SG::auxid_t",
"unsigned long");
112 s = do_replace (s,
"auxid_t",
"unsigned long");
113 s = do_replace (s,
"void* ",
"void*");
114 s = do_replace (s,
"CLID",
"unsigned int");
116 if (
s.compare (0, 8,
"virtual ") == 0)
137 return munge_names (munge_punct (munge_string_name (clean_allocator (fname))));
std::string normalizeFunctionName(const std::string &fname)
Normalize a pretty-printed C++ function name.
Normalize a pretty-printed C++ function name,.