22 #include "TClassEdit.h" 39 : fInfo(info), fClass(cls)
43 fConstantList.SetOwner(
kTRUE);
47 if (0 != strcmp(
"",GetTitle())){
48 fQualName = std::string(GetTitle()) +
"::" +
GetName();
111 char *demangledEnumName = TClassEdit::DemangleName(ti.name(), errorCode);
113 if (errorCode != 0) {
114 free(demangledEnumName);
115 std::cerr <<
"ERROR TEnum::GetEnum - A problem occurred while demangling name.\n";
119 const char *constDemangledEnumName = demangledEnumName;
121 free(demangledEnumName);
147 TEnum *theEnum =
nullptr;
157 obj = enumTable->GetObject(enName);
159 return static_cast<TEnum *
>(obj);
165 auto searchEnum = [&theEnum, findEnumInList](
const char * scopeName,
const char * enName,
ESearchAction sa_local) {
170 if (scope) en = findEnumInList(scope->GetListOfEnums(), enName, sa_local);
177 if (
auto tClassScope = static_cast<TClass *>(
gROOT->GetListOfClasses()->FindObject(scopeName))) {
182 const bool scopeIsNamespace (tClassScope->Property() &
kIsNamespace);
184 const bool autoParseSuspended =
gInterpreter->IsAutoParsingSuspended();
185 const bool suspendAutoParse = autoParseSuspended || scopeIsNamespace;
189 if (scopeIsNamespace && !autoParseSuspended){
193 auto listOfEnums = tClassScope->GetListOfEnums(canLoadEnums);
197 theEnum = findEnumInList(listOfEnums, enName, sa_local);
201 auto listOfEnums = tProtoClassscope->GetListOfEnums();
202 if (listOfEnums) theEnum = findEnumInList(listOfEnums, enName, sa_local);
207 const char *lastPos = TClassEdit::GetUnqualifiedName(enumName);
209 if (strchr(lastPos,
'<')) {
215 if (lastPos != enumName) {
218 const auto enName = lastPos;
219 const auto scopeNameSize = ((
Long64_t)lastPos - (
Long64_t)enumName) /
sizeof(decltype(*lastPos)) - 2;
221 char *scopeName =
new char[scopeNameSize + 1];
223 char scopeName[scopeNameSize + 1];
225 strncpy(scopeName, enumName, scopeNameSize);
226 scopeName[scopeNameSize] =
'\0';
228 theEnum = searchEnum(scopeName, enName,
kNone);
230 const auto libsLoaded =
gInterpreter->AutoLoad(scopeName);
232 if (libsLoaded == 0){
235 theEnum = searchEnum(scopeName, enName, kAutoload);
239 printf(
"TEnum::GetEnum: Header Parsing - The enumerator %s is not known to the typesystem: an interpreter lookup will be performed. This can imply parsing of headers. This can be avoided selecting the numerator in the linkdef/selection file.\n", enumName);
241 theEnum = searchEnum(scopeName, enName, kALoadAndInterpLookup);
248 theEnum = findEnumInList(
gROOT->GetListOfEnums(), enumName,
kNone);
251 theEnum = findEnumInList(
gROOT->GetListOfEnums(), enumName,
kAutoload);
255 printf(
"TEnum::GetEnum: Header Parsing - The enumerator %s is not known to the typesystem: an interpreter lookup will be performed. This can imply parsing of headers. This can be avoided selecting the numerator in the linkdef/selection file.\n", enumName);
std::string GetName(const std::string &scope_name)
The TEnum class implements the enum type.
R__EXTERN TClassTable * gClassTable
Bool_t UpdateInterpreterStateMarker()
the Cling ID of the transaction that last updated the object
static TProtoClass * GetProtoNorm(const char *cname)
Given the class normalized name returns the TClassProto object for the class.
R__EXTERN TVirtualMutex * gInterpreterMutex
TClass * fClass
interpreter implementation provided declaration
virtual ~TEnum()
Destructor.
Collection abstract base class.
The TEnumConstant class implements the constants of the enum type.
The ROOT global object gROOT contains a list of all defined classes.
void AddConstant(TEnumConstant *constant)
Add a EnumConstant to the list of constants of the Enum Type.
Bool_t IsValid()
Return true if this enum object is pointing to a currently loaded enum.
#define R__LOCKGUARD(mutex)
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Mother of all ROOT objects.
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
A collection of TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
virtual void Add(TObject *obj)
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Long_t Property() const
Get property description word. For meaning of bits see EProperty.