Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TClassEdit Namespace Reference

Classes

struct  FunctionSplitInfo
 Result of splitting a function declaration into fReturnType fScopeName::fFunctionName<fFunctionTemplateArguments>(fFunctionParameters) More...
 
class  TInterpreterLookupHelper
 
struct  TSplitType
 

Enumerations

enum class  EComplexType : short {
  kNone , kDouble , kFloat , kInt ,
  kLong
}
 
enum  EModType {
  kNone = 0 , kDropTrailStar = 1<<0 , kDropDefaultAlloc = 1<<1 , kDropAlloc = 1<<2 ,
  kInnerClass = 1<<3 , kInnedMostClass = 1<<4 , kDropStlDefault = 1<<5 , kDropComparator = 1<<6 ,
  kDropAllDefault = 1<<7 , kLong64 = 1<<8 , kDropStd = 1<<9 , kKeepOuterConst = 1<<10 ,
  kResolveTypedef = 1<<11 , kDropPredicate = 1<<12 , kDropHash = 1<<13
}
 
enum  ESTLType {
  kNotSTL = ROOT::kNotSTL , kVector = ROOT::kSTLvector , kList = ROOT::kSTLlist , kForwardlist = ROOT::kSTLforwardlist ,
  kDeque = ROOT::kSTLdeque , kMap = ROOT::kSTLmap , kMultiMap = ROOT::kSTLmultimap , kSet = ROOT::kSTLset ,
  kMultiSet = ROOT::kSTLmultiset , kUnorderedSet = ROOT::kSTLunorderedset , kUnorderedMultiSet = ROOT::kSTLunorderedmultiset , kUnorderedMap = ROOT::kSTLunorderedmap ,
  kUnorderedMultiMap = ROOT::kSTLunorderedmultimap , kBitSet = ROOT::kSTLbitset , kEnd = ROOT::kSTLend
}
 

Functions

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 to last used character if (mode==0) keep keywords if (mode==1) remove keywords outside the template params if (mode>=2) remove the keywords everywhere.
 
char * DemangleName (const char *mangled_name, int &errorCode)
 
char * DemangleTypeIdName (const std::type_info &ti, int &errorCode)
 Demangle in a portable way the type id name.
 
EComplexType GetComplexType (const char *)
 
std::string GetLong64_Name (const char *original)
 Replace 'long long' and 'unsigned long long' by 'Long64_t' and 'ULong64_t'.
 
std::string GetLong64_Name (const std::string &original)
 Replace 'long long' and 'unsigned long long' by 'Long64_t' and 'ULong64_t'.
 
std::string GetNameForIO (const std::string &templateInstanceName, TClassEdit::EModType mode=TClassEdit::kNone, bool *hasChanged=nullptr)
 
void GetNormalizedName (std::string &norm_name, ROOT::Internal::TStringView name)
 
void GetNormalizedName (std::string &norm_name, std::string_view name)
 Return the normalized name.
 
int GetSplit (const char *type, std::vector< std::string > &output, int &nestedLoc, EModType mode=TClassEdit::kNone)
 Stores in output (after emptying it) the split type.
 
bool GetStdArrayProperties (const char *typeName, std::string &typeNameBuf, std::array< int, 5 > &maxIndices, int &ndim)
 
std::string GetUniquePtrType (ROOT::Internal::TStringView name)
 
std::string GetUniquePtrType (std::string_view name)
 
const char * GetUnqualifiedName (const char *name)
 Return the start of the unqualified name include in 'original'.
 
void Init (TClassEdit::TInterpreterLookupHelper *helper)
 
std::string InsertStd (const char *tname)
 
bool IsArtificial (ROOT::Internal::TStringView name)
 
bool IsArtificial (std::string_view name)
 
bool IsDefAlloc (const char *alloc, const char *classname)
 return whether or not 'allocname' is the STL default allocator for type 'classname'
 
bool IsDefAlloc (const char *alloc, const char *keyclassname, const char *valueclassname)
 return whether or not 'allocname' is the STL default allocator for a key of type 'keyclassname' and a value of type 'valueclassname'
 
