summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-10-28 20:29:16 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2019-10-29 21:54:17 (GMT)
commit94e8899c8013cf99a6f90d1c8f0a7815ccc3e1c3 (patch)
treec799c05e24cceb1fbbe3358fbab2760a3e7c9e10 /src
parente8efa15a24b991332e2be0e44714d930d4d489a6 (diff)
downloadDoxygen-94e8899c8013cf99a6f90d1c8f0a7815ccc3e1c3.zip
Doxygen-94e8899c8013cf99a6f90d1c8f0a7815ccc3e1c3.tar.gz
Doxygen-94e8899c8013cf99a6f90d1c8f0a7815ccc3e1c3.tar.bz2
Replaced QList<BaseInfo> with std::vector<BaseInfo>
Diffstat (limited to 'src')
-rw-r--r--src/commentscan.l10
-rw-r--r--src/doxygen.cpp47
-rw-r--r--src/entry.cpp15
-rw-r--r--src/entry.h2
-rw-r--r--src/fortranscanner.l2
-rw-r--r--src/pyscanner.l4
-rw-r--r--src/scanner.l12
-rw-r--r--src/tagreader.cpp31
-rw-r--r--src/tclscanner.l2
9 files changed, 47 insertions, 78 deletions
diff --git a/src/commentscan.l b/src/commentscan.l
index edd4910..eef76d6 100644
--- a/src/commentscan.l
+++ b/src/commentscan.l
@@ -1824,7 +1824,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
addOutput(yytext);
// we add subpage labels as a kind of "inheritance" relation to prevent
// needing to add another list to the Entry class.
- current->extends->append(new BaseInfo(yytext,Public,Normal));
+ current->extends.push_back(BaseInfo(yytext,Public,Normal));
BEGIN(SubpageTitle);
}
<SubpageLabel>{DOCNL} { // missing argument
@@ -2224,8 +2224,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle argument of inherit command ------- */
<InheritParam>({ID}("::"|"."))*{ID} { // found argument
- current->extends->append(
- new BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal)
+ current->extends.push_back(
+ BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal)
);
BEGIN( Comment );
}
@@ -2247,8 +2247,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle argument of extends and implements commands ------- */
<ExtendsParam>({ID}("::"|"."))*{ID} { // found argument
- current->extends->append(
- new BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal)
+ current->extends.push_back(
+ BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal)
);
BEGIN( Comment );
}
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 9846ecd..1646bcc 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -315,7 +315,7 @@ static bool findClassRelation(
const Entry *root,
Definition *context,
ClassDef *cd,
- BaseInfo *bi,
+ const BaseInfo *bi,
QDict<int> *templateNames,
/*bool insertUndocumented*/
FindBaseClassRelation_Mode mode,
@@ -502,11 +502,11 @@ static void addSTLClass(const std::unique_ptr<Entry> &root,const STLInfo *info)
}
if (info->baseClass1)
{
- classEntry->extends->append(new BaseInfo(info->baseClass1,Public,info->virtualInheritance?Virtual:Normal));
+ classEntry->extends.push_back(BaseInfo(info->baseClass1,Public,info->virtualInheritance?Virtual:Normal));
}
if (info->baseClass2)
{
- classEntry->extends->append(new BaseInfo(info->baseClass2,Public,info->virtualInheritance?Virtual:Normal));
+ classEntry->extends.push_back(BaseInfo(info->baseClass2,Public,info->virtualInheritance?Virtual:Normal));
}
if (info->iterators)
{
@@ -4340,20 +4340,18 @@ static void findBaseClassesForClass(
masterCd->setVisited(TRUE);
// The base class could ofcouse also be a non-nested class
const ArgumentList &formalArgs = masterCd->templateArguments();
- QListIterator<BaseInfo> bii(*root->extends);
- BaseInfo *bi=0;
- for (bii.toFirst();(bi=bii.current());++bii)
+ for (const BaseInfo &bi : root->extends)
{
//printf("masterCd=%s bi->name='%s' #actualArgs=%d\n",
// masterCd->localName().data(),bi->name.data(),actualArgs?(int)actualArgs->count():-1);
bool delTempNames=FALSE;
if (templateNames==0)
{
- templateNames = getTemplateArgumentsInName(formalArgs,bi->name);
+ templateNames = getTemplateArgumentsInName(formalArgs,bi.name);
delTempNames=TRUE;
}
- BaseInfo tbi(bi->name,bi->prot,bi->virt);
- tbi.name = substituteTemplateArgumentsInString(bi->name,formalArgs,actualArgs);
+ BaseInfo tbi = bi;
+ tbi.name = substituteTemplateArgumentsInString(bi.name,formalArgs,actualArgs);
//printf("bi->name=%s tbi.name=%s\n",bi->name.data(),tbi.name.data());
if (mode==DocumentedOnly)
@@ -4550,7 +4548,7 @@ static bool findClassRelation(
const Entry *root,
Definition *context,
ClassDef *cd,
- BaseInfo *bi,
+ const BaseInfo *bi,
QDict<int> *templateNames,
FindBaseClassRelation_Mode mode,
bool isArtificial
@@ -4778,13 +4776,13 @@ static bool findClassRelation(
usedName=biName;
//printf("***** usedName=%s templSpec=%s\n",usedName.data(),templSpec.data());
}
- static bool sipSupport = Config_getBool(SIP_SUPPORT);
- if (sipSupport) bi->prot=Public;
+ Protection prot = bi->prot;
+ if (Config_getBool(SIP_SUPPORT)) prot=Public;
if (!cd->isSubClass(baseClass)) // check for recursion, see bug690787
{
- cd->insertBaseClass(baseClass,usedName,bi->prot,bi->virt,templSpec);
+ cd->insertBaseClass(baseClass,usedName,prot,bi->virt,templSpec);
// add this class as super class to the base class
- baseClass->insertSubClass(cd,bi->prot,bi->virt,templSpec);
+ baseClass->insertSubClass(cd,prot,bi->virt,templSpec);
}
else
{
@@ -4916,8 +4914,8 @@ static bool isClassSection(const Entry *root)
else if (root->section & Entry::COMPOUNDDOC_MASK)
// is it a documentation block with inheritance info.
{
- bool extends = root->extends->count()>0;
- if (extends) return TRUE;
+ bool hasExtends = !root->extends.empty();
+ if (hasExtends) return TRUE;
}
}
return FALSE;
@@ -5047,18 +5045,15 @@ static void computeTemplateClassRelations()
QCString templSpec = tdi.currentKey();
ArgumentList templArgs;
stringToArgumentList(templSpec,templArgs);
- QList<BaseInfo> *baseList=root->extends;
- QListIterator<BaseInfo> it(*baseList);
- BaseInfo *bi;
- for (;(bi=it.current());++it) // for each base class of the template
+ for (const BaseInfo &bi : root->extends)
{
// check if the base class is a template argument
- BaseInfo tbi(bi->name,bi->prot,bi->virt);
+ BaseInfo tbi = bi;
const ArgumentList &tl = cd->templateArguments();
if (!tl.empty())
{
QDict<int> *baseClassNames = tcd->getTemplateBaseClassNames();
- QDict<int> *templateNames = getTemplateArgumentsInName(tl,bi->name);
+ QDict<int> *templateNames = getTemplateArgumentsInName(tl,bi.name);
// for each template name that we inherit from we need to
// substitute the formal with the actual arguments
QDict<int> *actualTemplateNames = new QDict<int>(17);
@@ -5085,7 +5080,7 @@ static void computeTemplateClassRelations()
}
delete templateNames;
- tbi.name = substituteTemplateArgumentsInString(bi->name,tl,templArgs);
+ tbi.name = substituteTemplateArgumentsInString(bi.name,tl,templArgs);
// find a documented base class in the correct scope
if (!findClassRelation(root,cd,tcd,&tbi,actualTemplateNames,DocumentedOnly,FALSE))
{
@@ -8803,11 +8798,9 @@ static void computePageRelations(Entry *root)
Doxygen::mainPage;
if (pd)
{
- QListIterator<BaseInfo> bii(*root->extends);
- BaseInfo *bi;
- for (bii.toFirst();(bi=bii.current());++bii)
+ for (const BaseInfo &bi : root->extends)
{
- PageDef *subPd = Doxygen::pageSDict->find(bi->name);
+ PageDef *subPd = Doxygen::pageSDict->find(bi.name);
if (pd==subPd)
{
err("page defined at line %d of file %s with label %s is a direct "
diff --git a/src/entry.cpp b/src/entry.cpp
index 22ff858..9a8d0dd 100644
--- a/src/entry.cpp
+++ b/src/entry.cpp
@@ -38,8 +38,6 @@ Entry::Entry()
num++;
m_parent=0;
section = EMPTY_SEC;
- extends = new QList<BaseInfo>;
- extends->setAutoDelete(TRUE);
groups = new QList<Grouping>;
groups->setAutoDelete(TRUE);
anchors = new QList<SectionInfo>; // Doxygen::sectionDict takes ownership of the items!
@@ -103,8 +101,6 @@ Entry::Entry(const Entry &e)
bodyLine = e.bodyLine;
endBodyLine = e.endBodyLine;
mGrpId = e.mGrpId;
- extends = new QList<BaseInfo>;
- extends->setAutoDelete(TRUE);
groups = new QList<Grouping>;
groups->setAutoDelete(TRUE);
anchors = new QList<SectionInfo>;
@@ -141,13 +137,7 @@ Entry::Entry(const Entry &e)
m_sublist.push_back(std::make_unique<Entry>(*cur));
}
- // deep copy base class list
- QListIterator<BaseInfo> bli(*e.extends);
- BaseInfo *bi;
- for (;(bi=bli.current());++bli)
- {
- extends->append(new BaseInfo(*bi));
- }
+ extends = e.extends;
// deep copy group list
QListIterator<Grouping> gli(*e.groups);
@@ -174,7 +164,6 @@ Entry::~Entry()
//printf("Deleting entry %d name %s type %x children %d\n",
// num,name.data(),section,sublist->count());
- delete extends;
delete groups;
delete anchors;
delete sli;
@@ -302,7 +291,7 @@ void Entry::reset()
id.resize(0);
metaData.resize(0);
m_sublist.clear();
- extends->clear();
+ extends.clear();
groups->clear();
anchors->clear();
argList.clear();
diff --git a/src/entry.h b/src/entry.h
index ed8fd09..c715d60 100644
--- a/src/entry.h
+++ b/src/entry.h
@@ -291,7 +291,7 @@ class Entry
int bodyLine; //!< line number of the definition in the source
int endBodyLine; //!< line number where the definition ends
int mGrpId; //!< member group id
- QList<BaseInfo> *extends; //!< list of base classes
+ std::vector<BaseInfo> extends; //!< list of base classes
QList<Grouping> *groups; //!< list of groups this entry belongs to
QList<SectionInfo> *anchors; //!< list of anchors defined in this entry
QCString fileName; //!< file this entry was extracted from
diff --git a/src/fortranscanner.l b/src/fortranscanner.l
index 7fa9426..161deae 100644
--- a/src/fortranscanner.l
+++ b/src/fortranscanner.l
@@ -617,7 +617,7 @@ abstract {
}
extends{ARGS} {
QCString basename = extractFromParens(yytext).lower();
- current->extends->append(new BaseInfo(basename, Public, Normal));
+ current->extends.push_back(BaseInfo(basename, Public, Normal));
}
public {
current->protection = Public;
diff --git a/src/pyscanner.l b/src/pyscanner.l
index 1a3f052..829980c 100644
--- a/src/pyscanner.l
+++ b/src/pyscanner.l
@@ -1245,8 +1245,8 @@ STARTDOCSYMS "##"
}
{SCOPE} {
- current->extends->append(
- new BaseInfo(substitute(yytext,".","::"),Public,Normal)
+ current->extends.push_back(
+ BaseInfo(substitute(yytext,".","::"),Public,Normal)
);
//Has base class-do stuff
}
diff --git a/src/scanner.l b/src/scanner.l
index 61b51cb..6fa5008 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -5476,8 +5476,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
// there can be only one base class here
if (!baseName.isEmpty())
{
- current->extends->append(
- new BaseInfo(baseName,Public,Normal));
+ current->extends.push_back(
+ BaseInfo(baseName,Public,Normal));
baseName.resize(0);
}
current_root->moveToSubEntryAndRefresh( current ) ;
@@ -6156,8 +6156,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
current->name = removeRedundantWhiteSpace(current->name);
if (!baseName.isEmpty())
{
- current->extends->append(
- new BaseInfo(baseName,baseProt,baseVirt)
+ current->extends.push_back(
+ BaseInfo(baseName,baseProt,baseVirt)
);
}
if ((current->spec & (Entry::Interface|Entry::Struct)) ||
@@ -6198,8 +6198,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
current->startColumn = yyColNr;
current->name = removeRedundantWhiteSpace(current->name);
if (!baseName.isEmpty())
- current->extends->append(
- new BaseInfo(baseName,baseProt,baseVirt)
+ current->extends.push_back(
+ BaseInfo(baseName,baseProt,baseVirt)
);
curlyCount=0;
if (insideObjC)
diff --git a/src/tagreader.cpp b/src/tagreader.cpp
index 851a581..c2a7aac 100644
--- a/src/tagreader.cpp
+++ b/src/tagreader.cpp
@@ -100,14 +100,14 @@ class TagClassInfo
{
public:
enum Kind { None=-1, Class, Struct, Union, Interface, Exception, Protocol, Category, Enum, Service, Singleton };
- TagClassInfo() { bases=0, templateArguments=0; members.setAutoDelete(TRUE); isObjC=FALSE; kind = None; }
- ~TagClassInfo() { delete bases; delete templateArguments; }
+ TagClassInfo() { templateArguments=0; members.setAutoDelete(TRUE); isObjC=FALSE; kind = None; }
+ ~TagClassInfo() { delete templateArguments; }
QCString name;
QCString filename;
QCString clangId;
QCString anchor;
TagAnchorInfoList docAnchors;
- QList<BaseInfo> *bases;
+ std::vector<BaseInfo> bases;
QList<TagMemberInfo> members;
QList<QCString> *templateArguments;
QCStringList classList;
@@ -623,12 +623,7 @@ class TagFileParser : public QXmlDefaultHandler
{
virt = Virtual;
}
- if (m_curClass->bases==0)
- {
- m_curClass->bases = new QList<BaseInfo>;
- m_curClass->bases->setAutoDelete(TRUE);
- }
- m_curClass->bases->append(new BaseInfo(m_curString,prot,virt));
+ m_curClass->bases.push_back(BaseInfo(m_curString,prot,virt));
}
else
{
@@ -640,7 +635,7 @@ class TagFileParser : public QXmlDefaultHandler
{
if (m_state==InClass && m_curClass)
{
- m_curClass->bases->getLast()->name = m_curString;
+ m_curClass->bases.back().name = m_curString;
}
else
{
@@ -990,14 +985,9 @@ void TagFileParser::dump()
{
msg("class '%s'\n",cd->name.data());
msg(" filename '%s'\n",cd->filename.data());
- if (cd->bases)
+ for (const BaseInfo &bi : cd->bases)
{
- QListIterator<BaseInfo> bii(*cd->bases);
- BaseInfo *bi;
- for ( bii.toFirst() ; (bi=bii.current()) ; ++bii)
- {
- msg( " base: %s \n", bi->name.data() );
- }
+ msg( " base: %s \n", bi.name.data() );
}
QListIterator<TagMemberInfo> mci(cd->members);
@@ -1344,11 +1334,8 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root)
ce->id = tci->clangId;
ce->lang = tci->isObjC ? SrcLangExt_ObjC : SrcLangExt_Unknown;
// transfer base class list
- if (tci->bases)
- {
- delete ce->extends;
- ce->extends = tci->bases; tci->bases = 0;
- }
+ ce->extends = tci->bases;
+ tci->bases.clear();
if (tci->templateArguments)
{
ArgumentList al;
diff --git a/src/tclscanner.l b/src/tclscanner.l
index d0fb564..4a262bc 100644
--- a/src/tclscanner.l
+++ b/src/tclscanner.l
@@ -2700,7 +2700,7 @@ tcl_inf("->\n");
{
for (unsigned int i = 2; i < tcl.list_commandwords.count(); i = i + 2)
{
- tcl.scan.at(0)->entry_cl->extends->append(new BaseInfo((*tcl.list_commandwords.at(i)),Public,Normal));
+ tcl.scan.at(0)->entry_cl->extends.push_back(BaseInfo((*tcl.list_commandwords.at(i)),Public,Normal));
}
}
goto command_end;