From 4b745debaec0dbff60f7fe82ac32c59e3b21dfea Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Tue, 29 Oct 2019 19:37:27 +0100 Subject: Replaced QList by std::vector --- src/cite.cpp | 2 +- src/commentscan.l | 6 +++--- src/definition.cpp | 7 ++----- src/definition.h | 3 ++- src/definitionimpl.h | 4 ++-- src/doxygen.cpp | 2 +- src/entry.cpp | 13 ++----------- src/entry.h | 2 +- src/reflist.cpp | 2 +- src/section.h | 27 ++++++--------------------- src/tagreader.cpp | 2 +- src/util.cpp | 1 - src/util.h | 1 - 13 files changed, 22 insertions(+), 50 deletions(-) diff --git a/src/cite.cpp b/src/cite.cpp index 42f695f..3a204de 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -296,7 +296,7 @@ void CiteDict::generatePage() const // 7. add it as a page addRelatedPage(CiteConsts::fileName, - theTranslator->trCiteReferences(),doc,0,CiteConsts::fileName,1,0,0,0); + theTranslator->trCiteReferences(),doc,CiteConsts::fileName,1,0,0,0); // 8. for latex we just copy the bib files to the output and let // latex do this work. diff --git a/src/commentscan.l b/src/commentscan.l index 29bc1d9..b3fe0ae 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -605,7 +605,7 @@ static void addXRefItem(const char *listName,const char *itemTitle, g_sectionTitle,SectionInfo::Anchor, g_sectionLevel); Doxygen::sectionDict->append(anchorLabel,si); - current->anchors->append(si); + current->anchors.push_back(si); } } outputXRef.resize(0); @@ -673,7 +673,7 @@ static void addSection() g_sectionTitle,sectionLevelToType(g_sectionLevel),g_sectionLevel); // add section to this entry - current->anchors->append(si); + current->anchors.push_back(si); // add section to the global dictionary Doxygen::sectionDict->append(g_sectionLabel,si); @@ -850,7 +850,7 @@ static void addAnchor(const char *anchor) { si = new SectionInfo(yyFileName,yyLineNr,anchor,0,SectionInfo::Anchor,0); Doxygen::sectionDict->append(anchor,si); - current->anchors->append(si); + current->anchors.push_back(si); } } diff --git a/src/definition.cpp b/src/definition.cpp index b44f2d1..3c37686 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -430,13 +430,10 @@ QCString DefinitionImpl::id() const return m_impl->id; } -void DefinitionImpl::addSectionsToDefinition(QList *anchorList) +void DefinitionImpl::addSectionsToDefinition(const std::vector &anchorList) { - if (!anchorList) return; //printf("%s: addSectionsToDefinition(%d)\n",name().data(),anchorList->count()); - QListIterator it(*anchorList); - SectionInfo *si; - for (;(si=it.current());++it) + for (const SectionInfo *si : anchorList) { //printf("Add section '%s' to definition '%s'\n", // si->label.data(),name().data()); diff --git a/src/definition.h b/src/definition.h index db9bbbc..e03ca97 100644 --- a/src/definition.h +++ b/src/definition.h @@ -18,6 +18,7 @@ #ifndef DEFINITION_H #define DEFINITION_H +#include #include #include @@ -331,7 +332,7 @@ class Definition : public DefinitionIntf /*! Add the list of anchors that mark the sections that are found in the * documentation. */ - virtual void addSectionsToDefinition(QList *anchorList) = 0; + virtual void addSectionsToDefinition(const std::vector &anchorList) = 0; virtual void addSourceReferencedBy(const MemberDef *d) = 0; virtual void addSourceReferences(const MemberDef *d) = 0; virtual void mergeRefItems(Definition *d) = 0; diff --git a/src/definitionimpl.h b/src/definitionimpl.h index 4dd324b..410122c 100644 --- a/src/definitionimpl.h +++ b/src/definitionimpl.h @@ -83,7 +83,7 @@ class DefinitionImpl : virtual public Definition virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine); virtual void setInbodyDocumentation(const char *d,const char *docFile,int docLine); virtual void setReference(const char *r); - virtual void addSectionsToDefinition(QList *anchorList); + virtual void addSectionsToDefinition(const std::vector &anchorList); virtual void setBodySegment(int bls,int ble); virtual void setBodyDef(FileDef *fd); virtual void addSourceReferencedBy(const MemberDef *d); @@ -241,7 +241,7 @@ class DefinitionAliasImpl : virtual public Definition virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine) {} virtual void setInbodyDocumentation(const char *d,const char *docFile,int docLine) {} virtual void setReference(const char *r) {} - virtual void addSectionsToDefinition(QList *anchorList) {} + virtual void addSectionsToDefinition(const std::vector &anchorList) {} virtual void setBodySegment(int bls,int ble) {} virtual void setBodyDef(FileDef *fd) {} virtual void addSourceReferencedBy(const MemberDef *d) {} diff --git a/src/doxygen.cpp b/src/doxygen.cpp index a75a820..6b976ca 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -583,7 +583,7 @@ static void addRelatedPage(Entry *root) doc=root->brief+"\n\n"+root->doc+root->inbodyDocs; } - PageDef *pd = addRelatedPage(root->name,root->args,doc,root->anchors, + PageDef *pd = addRelatedPage(root->name,root->args,doc, root->docFile,root->docLine, root->sli, gd,root->tagInfo(), diff --git a/src/entry.cpp b/src/entry.cpp index 625a448..16401bf 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -38,7 +38,6 @@ Entry::Entry() num++; m_parent=0; section = EMPTY_SEC; - anchors = new QList; // Doxygen::sectionDict takes ownership of the items! //printf("Entry::Entry() tArgList=0\n"); mGrpId = -1; hasTagInfo = FALSE; @@ -99,7 +98,7 @@ Entry::Entry(const Entry &e) bodyLine = e.bodyLine; endBodyLine = e.endBodyLine; mGrpId = e.mGrpId; - anchors = new QList; + anchors = e.anchors; fileName = e.fileName; startLine = e.startLine; startColumn = e.startColumn; @@ -136,13 +135,6 @@ Entry::Entry(const Entry &e) extends = e.extends; groups = e.groups; - QListIterator sli2(*e.anchors); - SectionInfo *s; - for (;(s=sli2.current());++sli2) - { - anchors->append(s); // shallow copy, object are owned by Doxygen::sectionDict - } - m_fileDef = e.m_fileDef; } @@ -153,7 +145,6 @@ Entry::~Entry() //printf("Deleting entry %d name %s type %x children %d\n", // num,name.data(),section,sublist->count()); - delete anchors; delete sli; num--; } @@ -281,7 +272,7 @@ void Entry::reset() m_sublist.clear(); extends.clear(); groups.clear(); - anchors->clear(); + anchors.clear(); argList.clear(); tArgLists.clear(); argList.reset(); diff --git a/src/entry.h b/src/entry.h index 6146c57..d2f2783 100644 --- a/src/entry.h +++ b/src/entry.h @@ -293,7 +293,7 @@ class Entry int mGrpId; //!< member group id std::vector extends; //!< list of base classes std::vector groups; //!< list of groups this entry belongs to - QList *anchors; //!< list of anchors defined in this entry + std::vector anchors; //!< list of anchors defined in this entry QCString fileName; //!< file this entry was extracted from int startLine; //!< start line of entry in the source int startColumn; //!< start column of entry in the source diff --git a/src/reflist.cpp b/src/reflist.cpp index e874653..57cd0c7 100644 --- a/src/reflist.cpp +++ b/src/reflist.cpp @@ -206,6 +206,6 @@ void RefList::generatePage() } doc += "\n"; //printf("generatePage('%s')\n",doc.data()); - addRelatedPage(m_listName,m_pageTitle,doc,0,m_fileName,1,0,0,0,TRUE); + addRelatedPage(m_listName,m_pageTitle,doc,m_fileName,1,0,0,0,TRUE); } diff --git a/src/section.h b/src/section.h index b6268a9..9e6c695 100644 --- a/src/section.h +++ b/src/section.h @@ -26,33 +26,18 @@ class Definition; /** Class representing a section in a page */ struct SectionInfo { - enum SectionType { Page = 0, - Section = 1, - Subsection = 2, - Subsubsection = 3, - Paragraph = 4, + enum SectionType { Page = 0, + Section = 1, + Subsection = 2, + Subsubsection = 3, + Paragraph = 4, Anchor = 5, Table = 6 }; SectionInfo(const char *f,const int lin,const char *l,const char *t, SectionType st,int lev,const char *r=0) : label(l), title(t), type(st), ref(r), definition(0), - fileName(f), lineNr(lin), generated(FALSE), level(lev) - { - } - SectionInfo(const SectionInfo &s) - { - label=s.label.copy(); - title=s.title.copy(); - type =s.type; - ref=s.ref.copy(); - definition=s.definition; - fileName=s.fileName.copy(); - lineNr=s.lineNr; - generated=s.generated; - level=s.level; - } - ~SectionInfo() {} + fileName(f), lineNr(lin), generated(FALSE), level(lev) {} QCString label; QCString title; SectionType type; diff --git a/src/tagreader.cpp b/src/tagreader.cpp index ef4888e..65336e3 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -1152,7 +1152,7 @@ void TagFileParser::addDocAnchors(const std::unique_ptr &e,const TagAncho SectionInfo *si=new SectionInfo(ta->fileName,-1,ta->label,ta->title, SectionInfo::Anchor,0,m_tagName); Doxygen::sectionDict->append(ta->label,si); - e->anchors->append(si); + e->anchors.push_back(si); } else { diff --git a/src/util.cpp b/src/util.cpp index 36d673b..523b437 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -6612,7 +6612,6 @@ found: PageDef *addRelatedPage(const char *name,const QCString &ptitle, const QCString &doc, - const QList * /*anchors*/, const char *fileName,int startLine, const QList *sli, GroupDef *gd, diff --git a/src/util.h b/src/util.h index 1bddc8a..81620c0 100644 --- a/src/util.h +++ b/src/util.h @@ -334,7 +334,6 @@ void addRefItem(const QList *sli,const char *prefix, PageDef *addRelatedPage(const char *name, const QCString &ptitle, const QCString &doc, - const QList *anchors, const char *fileName,int startLine, const QList *sli, GroupDef *gd=0, -- cgit v0.12