bool IsDefComp (const char *comp, const char *classname)
 return whether or not 'compare' is the STL default comparator for type 'classname'
 
bool IsDefHash (const char *hashname, const char *classname)
 return whether or not 'hashname' is the STL default hash for type 'classname'
 
bool IsDefPred (const char *predname, const char *classname)
 return whether or not 'predname' is the STL default predicate for type 'classname'
 
bool IsInterpreterDetail (const char *type)
 Return true if the type is one the interpreter details which are only forward declared (ClassInfo_t etc..)
 
bool IsStdArray (ROOT::Internal::TStringView name)
 
bool IsStdArray (std::string_view name)
 
bool IsStdClass (const char *type)
 return true if the class belongs to the std namespace
 
bool IsStdPair (ROOT::Internal::TStringView name)
 
bool IsStdPair (std::string_view name)
 
bool IsStdPairBase (ROOT::Internal::TStringView name)
 
bool IsStdPairBase (std::string_view name)
 
bool IsSTLBitset (const char *type)
 Return true is the name is std::bitset<number> or bitset<number>
 
int IsSTLCont (const char *type, int testAlloc)
 type : type name: vector<list<classA,allocator>,allocator> testAlloc: if true, we test allocator, if it is not default result is negative result: 0 : not stl container abs(result): code of container 1=vector,2=list,3=deque,4=map 5=multimap,6=set,7=multiset positive val: we have a vector or list with default allocator to any depth like vector<list<vector<int>>> negative val: STL container other than vector or list, or non default allocator For example: vector<deque<int>> has answer -1
 
ROOT::ESTLType IsSTLCont (ROOT::Internal::TStringView type)
 
ROOT::ESTLType IsSTLCont (std::string_view type)
 type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of container 1=vector,2=list,3=deque,4=map 5=multimap,6=set,7=multiset
 
bool IsUniquePtr (ROOT::Internal::TStringView name)
 
bool IsUniquePtr (std::string_view name)
 
bool IsVectorBool (const char *name)
 
std::string ResolveTypedef (const char *tname, bool resolveAll=false)
 
std::string ShortType (const char *typeDesc, int mode)
 Return the absolute type of typeDesc.
 
bool SplitFunction (std::string_view decl, FunctionSplitInfo &result)
 Split a function declaration into its different parts.
 
int STLArgs (int kind)
 Return number of arguments for STL container before allocator.
 
ROOT::ESTLType STLKind (ROOT::Internal::TStringView type)
 
ROOT::ESTLType STLKind (std::string_view type)
 Converts STL container name to number.
 
ROOT::ESTLType UnderlyingIsSTLCont (ROOT::Internal::TStringView type)
 
ROOT::ESTLType UnderlyingIsSTLCont (std::string_view type)
 Return the type of STL collection, if any, that is the underlying type of the given type.
 

Enumeration Type Documentation

◆ EComplexType

enum class TClassEdit::EComplexType : short
strong
Enumerator
kNone 
kDouble 
kFloat 
kInt 
kLong 

Definition at line 111 of file TClassEdit.h.

◆ EModType

Enumerator
kNone 
kDropTrailStar 
kDropDefaultAlloc 
kDropAlloc 
kInnerClass 
kInnedMostClass 
kDropStlDefault 
kDropComparator 
kDropAllDefault 
kLong64 
kDropStd 
kKeepOuterConst 
kResolveTypedef 
kDropPredicate 
kDropHash 

Definition at line 75 of file TClassEdit.h.

◆ ESTLType

Enumerator
kNotSTL 
kVector 
kList 
kForwardlist 
kDeque 
kMap 
kMultiMap 
kSet 
kMultiSet 
kUnorderedSet 
kUnorderedMultiSet 
kUnorderedMap 
kUnorderedMultiMap 
kBitSet 
kEnd 

Definition at line 93 of file TClassEdit.h.

Function Documentation

◆ CleanType()

string TClassEdit::CleanType ( const char *  typeDesc,
int  mode = 0,
const char **  tail = 0 
)

