Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use TClassEdit::IsStdPair
  • Loading branch information
pcanal committed Sep 30, 2020
commit 19f417df96729a9b6cbaf67de0aadff18f1895f4
2 changes: 1 addition & 1 deletion core/foundation/src/TClassEdit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@ bool TClassEdit::IsStdClass(const char *classname)
classname += StdLen( classname );
if ( strcmp(classname,"string")==0 ) return true;
if ( strncmp(classname,"bitset<",strlen("bitset<"))==0) return true;
if ( strncmp(classname,"pair<",strlen("pair<"))==0) return true;
if ( IsStdPair(classname) ) return true;
if ( strcmp(classname,"allocator")==0) return true;
if ( strncmp(classname,"allocator<",strlen("allocator<"))==0) return true;
if ( strncmp(classname,"greater<",strlen("greater<"))==0) return true;
Expand Down
8 changes: 4 additions & 4 deletions core/meta/src/TClass.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,7 @@ void TClass::Init(const char *name, Version_t cversion,
fStreamer = TVirtualStreamerInfo::Factory()->GenEmulatedClassStreamer( GetName(), silent );
}
}
} else if (!strncmp(GetName(),"std::pair<",10) || !strncmp(GetName(),"pair<",5) ) {
} else if (TClassEdit::IsStdPair(GetName())) {
// std::pairs have implicit conversions
GetSchemaRules(kTRUE);
}
Expand Down Expand Up @@ -2019,7 +2019,7 @@ void TClass::BuildRealData(void* pointer, Bool_t isTransient)
// and those for which the user explicitly requested a dictionary.
if (!isTransient && GetState() != kHasTClassInit
&& TClassEdit::IsStdClass(GetName())
&& strncmp(GetName(), "pair<", 5) != 0) {
&& !TClassEdit::IsStdPair(GetName())) {
Error("BuildRealData", "Inspection for %s not supported!", GetName());
}

Expand Down Expand Up @@ -4014,7 +4014,7 @@ void TClass::GetMissingDictionaries(THashTable& result, bool recurse)

THashTable visited;

