21 namespace std {}
using namespace std;
30 if (name.compare(0,5,
"std::")==0) {
35 if (gInterpreterHelper) {
36 for(
size_t i = 5; i < name.length(); ++i) {
37 if (name[i] ==
'<')
break;
40 std::string scope(name.data(),i);
41 std::string scoperesult;
44 static std::set<std::string> gInlined;
46 if (gInlined.find(scope) != gInlined.end()) {
48 if (i+1<name.length() && name[i+1]==
':') {
52 if (!gInterpreterHelper->ExistingTypeCheck(scope, scoperesult)
53 && gInterpreterHelper->IsDeclaredScope(scope,isInlined)) {
55 gInlined.insert(scope);
57 if (i+1<name.length() && name[i+1]==
':') {
76 size_t len =
StdLen({name.data()+pos,name.length()-pos});
90 name.remove_prefix(len);
98 if (0 == strncmp(clName,
"complex<", 8)) {
99 const char *clNamePlus8 = clName + 8;
100 if (0 == strcmp(
"float>", clNamePlus8)) {
101 return EComplexType::kFloat;
103 if (0 == strcmp(
"double>", clNamePlus8)) {
104 return EComplexType::kDouble;
106 if (0 == strcmp(
"int>", clNamePlus8)) {
107 return EComplexType::kInt;
109 if (0 == strcmp(
"long>", clNamePlus8)) {
110 return EComplexType::kLong;
120 gInterpreterHelper = helper;
156 if (fElements[0].empty())
return 0;
157 int numb = fElements.size();
158 if (!fElements[numb-1].empty() && fElements[numb-1][0]==
'*') --numb;
160 if ( fNestedLocation ) {
166 int kind =
STLKind(fElements[0]);
171 if (testAlloc && (numb-1 > nargs) && !
IsDefAlloc(fElements[numb-1].c_str(),fElements[1].c_str())) {
183 if (k<0) kind = -kind;
189 if(kind>2) kind = - kind;
209 int narg = fElements.size();
220 if (fElements[narg-1].empty() ==
false &&
221 (fElements[narg-1][0]==
'*'
222 || fElements[narg-1][0]==
'&'
223 || fElements[narg-1][0]==
'['
224 || 0 == fElements[narg-1].
compare(0,6,
"const*")
225 || 0 == fElements[narg-1].
compare(0,6,
"const&")
226 || 0 == fElements[narg-1].
compare(0,6,
"const[")
227 || 0 == fElements[narg-1].
compare(
"const")
230 if ((mode&1)==0) tailLoc = narg-1;
232 else {
assert(fElements[narg-1].empty()); };
236 if (fNestedLocation) narg--;
241 const int kind =
STLKind(fElements[0]);
242 const int iall =
STLArgs(kind);
246 while(narg-1>iall) { fElements.pop_back(); narg--;}
247 if (!fElements[0].empty() && tailLoc) {
250 fElements[0].clear();
258 bool allocRemoved =
false;
264 if (narg-1 == iall+1) {
266 bool dropAlloc =
false;
281 dropAlloc =
IsDefAlloc(fElements[iall+1].c_str(),fElements[1].c_str());
287 dropAlloc =
IsDefAlloc(fElements[iall+1].c_str(),fElements[1].c_str(),fElements[2].c_str());
304 if ( allocRemoved && (mode & kDropStlDefault) && narg-1 == iall) {
305 if (
IsDefComp( fElements[iall].c_str(), fElements[1].c_str() ) ) {
320 if (!allocRemoved && narg-1 == iall+1) {
324 if (narg-1 == iall) narg--;
347 bool predRemoved =
false;
349 if ( allocRemoved && (mode & kDropStlDefault) && narg-1 == iall) {
350 if (
IsDefPred( fElements[iall].c_str(), fElements[1].c_str() ) ) {
356 if ( predRemoved && (mode & kDropStlDefault) && narg == iall) {
357 if (
IsDefHash( fElements[iall-1].c_str(), fElements[1].c_str() ) ) {
364 if ( (mode & kDropStlDefault) && (narg >= 3)) {
365 unsigned int offset = (0==strncmp(
"const ",fElements[0].c_str(),6)) ? 6 : 0;
366 offset += (0==strncmp(
"std::",fElements[0].c_str()+offset,5)) ? 5 : 0;
367 if (0 == strcmp(fElements[0].c_str()+offset,
"__shared_ptr"))
369 #ifdef _CONCURRENCE_H
370 static const std::string sharedPtrDef = std::to_string(__gnu_cxx::__default_lock_policy);
372 static const std::string sharedPtrDef = std::to_string(2);
374 if (fElements[2] == sharedPtrDef) {
382 for (
int i=1;i<narg; i++) {
383 if (strchr(fElements[i].c_str(),
'<')==0) {
385 unsigned int offset = (0==strncmp(
"const ",fElements[i].c_str(),6)) ? 6 : 0;
399 if (gInterpreterHelper->ExistingTypeCheck(fElements[i], typeresult)
400 || gInterpreterHelper->GetPartiallyDesugaredNameWithScopeHandling(fElements[i], typeresult)) {
401 if (!typeresult.empty()) fElements[i] = typeresult;
406 unsigned int tailOffset = 0;
407 if (tailLoc && fElements[tailLoc].
compare(0,5,
"const") == 0) {
411 if (!fElements[0].empty()) {answ += fElements[0]; answ +=
"<";}
419 if (mode & kDropAllDefault) {
420 int nargNonDefault = 0;
421 std::string nonDefName = answ;
423 std::string nameSuperLong = fName;
424 if (gInterpreterHelper)
425 gInterpreterHelper->GetPartiallyDesugaredName(nameSuperLong);
426 while (++nargNonDefault < narg) {
429 const char* closeTemplate =
" >";
430 if (nonDefName[nonDefName.length() - 1] !=
'>')
432 string nondef = nonDefName + closeTemplate;
433 if (gInterpreterHelper &&
434 gInterpreterHelper->IsAlreadyPartiallyDesugaredName(nondef, nameSuperLong))
436 if (nargNonDefault>1) nonDefName +=
",";
437 nonDefName += fElements[nargNonDefault];
439 if (nargNonDefault < narg)
440 narg = nargNonDefault;
444 {
for (
int i=1;i<narg-1; i++) { answ += fElements[i]; answ+=
",";} }
445 if (narg>1) { answ += fElements[narg-1]; }
447 if (!fElements[0].empty()) {
448 if ( answ.at(answ.size()-1) ==
'>') {
454 if (fNestedLocation) {
457 answ += fElements[fNestedLocation];
460 if (tailLoc) answ += fElements[tailLoc].c_str()+tailOffset;
470 if (type.compare(0,6,
"const ")==0) { offset += 6; }
471 offset +=
StdLen(type.substr(offset));
474 static const char *stls[] =
475 {
"any",
"vector",
"list",
"deque",
"map",
"multimap",
"set",
"multiset",
"bitset",
476 "forward_list",
"unordered_set",
"unordered_multiset",
"unordered_map",
"unordered_multimap", 0};
477 static const size_t stllen[] =
478 { 3, 6, 4, 5, 3, 8, 3, 8, 6,
479 12, 13, 18, 13, 18, 0};
494 auto len = type.length();
497 for(
int k=1;stls[k];k++) {
498 if (len == stllen[k]) {
499 if (type.compare(offset,len,stls[k])==0)
return values[k];
503 for(
int k=1;stls[k];k++) {
if (type.compare(offset,len,stls[k])==0)
return values[k];}
513 static const char stln[] =
515 { 1, 1, 1, 1, 3, 3, 2, 2, 1,
527 for(
size_t i = 0; i < full.length(); ++i) {
529 case '<': { ++level;
break; }
531 if (level == 0)
return i;
536 if (level == 0)
return i;
542 return full.length();
549 return pos +
findNameEnd( {full.data()+pos,full.length()-pos} );
561 if (a==
"alloc")
return true;
562 if (a==
"__default_alloc_template<true,0>")
return true;
563 if (a==
"__malloc_alloc_template<0>")
return true;
565 const static int alloclen = strlen(
"allocator<");
566 if (a.
compare(0,alloclen,
"allocator<") != 0) {
580 std::string valuepart;
583 std::string norm_value;
586 if (valuepart != norm_value) {
606 const char *keyclassname,
607 const char *valueclassname)
609 if (
IsDefAlloc(allocname,keyclassname))
return true;
614 const static int alloclen = strlen(
"allocator<");
615 if (a.
compare(0,alloclen,
"allocator<") != 0) {
622 const static int pairlen = strlen(
"pair<");
623 if (a.
compare(0,pairlen,
"pair<") != 0) {
628 const static int constlen = strlen(
"const ");
629 if (a.
compare(0,constlen,
"const ") == 0) {
645 std::string norm_key;
648 if (keypart != norm_key) {
649 if ( k[k.
length()-1] ==
'*' ) {
652 if (keypart != norm_key) {
677 std::string valuepart;
680 std::string norm_value;
683 if (valuepart != norm_value) {
702 static bool IsDefElement(
const char *elementName,
const char* defaultElementName,
const char *classname)
704 string c = elementName;
708 const int elementlen = strlen(defaultElementName);
709 if (c.compare(pos,elementlen,defaultElementName) != 0) {
714 string k = classname;
715 if (c.compare(pos,k.length(),k) != 0) {
722 std::string norm_key;
725 if (keypart != norm_key) {
733 if (c.compare(pos,1,
">")!=0 && c.compare(pos,2,
" >")!=0) {
779 norm_name = std::string(name);
788 if (norm_name.length()>2 && norm_name[0]==
':' && norm_name[1]==
':') {
789 norm_name.erase(0,2);
792 if (gInterpreterHelper) {
794 std::string typeresult;
795 if (gInterpreterHelper->ExistingTypeCheck(norm_name, typeresult)
796 || gInterpreterHelper->GetPartiallyDesugaredNameWithScopeHandling(norm_name, typeresult)) {
798 if (!typeresult.empty()) norm_name = typeresult;
819 static const char* longlong_s =
"long long";
820 static const char* ulonglong_s =
"unsigned long long";
821 static const unsigned int longlong_len = strlen(longlong_s);
822 static const unsigned int ulonglong_len = strlen(ulonglong_s);
827 while( (pos = result.find(ulonglong_s,pos) ) >=0 ) {
828 result.replace(pos, ulonglong_len,
"ULong64_t");
831 while( (pos = result.find(longlong_s,pos) ) >=0 ) {
832 result.replace(pos, longlong_len,
"Long64_t");
842 const char *lastPos = original;
845 for(
auto cursor = original; *cursor !=
'\0'; ++cursor) {
846 if ( *cursor ==
'<' || *cursor ==
'(') ++depth;
847 else if ( *cursor ==
'>' || *cursor ==
')' ) --depth;
848 else if ( *cursor ==
':' ) {
849 if (depth==0 && *(cursor+1) ==
':' && *(cursor+2) !=
'\0') {
864 const char *
t = full.c_str();
865 const unsigned int tlen( full.size() );
867 const char *starloc = t + tlen - 1;
868 bool hasconst =
false;
870 && (starloc-
t) > 4 && 0 == strncmp((starloc-4),
"const",5)
871 && ( (*(starloc-5)) ==
' ' || (*(starloc-5)) ==
'*' || (*(starloc-5)) ==
'&'
872 || (*(starloc-5)) ==
'>' || (*(starloc-5)) ==
']') ) {
875 if ((*starloc-1)==
' ') {
881 if ( hasconst || (*starloc)==
'*' || (*starloc)==
'&' || (*starloc)==
']' ) {
882 bool isArray = ( (*starloc)==
']' );
883 while( t<=(starloc-1) && ((*(starloc-1))==
'*' || (*(starloc-1))==
'&' || (*(starloc-1))==
't' || isArray)) {
886 isArray = ! ( (*starloc)==
'[' );
887 }
else if ( (*(starloc-1))==
't' ) {
888 if ( (starloc-1-t) > 5 && 0 == strncmp((starloc-5),
"const",5)
889 && ( (*(starloc-6)) ==
' ' || (*(starloc-6)) ==
'*' || (*(starloc-6)) ==
'&'
890 || (*(starloc-6)) ==
'>' || (*(starloc-6)) ==
']')) {
901 if ((*(starloc-1))==
' ') {
906 const unsigned int starlen = strlen(starloc);
907 full.erase(tlen-starlen,starlen);
908 }
else if (hasconst) {
910 const unsigned int starlen = strlen(starloc);
911 full.erase(tlen-starlen,starlen);
931 if (strlen(type)==0)
return 0;
933 int cleantypeMode = 1 ;
942 unsigned int const_offset = (0==strncmp(
"const ",full.c_str(),6)) ? 6 : 0;
943 bool isString =
false;
944 bool isStdString =
false;
945 static const char* basic_string_std =
"std::basic_string<char";
946 static const unsigned int basic_string_std_len = strlen(basic_string_std);
948 if (full.compare(const_offset,basic_string_std_len,basic_string_std) == 0
949 && full.size() > basic_string_std_len) {
952 }
else if (full.compare(const_offset,basic_string_std_len-5,basic_string_std+5) == 0
953 && full.size() > (basic_string_std_len-5)) {
958 size_t offset = isStdString ? basic_string_std_len : basic_string_std_len - 5;
959 offset += const_offset;
960 if ( full[offset] ==
'>' ) {
962 }
else if (full[offset] ==
',') {
964 if (full.compare(offset, 5,
"std::") == 0) {
967 static const char* char_traits_s =
"char_traits<char>";
968 static const unsigned int char_traits_len = strlen(char_traits_s);
969 if (full.compare(offset, char_traits_len, char_traits_s) == 0) {
970 offset += char_traits_len;
971 if ( full[offset] ==
'>') {
973 }
else if (full[offset] ==
' ' && full[offset+1] ==
'>') {
976 }
else if (full[offset] ==
',') {
978 if (full.compare(offset, 5,
"std::") == 0) {
981 static const char* allocator_s =
"allocator<char>";
982 static const unsigned int allocator_len = strlen(allocator_s);
983 if (full.compare(offset, allocator_len, allocator_s) == 0) {
984 offset += allocator_len;
985 if ( full[offset] ==
'>') {
987 }
else if (full[offset] ==
' ' && full[offset+1] ==
'>') {
1008 output.push_back(
string());
1009 if (const_offset && (mode & kKeepOuterConst)) {
1010 if (isStdString && !(mode &
kDropStd)) {
1011 output.push_back(
"const std::string");
1013 output.push_back(
"const string");
1016 if (isStdString && !(mode &
kDropStd)) {
1017 output.push_back(
"std::string");
1019 output.push_back(
"string");
1022 if (offset < full.length()) {
1025 string right( full.substr(offset) );
1028 output.back().append(right.c_str()+1);
1029 output.push_back(stars);
1031 output.push_back(
"");
1033 return output.size();
1039 unsigned int offset = (0==strncmp(
"const ",full.c_str(),6)) ? 6 : 0;
1044 if ( !full.empty() ) {
1048 const char *
c = strchr(full.c_str(),
'<');
1051 output.push_back(
string(full,0,c - full.c_str()));
1055 for(cursor = c + 1; *cursor !=
'\0' && !(level==0 && *cursor ==
'>'); ++cursor) {
1057 case '<': ++level;
break;
1058 case '>': --level;
break;
1061 output.push_back(std::string(c+1,cursor));
1068 if (*(cursor-1) ==
' ') {
1069 output.push_back(std::string(c+1,cursor-1));
1071 output.push_back(std::string(c+1,cursor));
1074 if (*(cursor+1)==
':') {
1077 nestedLoc = output.size();
1078 output.push_back((cursor+1));
1080 }
else if (level >= 0) {
1082 output.push_back(std::string(c+1,cursor));
1086 output.push_back(
string());
1087 output.push_back(full);
1090 if (!output.empty()) output.push_back(stars);
1091 return output.size();
1113 static const char*
remove[] = {
"class",
"const",
"volatile",0};
1114 static bool isinit =
false;
1115 static std::vector<size_t> lengths;
1117 for (
int k=0;
remove[k]; ++k) {
1118 lengths.push_back(strlen(
remove[k]));
1124 result.reserve(strlen(typeDesc)*2);
1128 for(c=typeDesc;*
c;c++) {
1131 if (!isalnum(c[ 1]) && c[ 1] !=
'_')
continue;
1133 if (kbl && (mode>=2 || lev==0)) {
1135 int n = (mode) ? 999 : 1;
1138 for (
int k=0; k<n &&
remove[k]; k++) {
1139 int rlen = lengths[k];
1142 if (strncmp(
remove[k],c,rlen))
continue;
1145 if (isalnum(c[rlen]) || c[rlen]==
'_' || c[rlen]==
'$')
continue;
1147 c+=rlen-1; done = 1;
break;
1152 kbl = (!isalnum(c[ 0]) && c[ 0]!=
'_' && c[ 0]!=
'$' && c[0]!=
'[' && c[0]!=
']' && c[0]!=
'-' && c[0]!=
'@');
1156 if (*c ==
'<' || *c ==
'(') lev++;
1157 if (lev==0 && !isalnum(*c)) {
1158 if (!strchr(
"*&:._$ []-@",*c))
break;
1162 if (c[0]==
'>' && result.size() && result[result.size()-1]==
'>') result+=
" ";
1166 if (*c ==
'>' || *c ==
')') lev--;
1203 size_t len = strlen(type);
1204 if (len < 2 || strncmp(type+len-2,
"_t",2) != 0)
return false;
1206 unsigned char offset = 0;
1207 if (strncmp(type,
"const ",6)==0) { offset += 6; }
1208 static const char *names[] = {
"CallFunc_t",
"ClassInfo_t",
"BaseClassInfo_t",
1209 "DataMemberInfo_t",
"FuncTempInfo_t",
"MethodInfo_t",
"MethodArgInfo_t",
1210 "TypeInfo_t",
"TypedefInfo_t",0};
1212 for(
int k=1;names[k];k++) {
if (strcmp(type+offset,names[k])==0)
return true;}
1222 if ( strncmp(classname+offset,
"bitset<",strlen(
"bitset<"))==0)
return true;
1240 if (type.compare(0,6,
"const ",6) == 0)
1241 type.remove_prefix(6);
1243 while(type[type.length()-1]==
'*' ||
1244 type[type.length()-1]==
'&' ||
1245 type[type.length()-1]==
' ') {
1246 type.remove_suffix(1);
1259 auto pos = type.find(
'<');
1263 for (decltype(type.length()) level = 1;
c < type.length(); ++
c) {
1264 if (type[
c] ==
'<') ++level;
1265 if (type[
c] ==
'>') --level;
1266 if (level == 0)
break;
1268 if (
c != (type.length()-1) ) {
1272 return STLKind({type.data(),pos});
1288 if (strchr(type,
'<')==0)
return 0;
1299 classname +=
StdLen( classname );
1300 if ( strcmp(classname,
"string")==0 )
return true;
1301 if ( strncmp(classname,
"bitset<",strlen(
"bitset<"))==0)
return true;
1302 if ( strncmp(classname,
"pair<",strlen(
"pair<"))==0)
return true;
1303 if ( strcmp(classname,
"allocator")==0)
return true;
1304 if ( strncmp(classname,
"allocator<",strlen(
"allocator<"))==0)
return true;
1305 if ( strncmp(classname,
"greater<",strlen(
"greater<"))==0)
return true;
1306 if ( strncmp(classname,
"less<",strlen(
"less<"))==0)
return true;
1307 if ( strncmp(classname,
"equal_to<",strlen(
"equal_to<"))==0)
return true;
1308 if ( strncmp(classname,
"hash<",strlen(
"hash<"))==0)
return true;
1309 if ( strncmp(classname,
"auto_ptr<",strlen(
"auto_ptr<"))==0)
return true;
1311 if ( strncmp(classname,
"vector<",strlen(
"vector<"))==0)
return true;
1312 if ( strncmp(classname,
"list<",strlen(
"list<"))==0)
return true;
1313 if ( strncmp(classname,
"forward_list<",strlen(
"forward_list<"))==0)
return true;
1314 if ( strncmp(classname,
"deque<",strlen(
"deque<"))==0)
return true;
1315 if ( strncmp(classname,
"map<",strlen(
"map<"))==0)
return true;
1316 if ( strncmp(classname,
"multimap<",strlen(
"multimap<"))==0)
return true;
1317 if ( strncmp(classname,
"set<",strlen(
"set<"))==0)
return true;
1318 if ( strncmp(classname,
"multiset<",strlen(
"multiset<"))==0)
return true;
1319 if ( strncmp(classname,
"unordered_set<",strlen(
"unordered_set<"))==0)
return true;
1320 if ( strncmp(classname,
"unordered_multiset<",strlen(
"unordered_multiset<"))==0)
return true;
1321 if ( strncmp(classname,
"unordered_map<",strlen(
"unordered_map<"))==0)
return true;
1322 if ( strncmp(classname,
"unordered_multimap<",strlen(
"unordered_multimap<"))==0)
return true;
1323 if ( strncmp(classname,
"bitset<",strlen(
"bitset<"))==0)
return true;
1342 unsigned int cursor,
1344 unsigned int start_of_type,
1345 unsigned int end_of_type,
1346 unsigned int mod_start_of_type,
1350 std::string
type(modified && (mod_start_of_type < result.length()) ?
1351 result.substr(mod_start_of_type, string::npos)
1352 : string(tname, start_of_type, end_of_type == 0 ? cursor - start_of_type : end_of_type - start_of_type));
1354 if (gInterpreterHelper->ExistingTypeCheck(
type, typeresult)
1355 || gInterpreterHelper->GetPartiallyDesugaredNameWithScopeHandling(
type, typeresult)) {
1357 if (!typeresult.empty()) {
1360 result.replace(mod_start_of_type, string::npos,
1365 mod_start_of_type = start_of_type;
1366 result += string(tname,0,start_of_type);
1367 if (constprefix && typeresult.compare(0,6,
"const ",6) == 0) {
1368 result += typeresult.substr(6,string::npos);
1370 result += typeresult;
1373 }
else if (modified) {
1374 result.replace(mod_start_of_type, string::npos,
1378 if (end_of_type != 0 && end_of_type!=cursor) {
1379 result += std::string(tname,end_of_type,cursor-end_of_type);
1386 if (end_of_type != 0 && end_of_type!=cursor) {
1387 result += std::string(tname,end_of_type,cursor-end_of_type);
1397 unsigned int &cursor,
1406 bool constprefix =
false;
1408 if (tname[cursor]==
' ') {
1411 result += string(tname,0,cursor);
1413 while (tname[cursor]==
' ') ++cursor;
1416 if (tname[cursor]==
'c' && (cursor+6<len)) {
1417 if (strncmp(tname+cursor,
"const ",6) == 0) {
1419 if (modified) result +=
"const ";
1427 if (len > 5 && strncmp(tname+cursor,
"std::",5) == 0) {
1430 if (len > 2 && strncmp(tname+cursor,
"::",2) == 0) {
1435 unsigned int start_of_type = cursor;
1436 unsigned int end_of_type = 0;
1437 unsigned int mod_start_of_type = result.length();
1438 unsigned int prevScope = cursor;
1439 for ( ; cursor<len; ++cursor) {
1440 switch (tname[cursor]) {
1442 if ((cursor+1)>=len || tname[cursor+1]!=
':') {
1444 if (modified) result += (tname+prevScope);
1449 scope = result.substr(mod_start_of_type, string::npos);
1450 scope += std::string(tname+prevScope,cursor-prevScope);
1452 scope = std::string(tname, start_of_type, cursor - start_of_type);
1454 std::string scoperesult;
1455 bool isInlined =
false;
1456 if (gInterpreterHelper->ExistingTypeCheck(scope, scoperesult)
1457 ||gInterpreterHelper->GetPartiallyDesugaredNameWithScopeHandling(scope, scoperesult)) {
1459 if (!scoperesult.empty()) {
1462 if (constprefix && scoperesult.compare(0,6,
"const ",6) != 0) mod_start_of_type -= 6;
1463 result.replace(mod_start_of_type, string::npos,
1468 mod_start_of_type = start_of_type;
1469 result += string(tname,0,start_of_type);
1471 result += scoperesult;
1474 }
else if (modified) {
1475 result += std::string(tname+prevScope,cursor+1-prevScope);
1477 }
else if (!gInterpreterHelper->IsDeclaredScope(scope,isInlined)) {
1479 if (modified) result += (tname+prevScope);
1483 }
else if (isInlined) {
1487 mod_start_of_type = start_of_type;
1488 result += string(tname,0,start_of_type);
1490 result += string(tname,start_of_type,prevScope - start_of_type);
1492 }
else if (modified) {
1493 result += std::string(tname+prevScope,cursor+1-prevScope);
1497 prevScope = cursor+1;
1503 result += std::string(tname+prevScope,cursor+1-prevScope);
1509 }
while( cursor<len && tname[cursor] ==
',' );
1511 while (cursor<len && tname[cursor+1]==
' ') ++cursor;
1516 if (cursor+2<len && tname[cursor+1]==
':' && tname[cursor+2]==
':') {
1517 if (modified) result +=
"::";
1519 prevScope = cursor+1;
1521 if ( (cursor+1)<len && tname[cursor+1] ==
',') {
1523 if (modified) result +=
',';
1526 if ( (cursor+1)<len && tname[cursor+1] ==
'>') {
1528 if (modified) result +=
" >";
1531 if ( (cursor+1) >= len) {
1534 if (tname[cursor] !=
' ')
break;
1535 if (modified) prevScope = cursor+1;
1542 end_of_type = cursor;
1544 while ((cursor+1)<len && tname[cursor+1] ==
' ') ++cursor;
1546 auto next = cursor+1;
1547 if (strncmp(tname+
next,
"const",5) == 0 && ((
next+5)==len || tname[
next+5] ==
' ' || tname[
next+5] ==
'*' || tname[
next+5] ==
'&' || tname[
next+5] ==
',' || tname[
next+5] ==
'>' || tname[
next+5] ==
']'))
1552 result += string(tname,0,start_of_type);
1554 mod_start_of_type = start_of_type + 6;
1555 result += string(tname,start_of_type,end_of_type-start_of_type);
1556 }
else if (mod_start_of_type < result.length()) {
1557 result.insert(mod_start_of_type,
"const ");
1558 mod_start_of_type += 6;
1561 mod_start_of_type += 6;
1562 result += string(tname,start_of_type,end_of_type-start_of_type);
1565 end_of_type = cursor+1;
1566 prevScope = end_of_type;
1567 if (tname[
next+5] ==
',' || tname[
next+5] ==
'>' || tname[
next+5] ==
'[') {
1570 }
else if (
next!=len && tname[
next] !=
'*' && tname[
next] !=
'&') {
1580 if (tname[cursor] !=
' ') end_of_type = cursor;
1582 auto next = cursor+1;
1583 if (strncmp(tname+
next,
"const",5) == 0) {
1584 if ((
next+5)==len || tname[
next+5] ==
' ' || tname[
next+5] ==
'*' || tname[
next+5] ==
'&' || tname[
next+5] ==
',' || tname[
next+5] ==
'>' || tname[
next+5] ==
'[') {
1589 (tname[
next] ==
' ' || tname[
next] ==
'*' || tname[
next] ==
'&')) {
1592 if (strncmp(tname+
next,
"const",5) == 0) {
1593 if ((
next+5)==len || tname[
next+5] ==
' ' || tname[
next+5] ==
'*' || tname[
next+5] ==
'&' || tname[
next+5] ==
',' || tname[
next+5] ==
'>' || tname[
next+5] ==
'[') {
1605 if (modified && prevScope) {
1606 result += std::string(tname+prevScope,(end_of_type == 0 ? cursor : end_of_type)-prevScope);
1610 if (modified) result +=
',';
1614 if (modified && prevScope) {
1615 result += std::string(tname+prevScope,(end_of_type == 0 ? cursor : end_of_type)-prevScope);
1619 if (modified) result +=
'>';
1627 if (prevScope && modified) result += std::string(tname+prevScope,(end_of_type == 0 ? cursor : end_of_type)-prevScope);
1644 if ( tname==0 || tname[0]==0 || !gInterpreterHelper)
return "";
1650 if (gInterpreterHelper->ExistingTypeCheck(tname, result))
1652 if (result.empty())
return tname;
1656 unsigned int len = strlen(tname);
1658 unsigned int cursor = 0;
1659 bool modified =
false;
1662 if (!modified)
return tname;
1676 static const char* sSTLtypes[] = {
1689 "basic_istringstream",
1692 "basic_ostringstream",
1696 "basic_stringstream",
1725 "istreambuf_iterator",
1734 "localedef utility",
1751 "moneypunct_byname",
1763 "ostreambuf_iterator",
1769 "pointer_to_binary_function",
1770 "pointer_to_unary_function",
1774 "raw_storage_iterator",
1792 "unordered_multimap",
1793 "unordered_multiset",
1799 static set<string> sSetSTLtypes;
1801 if (tname==0 || tname[0]==0)
return "";
1803 if (sSetSTLtypes.empty()) {
1805 const size_t nSTLtypes =
sizeof(sSTLtypes) /
sizeof(
const char*);
1806 for (
size_t i = 0; i < nSTLtypes; ++i)
1807 sSetSTLtypes.insert(sSTLtypes[i]);
1811 size_t len = strlen(tname);
1813 ret.reserve(len + 20);
1817 bool precScope =
false;
1818 while (!(isalnum(tname[b]) || tname[b] ==
'_') && b < len) {
1819 precScope = (b < len - 2) && (tname[b] ==
':') && (tname[b + 1] ==
':');
1831 while (e < len && (isalnum(tname[e]) || tname[e] ==
'_'))
1835 set<string>::const_iterator iSTLtype = sSetSTLtypes.find(
id);
1836 if (iSTLtype != sSetSTLtypes.end())
1853 const char* mangled_name = ti.name();
static size_t StdLen(const std::string_view name)
Return the length, if any, taken by std:: and any potential inline namespace (well compiler detail na...
ROOT::ESTLType IsSTLCont(std::string_view type)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of cont...
int IsSTLCont(int testAlloc=0) const
type : type name: vector<list<classA,allocator>,allocator> testAlloc: if true, we test allocator...
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
TSplitType(const char *type2split, EModType mode=TClassEdit::kNone)
default constructor
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY size_type length() const _NOEXCEPT
int GetSplit(const char *type, std::vector< std::string > &output, int &nestedLoc, EModType mode=TClassEdit::kNone)
Stores in output (after emptying it) the splited type.
ROOT::ESTLType IsInSTL() const
type : type name: vector<list<classA,allocator>,allocator>[::iterator] result: 0 : not stl container ...
std::vector< double > values
bool IsDefAlloc(const char *alloc, const char *classname)
return whether or not 'allocname' is the STL default allocator for type 'classname' ...
int compare(double v1, double v2, const std::string &name="", double scale=1.0)
std::string CleanType(const char *typeDesc, int mode=0, const char **tail=0)
Cleanup type description, redundant blanks removed and redundant tail ignored return *tail = pointer ...
std::string InsertStd(const char *tname)
static void RemoveStd(std::string &name, size_t pos=0)
Remove std:: and any potential inline namespace (well compiler detail namespace.
bool IsSTLBitset(const char *type)
Return true is the name is std::bitset<number> or bitset<number>
int STLArgs(int kind)
Return number of arguments for STL container before allocator.
void ShortType(std::string &answer, int mode)
Return the absolute type of typeDesc into the string answ.
char * DemangleName(const char *mangled_name, int &errorCode)
void Init(TClassEdit::TInterpreterLookupHelper *helper)
std::string ResolveTypedef(const char *tname, bool resolveAll=false)
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
static size_t findNameEnd(const std::string_view full)
char * DemangleTypeIdName(const std::type_info &ti, int &errorCode)
Demangle in a portable way the type id name.
bool IsInterpreterDetail(const char *type)
Return true if the type is one the interpreter details which are only forward declared (ClassInfo_t e...
std::string GetLong64_Name(const char *original)
Replace 'long long' and 'unsigned long long' by 'Long64_t' and 'ULong64_t'.
ROOT::ESTLType UnderlyingIsSTLCont(std::string_view type)
Return the type of STL collection, if any, that is the underlying type of the given type...
EComplexType GetComplexType(const char *)
static void ResolveTypedefProcessType(const char *tname, unsigned int, unsigned int cursor, bool constprefix, unsigned int start_of_type, unsigned int end_of_type, unsigned int mod_start_of_type, bool &modified, std::string &result)
bool IsDefHash(const char *hashname, const char *classname)
return whether or not 'hashname' is the STL default hash for type 'classname'
static void R__FindTrailing(std::string &full, std::string &stars)
_LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT
std::vector< std::string > fElements
void GetNormalizedName(std::string &norm_name, std::string_view name)
Return the normalized name.
bool IsVectorBool(const char *name)
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
bool IsDefComp(const char *comp, const char *classname)
return whether or not 'compare' is the STL default comparator for type 'classname' ...
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_pointer data() const _NOEXCEPT
static bool IsDefElement(const char *elementName, const char *defaultElementName, const char *classname)
return whether or not 'elementName' is the STL default Element for type 'classname' ...
const char * GetUnqualifiedName(const char *name)
Return the start of the unqualified name include in 'original'.
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
static void output(int code)
static void ResolveTypedefImpl(const char *tname, unsigned int len, unsigned int &cursor, bool &modified, std::string &result)
bool IsDefPred(const char *predname, const char *classname)
return whether or not 'predname' is the STL default predicate for type 'classname' ...
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY void remove_prefix(size_type __n) _NOEXCEPT