Cleanup type description, redundant blanks removed and redundant tail ignored return *tail = pointer to last used character if (mode==0) keep keywords if (mode==1) remove keywords outside the template params if (mode>=2) remove the keywords everywhere.

if (tail!=0) cut before the trailing *

The keywords currently are: "const" , "volatile" removed

CleanType(" A<B, C< D, E> > *,F,G>") returns "A<B,C<D,E> >*"

Definition at line 1232 of file TClassEdit.cxx.

◆ DemangleName()

char * TClassEdit::DemangleName ( const char *  mangled_name,
int errorCode 
)
inline

Definition at line 218 of file TClassEdit.h.

◆ DemangleTypeIdName()

char * TClassEdit::DemangleTypeIdName ( const std::type_info &  ti,
int errorCode 
)

Demangle in a portable way the type id name.

IMPORTANT: The caller is responsible for freeing the returned const char*

Definition at line 2147 of file TClassEdit.cxx.

◆ GetComplexType()

TClassEdit::EComplexType TClassEdit::GetComplexType ( const char *  clName)

Definition at line 137 of file TClassEdit.cxx.

◆ GetLong64_Name() [1/2]

string TClassEdit::GetLong64_Name ( const char *  original)

Replace 'long long' and 'unsigned long long' by 'Long64_t' and 'ULong64_t'.

Definition at line 908 of file TClassEdit.cxx.

◆ GetLong64_Name() [2/2]

string TClassEdit::GetLong64_Name ( const std::string &  original)

Replace 'long long' and 'unsigned long long' by 'Long64_t' and 'ULong64_t'.

Definition at line 919 of file TClassEdit.cxx.

◆ GetNameForIO()

std::string TClassEdit::GetNameForIO ( const std::string &  templateInstanceName,
TClassEdit::EModType  mode = TClassEdit::kNone,
bool hasChanged = nullptr 
)

Definition at line 2094 of file TClassEdit.cxx.

◆ GetNormalizedName() [1/2]

void TClassEdit::GetNormalizedName ( std::string &  norm_name,
ROOT::Internal::TStringView  name 
)
inline

Definition at line 176 of file TClassEdit.h.

◆ GetNormalizedName() [2/2]

void TClassEdit::GetNormalizedName ( std::string &  norm_name,
std::string_view  name 
)

Return the normalized name.

See TMetaUtils::GetNormalizedName.

Return the type name normalized for ROOT, keeping only the ROOT opaque typedef (Double32_t, etc.) and removing the STL collections default parameter if any.

Compare to TMetaUtils::GetNormalizedName, this routines does not and can not add default template parameters.

Definition at line 854 of file TClassEdit.cxx.

◆ GetSplit()

int TClassEdit::GetSplit ( const char *  type,
std::vector< std::string > &  output,
int nestedLoc,
EModType  mode = TClassEdit::kNone 
)

Stores in output (after emptying it) the split type.

Stores the location of the tail (nested names) in nestedLoc (0 indicates no tail). Return the number of elements stored.

First in list is the template name or is empty "vector<list<int>,alloc>**" to "vector" "list<int>" "alloc" "**" or "TNamed*" to "" "TNamed" "*"

Definition at line 1029 of file TClassEdit.cxx.

◆ GetStdArrayProperties()

bool TClassEdit::GetStdArrayProperties ( const char *  typeName,
std::string &  typeNameBuf,
std::array< int, 5 > &  maxIndices,
int ndim 
)

Definition at line 2116 of file TClassEdit.cxx.

◆ GetUniquePtrType() [1/2]

std::string TClassEdit::GetUniquePtrType ( ROOT::Internal::TStringView  name)
inline

Definition at line 209 of file TClassEdit.h.

◆ GetUniquePtrType() [2/2]

std::string TClassEdit::GetUniquePtrType ( std::string_view  name)
inline

Definition at line 201 of file TClassEdit.h.

◆ GetUnqualifiedName()

const char * TClassEdit::GetUnqualifiedName ( const char *  name)

