13 #ifndef ROOT_TClassEdit
14 #define ROOT_TClassEdit
17 #include "RConfigure.h"
20 #ifndef UNDNAME_COMPLETE
21 #define UNDNAME_COMPLETE 0x0000
24 char *__unDName(
char *demangled,
const char *mangled,
int out_len,
25 void * (* pAlloc )(
size_t),
void (* pFree )(
void *),
26 unsigned short int flags);
44 #if defined(__CYGWIN__)
49 string to_string(T value) {
61 namespace TMetaUtils {
62 class TNormalizedCtxt;
72 namespace TClassEdit {
76 kDropTrailStar = 1<<0,
77 kDropDefaultAlloc = 1<<1,
80 kInnedMostClass = 1<<4,
81 kDropStlDefault = 1<<5,
82 kDropComparator = 1<<6,
83 kDropAllDefault = 1<<7,
86 kKeepOuterConst = 1<<10,
87 kResolveTypedef = 1<<11,
88 kDropPredicate = 1<<12,
93 kNotSTL = ROOT::kNotSTL,
94 kVector = ROOT::kSTLvector,
95 kList = ROOT::kSTLlist,
96 kForwardlist = ROOT::kSTLforwardlist,
97 kDeque = ROOT::kSTLdeque,
99 kMultiMap = ROOT::kSTLmultimap,
100 kSet = ROOT::kSTLset,
101 kMultiSet = ROOT::kSTLmultiset,
102 kUnorderedSet = ROOT::kSTLunorderedset,
103 kUnorderedMultiSet = ROOT::kSTLunorderedmultiset,
104 kUnorderedMap = ROOT::kSTLunorderedmap,
105 kUnorderedMultiMap = ROOT::kSTLunorderedmultimap,
106 kBitSet = ROOT::kSTLbitset,
110 enum class EComplexType : short {
118 EComplexType GetComplexType(
const char*);
120 class TInterpreterLookupHelper {
122 TInterpreterLookupHelper() { }
123 virtual ~TInterpreterLookupHelper();
125 virtual bool ExistingTypeCheck(
const std::string & ,
127 virtual void GetPartiallyDesugaredName(std::string & ) = 0;
128 virtual bool IsAlreadyPartiallyDesugaredName(
const std::string & ,
129 const std::string & ) = 0;
130 virtual bool IsDeclaredScope(
const std::string & ,
bool & ) = 0;
131 virtual bool GetPartiallyDesugaredNameWithScopeHandling(
const std::string & ,
134 virtual void ShuttingDownSignal() = 0;
140 std::vector<std::string> fElements;
143 TSplitType(
const char *type2split, EModType mode = TClassEdit::kNone);
145 int IsSTLCont(
int testAlloc=0)
const;
146 ROOT::ESTLType IsInSTL()
const;
147 void ShortType(std::string &answer,
int mode);
151 TSplitType(
const TSplitType&);
152 TSplitType &operator=(
const TSplitType &);
155 void Init(TClassEdit::TInterpreterLookupHelper *helper);
157 std::string CleanType (
const char *typeDesc,
int mode = 0,
const char **tail=0);
158 bool IsDefAlloc(
const char *alloc,
const char *classname);
159 bool IsDefAlloc(
const char *alloc,
const char *keyclassname,
const char *valueclassname);
160 bool IsDefComp (
const char *comp ,
const char *classname);
161 bool IsDefPred(
const char *predname,
const char *classname);
162 bool IsDefHash(
const char *hashname,
const char *classname);
163 bool IsInterpreterDetail(
const char *type);
164 bool IsSTLBitset(
const char *type);
165 ROOT::ESTLType UnderlyingIsSTLCont(std::string_view type);
166 inline ROOT::ESTLType UnderlyingIsSTLCont (ROOT::Internal::TStringView type) {
return UnderlyingIsSTLCont(std::string_view(type)); }
167 ROOT::ESTLType IsSTLCont (std::string_view type);
168 inline ROOT::ESTLType IsSTLCont (ROOT::Internal::TStringView type) {
return IsSTLCont(std::string_view(type)); }
169 int IsSTLCont (
const char *type,
int testAlloc);
170 bool IsStdClass(
const char *type);
171 bool IsVectorBool(
const char *name);
172 void GetNormalizedName(std::string &norm_name, std::string_view name);
173 inline void GetNormalizedName (std::string &norm_name, ROOT::Internal::TStringView name) {
return GetNormalizedName(norm_name, std::string_view(name)); }
174 std::string GetLong64_Name(
const char *original);
175 std::string GetLong64_Name(
const std::string& original);
176 int GetSplit (
const char *type, std::vector<std::string> &output,
int &nestedLoc, EModType mode = TClassEdit::kNone);
177 ROOT::ESTLType STLKind(std::string_view type);
178 inline ROOT::ESTLType STLKind(ROOT::Internal::TStringView type) {
return STLKind(std::string_view(type)); }
179 int STLArgs (
int kind);
180 std::string ResolveTypedef(
const char *tname,
bool resolveAll =
false);
181 std::string ShortType (
const char *typeDesc,
int mode);
182 std::string InsertStd(
const char *tname);
183 const char* GetUnqualifiedName(
const char*name);
184 inline bool IsUniquePtr(std::string_view name) {
return 0 == name.compare(0, 11,
"unique_ptr<");}
185 inline bool IsUniquePtr(ROOT::Internal::TStringView name) {
return IsUniquePtr(std::string_view(name)); }
186 inline bool IsStdArray(std::string_view name) {
return 0 == name.compare(0, 6,
"array<");}
187 inline bool IsStdArray(ROOT::Internal::TStringView name) {
return IsStdArray(std::string_view(name)); }
188 inline std::string GetUniquePtrType(std::string_view name)
191 std::vector<std::string> v;
193 GetSplit(name.data(), v, i);
196 inline std::string GetUniquePtrType(ROOT::Internal::TStringView name) {
return GetUniquePtrType(std::string_view(name)); }
197 std::string GetNameForIO(
const std::string& templateInstanceName,
198 TClassEdit::EModType mode = TClassEdit::kNone,
199 bool* hasChanged =
nullptr);
200 bool GetStdArrayProperties(
const char* typeName,
201 std::string& typeNameBuf,
202 std::array<int, 5>& maxIndices,
205 inline char* DemangleName(
const char* mangled_name,
int& errorCode)
212 char *demangled_name = __unDName(0, mangled_name, 0, malloc, free, UNDNAME_COMPLETE);
213 if (!demangled_name) {
218 char *demangled_name = abi::__cxa_demangle(mangled_name, 0, 0, &errorCode);
219 if (!demangled_name || errorCode) {
220 free(demangled_name);
224 return demangled_name;
226 char* DemangleTypeIdName(
const std::type_info& ti,
int& errorCode);
231 struct FunctionSplitInfo {
233 std::string fReturnType;
236 std::string fScopeName;
239 std::string fFunctionName;
243 std::vector<std::string> fFunctionTemplateArguments;
246 std::vector<std::string> fFunctionParameters;
250 bool SplitFunction(std::string_view decl, FunctionSplitInfo &result);