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;
469 unsigned char offset = 0;
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) {
569 a.remove_prefix(alloclen);
576 if (a.compare(0,k.length(),k) != 0) {
580 std::string valuepart;
583 std::string norm_value;
586 if (valuepart != norm_value) {
589 a.remove_prefix(end);
591 a.remove_prefix(k.length());
594 if (a.compare(0,1,
">")!=0 && a.compare(0,2,
" >")!=0) {
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) {
618 a.remove_prefix(alloclen);
622 const static int pairlen = strlen(
"pair<");
623 if (a.compare(0,pairlen,
"pair<") != 0) {
626 a.remove_prefix(pairlen);
628 const static int constlen = strlen(
"const");
629 if (a.compare(0,constlen+1,
"const ") == 0) {
630 a.remove_prefix(constlen+1);
637 if (k.compare(0,constlen+1,
"const ") == 0) {
638 k.remove_prefix(constlen+1);
641 if (a.compare(0,k.length(),k) != 0) {
645 std::string alloc_keypart;
648 std::string norm_key;
651 if (alloc_keypart != norm_key) {
652 if ( norm_key[norm_key.length()-1] ==
'*' ) {
656 norm_key +=
" const";
658 if (alloc_keypart != norm_key) {
662 a.remove_prefix(end);
664 size_t end = k.length();
665 if ( (a[end-1] ==
'*') || a[end]==
' ' ) {
666 size_t skipSpace = (a[end] ==
' ');
667 if (a.compare(end+skipSpace,constlen,
"const") == 0) {
668 end += constlen+skipSpace;
671 a.remove_prefix(end);
683 if (a.compare(0,v.length(),
v) != 0) {
687 std::string valuepart;
690 std::string norm_value;
693 if (valuepart != norm_value) {
696 a.remove_prefix(end);
698 a.remove_prefix(v.length());
701 if (a.compare(0,1,
">")!=0 && a.compare(0,2,
" >")!=0) {
712 static bool IsDefElement(
const char *elementName,
const char* defaultElementName,
const char *classname)
714 string c = elementName;
718 const int elementlen = strlen(defaultElementName);
719 if (c.compare(pos,elementlen,defaultElementName) != 0) {
724 string k = classname;
725 if (c.compare(pos,k.length(),k) != 0) {
732 std::string norm_key;
735 if (keypart != norm_key) {
743 if (c.compare(pos,1,
">")!=0 && c.compare(pos,2,
" >")!=0) {
789 norm_name = std::string(name);
798 if (norm_name.length()>2 && norm_name[0]==
':' && norm_name[1]==
':') {
799 norm_name.erase(0,2);
802 if (gInterpreterHelper) {
804 std::string typeresult;
805 if (gInterpreterHelper->ExistingTypeCheck(norm_name, typeresult)
806 || gInterpreterHelper->GetPartiallyDesugaredNameWithScopeHandling(norm_name, typeresult)) {
808 if (!typeresult.empty()) norm_name = typeresult;
829 static const char* longlong_s =
"long long";
830 static const char* ulonglong_s =
"unsigned long long";
831 static const unsigned int longlong_len = strlen(longlong_s);
832 static const unsigned int ulonglong_len = strlen(ulonglong_s);
837 while( (pos = result.find(ulonglong_s,pos) ) >=0 ) {
838 result.replace(pos, ulonglong_len,
"ULong64_t");
841 while( (pos = result.find(longlong_s,pos) ) >=0 ) {
842 result.replace(pos, longlong_len,
"Long64_t");
852 const char *lastPos = original;
855 for(
auto cursor = original; *cursor !=
'\0'; ++cursor) {
856 if ( *cursor ==
'<' || *cursor ==
'(') ++depth;
857 else if ( *cursor ==
'>' || *cursor ==
')' ) --depth;
858 else if ( *cursor ==
':' ) {
859 if (depth==0 && *(cursor+1) ==
':' && *(cursor+2) !=
'\0') {
874 const char *t = full.c_str();
875 const unsigned int tlen( full.size() );
877 const char *starloc = t + tlen - 1;
878 bool hasconst =
false;
880 && (starloc-t) > 4 && 0 == strncmp((starloc-4),
"const",5)
881 && ( (*(starloc-5)) ==
' ' || (*(starloc-5)) ==
'*' || (*(starloc-5)) ==
'&'
882 || (*(starloc-5)) ==
'>' || (*(starloc-5)) ==
']') ) {
885 if ((*starloc-1)==
' ') {
891 if ( hasconst || (*starloc)==
'*' || (*starloc)==
'&' || (*starloc)==
']' ) {
892 bool isArray = ( (*starloc)==
']' );
893 while( t<=(starloc-1) && ((*(starloc-1))==
'*' || (*(starloc-1))==
'&' || (*(starloc-1))==
't' || isArray)) {
896 isArray = ! ( (*starloc)==
'[' );
897 }
else if ( (*(starloc-1))==
't' ) {
898 if ( (starloc-1-t) > 5 && 0 == strncmp((starloc-5),
"const",5)
899 && ( (*(starloc-6)) ==
' ' || (*(starloc-6)) ==
'*' || (*(starloc-6)) ==
'&'
900 || (*(starloc-6)) ==
'>' || (*(starloc-6)) ==
']')) {
911 if ((*(starloc-1))==
' ') {
916 const unsigned int starlen = strlen(starloc);
917 full.erase(tlen-starlen,starlen);
918 }
else if (hasconst) {
920 const unsigned int starlen = strlen(starloc);
921 full.erase(tlen-starlen,starlen);
941 if (strlen(type)==0)
return 0;
943 int cleantypeMode = 1 ;
952 unsigned int const_offset = (0==strncmp(
"const ",full.c_str(),6)) ? 6 : 0;
953 bool isString =
false;
954 bool isStdString =
false;
955 static const char* basic_string_std =
"std::basic_string<char";
956 static const unsigned int basic_string_std_len = strlen(basic_string_std);
958 if (full.compare(const_offset,basic_string_std_len,basic_string_std) == 0
959 && full.size() > basic_string_std_len) {
962 }
else if (full.compare(const_offset,basic_string_std_len-5,basic_string_std+5) == 0
963 && full.size() > (basic_string_std_len-5)) {
968 size_t offset = isStdString ? basic_string_std_len : basic_string_std_len - 5;
969 offset += const_offset;
970 if ( full[offset] ==
'>' ) {
972 }
else if (full[offset] ==
',') {
974 if (full.compare(offset, 5,
"std::") == 0) {
977 static const char* char_traits_s =
"char_traits<char>";
978 static const unsigned int char_traits_len = strlen(char_traits_s);
979 if (full.compare(offset, char_traits_len, char_traits_s) == 0) {
980 offset += char_traits_len;
981 if ( full[offset] ==
'>') {
983 }
else if (full[offset] ==
' ' && full[offset+1] ==
'>') {
986 }
else if (full[offset] ==
',') {
988 if (full.compare(offset, 5,
"std::") == 0) {
991 static const char* allocator_s =
"allocator<char>";
992 static const unsigned int allocator_len = strlen(allocator_s);
993 if (full.compare(offset, allocator_len, allocator_s) == 0) {
994 offset += allocator_len;
995 if ( full[offset] ==
'>') {
997 }
else if (full[offset] ==
' ' && full[offset+1] ==
'>') {
1018 output.push_back(
string());
1019 if (const_offset && (mode & kKeepOuterConst)) {
1020 if (isStdString && !(mode &
kDropStd)) {
1021 output.push_back(
"const std::string");
1023 output.push_back(
"const string");
1026 if (isStdString && !(mode &
kDropStd)) {
1027 output.push_back(
"std::string");
1029 output.push_back(
"string");
1032 if (offset < full.length()) {
1035 string right( full.substr(offset) );
1038 output.back().append(right.c_str()+1);
1039 output.push_back(stars);
1041 output.push_back(
"");
1043 return output.size();
1049 unsigned int offset = (0==strncmp(
"const ",full.c_str(),6)) ? 6 : 0;
1054 if ( !full.empty() ) {
1058 const char *
c = strchr(full.c_str(),
'<');
1061 output.push_back(
string(full,0,c - full.c_str()));
1065 for(cursor = c + 1; *cursor !=
'\0' && !(level==0 && *cursor ==
'>'); ++cursor) {
1067 case '<': ++level;
break;
1068 case '>': --level;
break;
1071 output.push_back(std::string(c+1,cursor));
1078 if (*(cursor-1) ==
' ') {
1079 output.push_back(std::string(c+1,cursor-1));
1081 output.push_back(std::string(c+1,cursor));
1084 if (*(cursor+1)==
':') {
1087 nestedLoc = output.size();
1088 output.push_back((cursor+1));
1090 }
else if (level >= 0) {
1092 output.push_back(std::string(c+1,cursor));
1096 output.push_back(
string());
1097 output.push_back(full);
1100 if (!output.empty()) output.push_back(stars);
1101 return output.size();
1123 static const char*
remove[] = {
"class",
"const",
"volatile",0};
1124 static bool isinit =
false;
1125 static std::vector<size_t> lengths;
1127 for (
int k=0;
remove[k]; ++k) {
1128 lengths.push_back(strlen(
remove[k]));
1134 result.reserve(strlen(typeDesc)*2);
1138 for(c=typeDesc;*
c;c++) {
1141 if (!isalnum(c[ 1]) && c[ 1] !=
'_')
continue;
1143 if (kbl && (mode>=2 || lev==0)) {
1145 int n = (mode) ? 999 : 1;
1148 for (
int k=0; k<n &&
remove[k]; k++) {
1149 int rlen = lengths[k];
1152 if (strncmp(
remove[k],c,rlen))
continue;
1155 if (isalnum(c[rlen]) || c[rlen]==
'_' || c[rlen]==
'$')
continue;
1157 c+=rlen-1; done = 1;
break;
1162 kbl = (!isalnum(c[ 0]) && c[ 0]!=
'_' && c[ 0]!=
'$' && c[0]!=
'[' && c[0]!=
']' && c[0]!=
'-' && c[0]!=
'@');
1166 if (*c ==
'<' || *c ==
'(') lev++;
1167 if (lev==0 && !isalnum(*c)) {
1168 if (!strchr(
"*&:._$ []-@",*c))
break;
1172 if (c[0]==
'>' && result.size() && result[result.size()-1]==
'>') result+=
" ";
1176 if (*c ==
'>' || *c ==
')') lev--;
1213 size_t len = strlen(type);
1214 if (len < 2 || strncmp(type+len-2,
"_t",2) != 0)
return false;
1216 unsigned char offset = 0;
1217 if (strncmp(type,
"const ",6)==0) { offset += 6; }
1218 static const char *names[] = {
"CallFunc_t",
"ClassInfo_t",
"BaseClassInfo_t",
1219 "DataMemberInfo_t",
"FuncTempInfo_t",
"MethodInfo_t",
"MethodArgInfo_t",
1220 "TypeInfo_t",
"TypedefInfo_t",0};
1222 for(
int k=1;names[k];k++) {
if (strcmp(type+offset,names[k])==0)
return true;}
1231 size_t offset =
StdLen(classname);
1232 if ( strncmp(classname+offset,
"bitset<",strlen(
"bitset<"))==0)
return true;
1250 if (type.compare(0,6,
"const ",6) == 0)
1251 type.remove_prefix(6);
1253 while(type[type.length()-1]==
'*' ||
1254 type[type.length()-1]==
'&' ||
1255 type[type.length()-1]==
' ') {
1256 type.remove_suffix(1);
1269 auto pos = type.find(
'<');
1273 for (decltype(type.length()) level = 1;
c < type.length(); ++
c) {
1274 if (type[
c] ==
'<') ++level;
1275 if (type[
c] ==
'>') --level;
1276 if (level == 0)
break;
1278 if (
c != (type.length()-1) ) {
1282 return STLKind({type.data(),pos});
1298 if (strchr(type,
'<')==0)
return 0;
1309 classname +=
StdLen( classname );
1310 if ( strcmp(classname,
"string")==0 )
return true;
1311 if ( strncmp(classname,
"bitset<",strlen(
"bitset<"))==0)
return true;
1312 if ( strncmp(classname,
"pair<",strlen(
"pair<"))==0)
return true;
1313 if ( strcmp(classname,
"allocator")==0)
return true;
1314 if ( strncmp(classname,
"allocator<",strlen(
"allocator<"))==0)
return true;
1315 if ( strncmp(classname,
"greater<",strlen(
"greater<"))==0)
return true;
1316 if ( strncmp(classname,
"less<",strlen(
"less<"))==0)
return true;
1317 if ( strncmp(classname,
"equal_to<",strlen(
"equal_to<"))==0)
return true;
1318 if ( strncmp(classname,
"hash<",strlen(
"hash<"))==0)
return true;
1319 if ( strncmp(classname,
"auto_ptr<",strlen(
"auto_ptr<"))==0)
return true;
1321 if ( strncmp(classname,
"vector<",strlen(
"vector<"))==0)
return true;
1322 if ( strncmp(classname,
"list<",strlen(
"list<"))==0)
return true;
1323 if ( strncmp(classname,
"forward_list<",strlen(
"forward_list<"))==0)
return true;
1324 if ( strncmp(classname,
"deque<",strlen(
"deque<"))==0)
return true;
1325 if ( strncmp(classname,
"map<",strlen(
"map<"))==0)
return true;
1326 if ( strncmp(classname,
"multimap<",strlen(
"multimap<"))==0)
return true;
1327 if ( strncmp(classname,
"set<",strlen(
"set<"))==0)
return true;
1328 if ( strncmp(classname,
"multiset<",strlen(
"multiset<"))==0)
return true;
1329 if ( strncmp(classname,
"unordered_set<",strlen(
"unordered_set<"))==0)
return true;
1330 if ( strncmp(classname,
"unordered_multiset<",strlen(
"unordered_multiset<"))==0)
return true;
1331 if ( strncmp(classname,
"unordered_map<",strlen(
"unordered_map<"))==0)
return true;
1332 if ( strncmp(classname,
"unordered_multimap<",strlen(
"unordered_multimap<"))==0)
return true;
1333 if ( strncmp(classname,
"bitset<",strlen(
"bitset<"))==0)
return true;
1352 unsigned int cursor,
1354 unsigned int start_of_type,
1355 unsigned int end_of_type,
1356 unsigned int mod_start_of_type,
1360 std::string
type(modified && (mod_start_of_type < result.length()) ?
1361 result.substr(mod_start_of_type, string::npos)
1362 : string(tname, start_of_type, end_of_type == 0 ? cursor - start_of_type : end_of_type - start_of_type));
1364 if (gInterpreterHelper->ExistingTypeCheck(
type, typeresult)
1365 || gInterpreterHelper->GetPartiallyDesugaredNameWithScopeHandling(
type, typeresult)) {
1367 if (!typeresult.empty()) {
1370 result.replace(mod_start_of_type, string::npos,
1375 mod_start_of_type = start_of_type;
1376 result += string(tname,0,start_of_type);
1377 if (constprefix && typeresult.compare(0,6,
"const ",6) == 0) {
1378 result += typeresult.substr(6,string::npos);
1380 result += typeresult;
1383 }
else if (modified) {
1384 result.replace(mod_start_of_type, string::npos,
1388 if (end_of_type != 0 && end_of_type!=cursor) {
1389 result += std::string(tname,end_of_type,cursor-end_of_type);
1396 if (end_of_type != 0 && end_of_type!=cursor) {
1397 result += std::string(tname,end_of_type,cursor-end_of_type);
1407 unsigned int &cursor,
1416 bool constprefix =
false;
1418 if (tname[cursor]==
' ') {
1421 result += string(tname,0,cursor);
1423 while (tname[cursor]==
' ') ++cursor;
1426 if (tname[cursor]==
'c' && (cursor+6<len)) {
1427 if (strncmp(tname+cursor,
"const ",6) == 0) {
1429 if (modified) result +=
"const ";
1437 if (len > 5 && strncmp(tname+cursor,
"std::",5) == 0) {
1440 if (len > 2 && strncmp(tname+cursor,
"::",2) == 0) {
1445 unsigned int start_of_type = cursor;
1446 unsigned int end_of_type = 0;
1447 unsigned int mod_start_of_type = result.length();
1448 unsigned int prevScope = cursor;
1449 for ( ; cursor<len; ++cursor) {
1450 switch (tname[cursor]) {
1452 if ((cursor+1)>=len || tname[cursor+1]!=
':') {
1454 if (modified) result += (tname+prevScope);
1459 scope = result.substr(mod_start_of_type, string::npos);
1460 scope += std::string(tname+prevScope,cursor-prevScope);
1462 scope = std::string(tname, start_of_type, cursor - start_of_type);
1464 std::string scoperesult;
1465 bool isInlined =
false;
1466 if (gInterpreterHelper->ExistingTypeCheck(scope, scoperesult)
1467 ||gInterpreterHelper->GetPartiallyDesugaredNameWithScopeHandling(scope, scoperesult)) {
1469 if (!scoperesult.empty()) {
1472 if (constprefix && scoperesult.compare(0,6,
"const ",6) != 0) mod_start_of_type -= 6;
1473 result.replace(mod_start_of_type, string::npos,
1478 mod_start_of_type = start_of_type;
1479 result += string(tname,0,start_of_type);
1481 result += scoperesult;
1484 }
else if (modified) {
1485 result += std::string(tname+prevScope,cursor+1-prevScope);
1487 }
else if (!gInterpreterHelper->IsDeclaredScope(scope,isInlined)) {
1489 if (modified) result += (tname+prevScope);
1493 }
else if (isInlined) {
1497 mod_start_of_type = start_of_type;
1498 result += string(tname,0,start_of_type);
1500 result += string(tname,start_of_type,prevScope - start_of_type);
1502 }
else if (modified) {
1503 result += std::string(tname+prevScope,cursor+1-prevScope);
1507 prevScope = cursor+1;
1513 result += std::string(tname+prevScope,cursor+1-prevScope);
1519 }
while( cursor<len && tname[cursor] ==
',' );
1521 while (cursor<len && tname[cursor+1]==
' ') ++cursor;
1526 if (cursor+2<len && tname[cursor+1]==
':' && tname[cursor+2]==
':') {
1527 if (modified) result +=
"::";
1529 prevScope = cursor+1;
1531 if ( (cursor+1)<len && tname[cursor+1] ==
',') {
1533 if (modified) result +=
',';
1536 if ( (cursor+1)<len && tname[cursor+1] ==
'>') {
1538 if (modified) result +=
" >";
1541 if ( (cursor+1) >= len) {
1544 if (tname[cursor] !=
' ')
break;
1545 if (modified) prevScope = cursor+1;
1552 end_of_type = cursor;
1554 while ((cursor+1)<len && tname[cursor+1] ==
' ') ++cursor;
1556 auto next = cursor+1;
1557 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] ==
']'))
1562 result += string(tname,0,start_of_type);
1564 mod_start_of_type = start_of_type + 6;
1565 result += string(tname,start_of_type,end_of_type-start_of_type);
1566 }
else if (mod_start_of_type < result.length()) {
1567 result.insert(mod_start_of_type,
"const ");
1568 mod_start_of_type += 6;
1571 mod_start_of_type += 6;
1572 result += string(tname,start_of_type,end_of_type-start_of_type);
1575 end_of_type = cursor+1;
1576 prevScope = end_of_type;
1577 if ((
next+5)==len || tname[
next+5] ==
',' || tname[
next+5] ==
'>' || tname[
next+5] ==
'[') {
1580 }
else if (
next!=len && tname[
next] !=
'*' && tname[
next] !=
'&') {
1590 if (tname[cursor] !=
' ') end_of_type = cursor;
1592 auto next = cursor+1;
1593 if (strncmp(tname+
next,
"const",5) == 0) {
1594 if ((
next+5)==len || tname[
next+5] ==
' ' || tname[
next+5] ==
'*' || tname[
next+5] ==
'&' || tname[
next+5] ==
',' || tname[
next+5] ==
'>' || tname[
next+5] ==
'[') {
1599 (tname[
next] ==
' ' || tname[
next] ==
'*' || tname[
next] ==
'&')) {
1602 if (strncmp(tname+
next,
"const",5) == 0) {
1603 if ((
next+5)==len || tname[
next+5] ==
' ' || tname[
next+5] ==
'*' || tname[
next+5] ==
'&' || tname[
next+5] ==
',' || tname[
next+5] ==
'>' || tname[
next+5] ==
'[') {
1615 if (modified && prevScope) {
1616 result += std::string(tname+prevScope,(end_of_type == 0 ? cursor : end_of_type)-prevScope);
1620 if (modified) result +=
',';
1624 if (modified && prevScope) {
1625 result += std::string(tname+prevScope,(end_of_type == 0 ? cursor : end_of_type)-prevScope);
1629 if (modified) result +=
'>';
1637 if (prevScope && modified) result += std::string(tname+prevScope,(end_of_type == 0 ? cursor : end_of_type)-prevScope);
1654 if ( tname==0 || tname[0]==0 || !gInterpreterHelper)
return "";
1660 if (gInterpreterHelper->ExistingTypeCheck(tname, result))
1662 if (result.empty())
return tname;
1666 unsigned int len = strlen(tname);
1668 unsigned int cursor = 0;
1669 bool modified =
false;
1672 if (!modified)
return tname;
1686 static const char* sSTLtypes[] = {
1699 "basic_istringstream",
1702 "basic_ostringstream",
1706 "basic_stringstream",
1735 "istreambuf_iterator",
1744 "localedef utility",
1761 "moneypunct_byname",
1773 "ostreambuf_iterator",
1779 "pointer_to_binary_function",
1780 "pointer_to_unary_function",
1784 "raw_storage_iterator",
1802 "unordered_multimap",
1803 "unordered_multiset",
1809 static set<string> sSetSTLtypes;
1811 if (tname==0 || tname[0]==0)
return "";
1813 if (sSetSTLtypes.empty()) {
1815 const size_t nSTLtypes =
sizeof(sSTLtypes) /
sizeof(
const char*);
1816 for (
size_t i = 0; i < nSTLtypes; ++i)
1817 sSetSTLtypes.insert(sSTLtypes[i]);
1821 size_t len = strlen(tname);
1823 ret.reserve(len + 20);
1827 bool precScope =
false;
1828 while (!(isalnum(tname[b]) || tname[b] ==
'_') && b < len) {
1829 precScope = (b < len - 2) && (tname[b] ==
':') && (tname[b + 1] ==
':');
1841 while (e < len && (isalnum(tname[e]) || tname[e] ==
'_'))
1845 set<string>::const_iterator iSTLtype = sSetSTLtypes.find(
id);
1846 if (iSTLtype != sSetSTLtypes.end())
1863 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,allocator> result: 0 : not stl container code of cont...
int IsSTLCont(int testAlloc=0) const
type : type name: vector,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
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,allocator>[::iterator] result: 0 : not stl container ...
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 or bitset
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'
basic_string_view< char > string_view
static void R__FindTrailing(std::string &full, std::string &stars)
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' ...
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' ...