Return the start of the unqualified name include in 'original'.

Definition at line 942 of file TClassEdit.cxx.

◆ Init()

void TClassEdit::Init ( TClassEdit::TInterpreterLookupHelper helper)

Definition at line 171 of file TClassEdit.cxx.

◆ InsertStd()

string TClassEdit::InsertStd ( const char *  tname)

Definition at line 1784 of file TClassEdit.cxx.

◆ IsArtificial() [1/2]

bool TClassEdit::IsArtificial ( ROOT::Internal::TStringView  name)
inline

Definition at line 160 of file TClassEdit.h.

◆ IsArtificial() [2/2]

bool TClassEdit::IsArtificial ( std::string_view  name)
inline

Definition at line 159 of file TClassEdit.h.

◆ IsDefAlloc() [1/2]

bool TClassEdit::IsDefAlloc ( const char *  alloc,
const char *  classname 
)

return whether or not 'allocname' is the STL default allocator for type 'classname'

Definition at line 621 of file TClassEdit.cxx.

◆ IsDefAlloc() [2/2]

bool TClassEdit::IsDefAlloc ( const char *  alloc,
const char *  keyclassname,
const char *  valueclassname 
)

return whether or not 'allocname' is the STL default allocator for a key of type 'keyclassname' and a value of type 'valueclassname'

Definition at line 670 of file TClassEdit.cxx.

◆ IsDefComp()

bool TClassEdit::IsDefComp ( const char *  comp,
const char *  classname 
)

return whether or not 'compare' is the STL default comparator for type 'classname'

Definition at line 821 of file TClassEdit.cxx.

◆ IsDefHash()

bool TClassEdit::IsDefHash ( const char *  hashname,
const char *  classname 
)

return whether or not 'hashname' is the STL default hash for type 'classname'

Definition at line 839 of file TClassEdit.cxx.

◆ IsDefPred()

bool TClassEdit::IsDefPred ( const char *  predname,
const char *  classname 
)

return whether or not 'predname' is the STL default predicate for type 'classname'

Definition at line 830 of file TClassEdit.cxx.

◆ IsInterpreterDetail()

bool TClassEdit::IsInterpreterDetail ( const char *  type)

Return true if the type is one the interpreter details which are only forward declared (ClassInfo_t etc..)

Definition at line 1322 of file TClassEdit.cxx.

◆ IsStdArray() [1/2]

bool TClassEdit::IsStdArray ( ROOT::Internal::TStringView  name)
inline

Definition at line 190 of file TClassEdit.h.

◆ IsStdArray() [2/2]

bool TClassEdit::IsStdArray ( std::string_view  name)
inline

Definition at line 189 of file TClassEdit.h.

◆ IsStdClass()

bool TClassEdit::IsStdClass ( const char *  type)

return true if the class belongs to the std namespace

Definition at line 1418 of file TClassEdit.cxx.

◆ IsStdPair() [1/2]

bool TClassEdit::IsStdPair ( ROOT::Internal::TStringView  name)
inline

Definition at line 195 of file TClassEdit.h.

◆ IsStdPair() [2/2]

bool TClassEdit::IsStdPair ( std::string_view  name)
inline

Definition at line 191 of file TClassEdit.h.

◆ IsStdPairBase() [1/2]

bool TClassEdit::IsStdPairBase ( ROOT::Internal::TStringView  name)
inline

Definition at line 200 of file TClassEdit.h.

◆ IsStdPairBase() [2/2]

bool TClassEdit::IsStdPairBase ( std::string_view  name)
inline

Definition at line 196 of file TClassEdit.h.

◆ IsSTLBitset()

bool TClassEdit::IsSTLBitset ( const char *  type)

Return true is the name is std::bitset<number> or bitset<number>

Definition at line 1340 of file TClassEdit.cxx.

◆ IsSTLCont() [1/3]

int TClassEdit::IsSTLCont ( const char *  type,
int  testAlloc 
)