if (strncmp(fName, "pair<", 5) == 0) {
if (TClassEdit::IsStdPair(fName)) {
GetMissingDictionariesForPairElements(result, visited, recurse);
return;
}
Expand Down Expand Up @@ -6356,7 +6356,7 @@ UInt_t TClass::GetCheckSum(ECheckSum code, Bool_t &isvalid) const
// otherwise, on some STL implementations, it can happen that pair has
// base classes which are an internal implementation detail.
TList *tlb = ((TClass*)this)->GetListOfBases();
if (tlb && !GetCollectionProxy() && strncmp(GetName(), "pair<", 5)) {
if (tlb && !GetCollectionProxy() && !TClassEdit::IsStdPair(GetName())) {
// Loop over bases if not a proxied collection or a pair

TIter nextBase(tlb);
Expand Down
4 changes: 2 additions & 2 deletions core/meta/src/TSchemaRuleSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ Bool_t TSchemaRuleSet::HasRuleWithSourceClass( const TString &source ) const
}
}
}
} else if (!strncmp(fClass->GetName(),"std::pair<",10) || !strncmp(fClass->GetName(),"pair<",5)) {
if (!strncmp(source,"std::pair<",10) || !strncmp(source,"pair<",5)) {
} else if (TClassEdit::IsStdPair(fClass->GetName())) {
if (TClassEdit::IsStdPair(source)) {
// std::pair can be converted into each other if both its parameter can be converted into
// each other.
TClass *src = TClass::GetClass(source);
Expand Down
2 changes: 1 addition & 1 deletion io/io/src/TFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3070,7 +3070,7 @@ void TFile::MakeProject(const char *dirname, const char * /*classes*/,
break;
}
default:
if (strncmp(key->GetName(),"pair<",strlen("pair<"))==0) {
if (TClassEdit::IsStdPair(key->GetName())) {
if (genreflex) {
tmp.Form("<class name=\"%s\" />\n",key->GetName());
if ( selections.Index(tmp) == kNPOS ) {
Expand Down
4 changes: 2 additions & 2 deletions io/io/src/TMakeProject.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ UInt_t TMakeProject::GenerateIncludeForTemplate(FILE *fp, const char *clname, ch
AddInclude(fp, what, kTRUE, inclist);
fprintf(fp, "namespace std {} using namespace std;\n");
ninc += GenerateIncludeForTemplate(fp, incName, inclist, forward, extrainfos);
} else if (strncmp(incName.Data(), "pair<", strlen("pair<")) == 0) {
} else if (TClassEdit::IsStdPair(incName)) {
AddInclude(fp, "utility", kTRUE, inclist);
ninc += GenerateIncludeForTemplate(fp, incName, inclist, forward, extrainfos);
} else if (strncmp(incName.Data(), "auto_ptr<", strlen("auto_ptr<")) == 0) {
Expand Down Expand Up @@ -615,7 +615,7 @@ void TMakeProject::GeneratePostDeclaration(FILE *fp, const TVirtualStreamerInfo
Int_t stlkind = TClassEdit::STLKind(inside[0]);
TClass *key = TClass::GetClass(inside[1].c_str());
TString what;
if (strncmp(inside[1].c_str(),"pair<",strlen("pair<"))==0) {
if (TClassEdit::IsStdPair(inside[1])) {
what = inside[1].c_str();
} else if (key) {
switch (stlkind) {
Expand Down
8 changes: 4 additions & 4 deletions io/io/src/TStreamerInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ void TStreamerInfo::Build()
// this is a pair, otherwise, on some STL implementations, it can happen that
// pair has mother classes which are an internal implementation detail and
// would result in bogus messages printed on screen.
if (strncmp(fClass->GetName(), "pair<", 5)) {
if (!TClassEdit::IsStdPair(fClass->GetName())) {
const bool isCollection = fClass->GetCollectionProxy();
const bool isString = !strcmp(fClass->GetName(), "string");
TBaseClass* base = 0;
Expand Down Expand Up @@ -3230,7 +3230,7 @@ UInt_t TStreamerInfo::GetCheckSum(TClass::ECheckSum code) const
// Here we skip he base classes in case this is a pair or STL collection,
// otherwise, on some STL implementations, it can happen that pair has
// base classes which are an internal implementation detail.
if (!fClass->GetCollectionProxy() && strncmp(fClass->GetName(), "pair<", 5)) {
if (!fClass->GetCollectionProxy() && !TClassEdit::IsStdPair(fClass->GetName())) {
while ( (el=(TStreamerElement*)next())) { // loop over bases
if (el->IsBase()) {
name = el->GetName();
Expand Down Expand Up @@ -3855,7 +3855,7 @@ UInt_t TStreamerInfo::GenerateIncludes(FILE *fp, char *inclist, const TList *ext
if (strncmp(include,"include\\",9)==0) {
include += 9;
}
if (strncmp(element->GetTypeName(),"pair<",strlen("pair<"))==0) {
if (TClassEdit::IsStdPair(element->GetTypeName())) {
TMakeProject::AddInclude( fp, "utility", kTRUE, inclist);
} else if (strncmp(element->GetTypeName(),"auto_ptr<",strlen("auto_ptr<"))==0) {
TMakeProject::AddInclude( fp, "memory", kTRUE, inclist);
Expand All @@ -3881,7 +3881,7 @@ Int_t TStreamerInfo::GenerateHeaderFile(const char *dirname, const TList *subCla
{
// if (fClassVersion == -4) return 0;
if ((fClass && fClass->GetCollectionType()) || TClassEdit::IsSTLCont(GetName())) return 0;
if (strncmp(GetName(),"pair<",strlen("pair<"))==0) return 0;
if (TClassEdit::IsStdPair(GetName())) return 0;
if (strncmp(GetName(),"auto_ptr<",strlen("auto_ptr<"))==0) return 0;

TClass *cl = TClass::GetClass(GetName());
Expand Down
5 changes: 2 additions & 3 deletions tree/treeplayer/src/TTreeGeneratorBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ namespace Internal {
}
}
directive = Form("#include \"%s\"\n",filename);
} else if (!strncmp(cl->GetName(), "pair<", 5)
|| !strncmp(cl->GetName(), "std::pair<", 10)) {
} else if (TClassEdit::IsStdPair(cl->GetName())) {
TClassEdit::TSplitType split(cl->GetName());
if (split.fElements.size() == 3) {
if (split.fElements.size() == 3 || split.fElements.size() == 4) {
for (int arg = 1; arg < 3; ++arg) {
TClass* clArg = TClass::GetClass(split.fElements[arg].c_str());
if (clArg) AddHeader(clArg);
Expand Down