type : type name: vector<list<classA,allocator>,allocator> testAlloc: if true, we test allocator, if it is not default result is negative result: 0 : not stl container abs(result): code of container 1=vector,2=list,3=deque,4=map 5=multimap,6=set,7=multiset positive val: we have a vector or list with default allocator to any depth like vector<list<vector<int>>> negative val: STL container other than vector or list, or non default allocator For example: vector<deque<int>> has answer -1

Definition at line 1407 of file TClassEdit.cxx.

◆ IsSTLCont() [2/3]

ROOT::ESTLType TClassEdit::IsSTLCont ( ROOT::Internal::TStringView  type)
inline

Definition at line 171 of file TClassEdit.h.

◆ IsSTLCont() [3/3]

ROOT::ESTLType TClassEdit::IsSTLCont ( std::string_view  type)

type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of container 1=vector,2=list,3=deque,4=map 5=multimap,6=set,7=multiset

Definition at line 1378 of file TClassEdit.cxx.

◆ IsUniquePtr() [1/2]

bool TClassEdit::IsUniquePtr ( ROOT::Internal::TStringView  name)
inline

Definition at line 188 of file TClassEdit.h.

◆ IsUniquePtr() [2/2]

bool TClassEdit::IsUniquePtr ( std::string_view  name)
inline

Definition at line 187 of file TClassEdit.h.

◆ IsVectorBool()

bool TClassEdit::IsVectorBool ( const char *  name)

Definition at line 1453 of file TClassEdit.cxx.

◆ ResolveTypedef()

string TClassEdit::ResolveTypedef ( const char *  tname,
bool  resolveAll = false 
)

Definition at line 1748 of file TClassEdit.cxx.

◆ ShortType()

string TClassEdit::ShortType ( const char *  typeDesc,
int  mode 
)

Return the absolute type of typeDesc.

E.g.: typeDesc = "class const volatile TNamed**", returns "TNamed**". if (mode&1) remove last "*"s returns "TNamed" if (mode&2) remove default allocators from STL containers if (mode&4) remove all allocators from STL containers if (mode&8) return inner class of stl container. list<innerClass> if (mode&16) return deapest class of stl container. vector<list<deapest>> if (mode&kDropAllDefault) remove default template arguments

Definition at line 1305 of file TClassEdit.cxx.

◆ SplitFunction()

bool TClassEdit::SplitFunction ( std::string_view  decl,
TClassEdit::FunctionSplitInfo result 
)

Split a function declaration into its different parts.

Definition at line 2241 of file TClassEdit.cxx.

◆ STLArgs()

int TClassEdit::STLArgs ( int  kind)

Return number of arguments for STL container before allocator.

Definition at line 575 of file TClassEdit.cxx.

◆ STLKind() [1/2]

ROOT::ESTLType TClassEdit::STLKind ( ROOT::Internal::TStringView  type)
inline

Definition at line 181 of file TClassEdit.h.

◆ STLKind() [2/2]

ROOT::ESTLType TClassEdit::STLKind ( std::string_view  type)

Converts STL container name to number.

vector -> 1, etc.. If len is greater than 0, only look at that many characters in the string.

Definition at line 528 of file TClassEdit.cxx.

◆ UnderlyingIsSTLCont() [1/2]

ROOT::ESTLType TClassEdit::UnderlyingIsSTLCont ( ROOT::Internal::TStringView  type)
inline

Definition at line 169 of file TClassEdit.h.

◆ UnderlyingIsSTLCont() [2/2]

ROOT::ESTLType TClassEdit::UnderlyingIsSTLCont ( std::string_view  type)

Return the type of STL collection, if any, that is the underlying type of the given type.

Namely return the value of IsSTLCont after stripping pointer, reference and constness from the type. UnderlyingIsSTLCont("vector<int>*") == IsSTLCont("vector<int>") See TClassEdit::IsSTLCont

type : type name: vector<list<classA,allocator>,allocator>* result: 0 : not stl container code of container 1=vector,2=list,3=deque,4=map 5=multimap,6=set,7=multiset

Definition at line 1359 of file TClassEdit.cxx.