diff options
-rw-r--r-- | src/arguments.h | 2 | ||||
-rw-r--r-- | src/cite.cpp | 2 | ||||
-rw-r--r-- | src/classdef.cpp | 2 | ||||
-rw-r--r-- | src/code.l | 1 | ||||
-rw-r--r-- | src/commentscan.l | 35 | ||||
-rw-r--r-- | src/definition.cpp | 98 | ||||
-rw-r--r-- | src/definition.h | 7 | ||||
-rw-r--r-- | src/definitionimpl.h | 12 | ||||
-rw-r--r-- | src/docgroup.cpp | 21 | ||||
-rw-r--r-- | src/docgroup.h | 4 | ||||
-rw-r--r-- | src/docparser.cpp | 12 | ||||
-rw-r--r-- | src/doxygen.cpp | 187 | ||||
-rw-r--r-- | src/entry.cpp | 96 | ||||
-rw-r--r-- | src/entry.h | 21 | ||||
-rw-r--r-- | src/filedef.cpp | 2 | ||||
-rw-r--r-- | src/fortranscanner.l | 2 | ||||
-rw-r--r-- | src/groupdef.cpp | 53 | ||||
-rw-r--r-- | src/memberdef.cpp | 13 | ||||
-rw-r--r-- | src/memberdef.h | 2 | ||||
-rw-r--r-- | src/membergroup.cpp | 36 | ||||
-rw-r--r-- | src/membergroup.h | 15 | ||||
-rw-r--r-- | src/memberlist.h | 1 | ||||
-rw-r--r-- | src/namespacedef.cpp | 2 | ||||
-rw-r--r-- | src/pyscanner.l | 4 | ||||
-rw-r--r-- | src/reflist.cpp | 2 | ||||
-rw-r--r-- | src/scanner.l | 98 | ||||
-rw-r--r-- | src/section.h | 27 | ||||
-rw-r--r-- | src/tagreader.cpp | 99 | ||||
-rw-r--r-- | src/tclscanner.l | 2 | ||||
-rw-r--r-- | src/types.h | 1 | ||||
-rw-r--r-- | src/util.cpp | 25 | ||||
-rw-r--r-- | src/util.h | 7 | ||||
-rw-r--r-- | src/vhdldocgen.cpp | 1 | ||||
-rw-r--r-- | src/vhdljjparser.h | 1 |
34 files changed, 306 insertions, 587 deletions
diff --git a/src/arguments.h b/src/arguments.h index 58aaa4f..3464def 100644 --- a/src/arguments.h +++ b/src/arguments.h @@ -19,8 +19,6 @@ #include <vector> #include <qcstring.h> -class StorageIntf; - /*! \brief This class contains the information about the argument of a * function or template * diff --git a/src/cite.cpp b/src/cite.cpp index 42f695f..e3314ca 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); // 8. for latex we just copy the bib files to the output and let // latex do this work. diff --git a/src/classdef.cpp b/src/classdef.cpp index 88bec11..7ce6bf1 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -4432,7 +4432,7 @@ void ClassDefImpl::addListReferences() if (!isLinkableInProject()) return; //printf("ClassDef(%s)::addListReferences()\n",name().data()); { - QList<ListItemInfo> *xrefItems = xrefListItems(); + const std::vector<ListItemInfo> &xrefItems = xrefListItems(); addRefItem(xrefItems, qualifiedName(), lang==SrcLangExt_Fortran ? theTranslator->trType(TRUE,TRUE) @@ -2793,7 +2793,6 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_name.resize(0); } g_type.resize(0); - g_bracketCount=0; if (g_memCallContext==Body) { BEGIN(FuncCall); diff --git a/src/commentscan.l b/src/commentscan.l index edd4910..6e7d373 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -533,7 +533,7 @@ static void addXRefItem(const char *listName,const char *itemTitle, if (listName==0) return; //printf("addXRefItem(%s,%s,%s,%d)\n",listName,itemTitle,listTitle,append); - ListItemInfo *lii=0; + const ListItemInfo *lii=0; RefList *refList = Doxygen::xrefLists->find(listName); if (refList==0) // new list { @@ -541,16 +541,13 @@ static void addXRefItem(const char *listName,const char *itemTitle, Doxygen::xrefLists->insert(listName,refList); //printf("new list!\n"); } - if (current->sli) + for (const ListItemInfo &item : current->sli) { - QListIterator<ListItemInfo> slii(*current->sli); - for (slii.toLast();(lii=slii.current());--slii) + if (qstrcmp(item.type,listName)==0) { - if (qstrcmp(lii->type,listName)==0) - { - //printf("found %s lii->type=%s\n",listName,lii->type); - break; - } + //printf("found %s lii->type=%s\n",listName,lii->type); + lii = &item; + break; } } if (lii && append) // already found item of same type just before this one @@ -605,7 +602,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 +670,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 +847,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); } } @@ -1824,7 +1821,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 @@ -2141,8 +2138,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$" /* ----- handle argument of ingroup command ------- */ <InGroupParam>{LABELID} { // group id - current->groups->append( - new Grouping(yytext, Grouping::GROUPING_INGROUP) + current->groups.push_back( + Grouping(yytext, Grouping::GROUPING_INGROUP) ); inGroupParamFound=TRUE; } @@ -2224,8 +2221,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 +2244,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/definition.cpp b/src/definition.cpp index b44f2d1..5b2136c 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -15,6 +15,7 @@ * */ +#include <algorithm> #include <ctype.h> #include <qregexp.h> #include "md5.h" @@ -59,7 +60,7 @@ class DefinitionImpl::IMPL MemberSDict *sourceRefByDict; MemberSDict *sourceRefsDict; - QList<ListItemInfo> *xrefListItems; + std::vector<ListItemInfo> xrefListItems; GroupList *partOfGroups; DocInfo *details; // not exported @@ -97,7 +98,7 @@ class DefinitionImpl::IMPL DefinitionImpl::IMPL::IMPL() : sectionDict(0), sourceRefByDict(0), sourceRefsDict(0), - xrefListItems(0), partOfGroups(0), + partOfGroups(0), details(0), inbodyDocs(0), brief(0), body(0), hidden(FALSE), isArtificial(FALSE), outerScope(0), lang(SrcLangExt_Unknown) { @@ -109,7 +110,6 @@ DefinitionImpl::IMPL::~IMPL() delete sourceRefByDict; delete sourceRefsDict; delete partOfGroups; - delete xrefListItems; delete brief; delete details; delete body; @@ -150,7 +150,6 @@ void DefinitionImpl::IMPL::init(const char *df, const char *n) sectionDict = 0, outerScope = Doxygen::globalScope; partOfGroups = 0; - xrefListItems = 0; hidden = FALSE; isArtificial = FALSE; lang = SrcLangExt_Unknown; @@ -327,7 +326,6 @@ DefinitionImpl::DefinitionImpl(const DefinitionImpl &d) m_impl->sourceRefByDict = 0; m_impl->sourceRefsDict = 0; m_impl->partOfGroups = 0; - m_impl->xrefListItems = 0; m_impl->brief = 0; m_impl->details = 0; m_impl->body = 0; @@ -371,10 +369,6 @@ DefinitionImpl::DefinitionImpl(const DefinitionImpl &d) makePartOfGroup(gd); } } - if (d.m_impl->xrefListItems) - { - setRefItems(d.m_impl->xrefListItems); - } if (d.m_impl->brief) { m_impl->brief = new BriefInfo(*d.m_impl->brief); @@ -430,13 +424,10 @@ QCString DefinitionImpl::id() const return m_impl->id; } -void DefinitionImpl::addSectionsToDefinition(QList<SectionInfo> *anchorList) +void DefinitionImpl::addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList) { - if (!anchorList) return; //printf("%s: addSectionsToDefinition(%d)\n",name().data(),anchorList->count()); - QListIterator<SectionInfo> 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()); @@ -1617,76 +1608,47 @@ void DefinitionImpl::makePartOfGroup(GroupDef *gd) m_impl->partOfGroups->append(gd); } -void DefinitionImpl::setRefItems(const QList<ListItemInfo> *sli) +void DefinitionImpl::setRefItems(const std::vector<ListItemInfo> &sli) { - //printf("%s::setRefItems()\n",name().data()); - if (sli) - { - // deep copy the list - if (m_impl->xrefListItems==0) - { - m_impl->xrefListItems=new QList<ListItemInfo>; - m_impl->xrefListItems->setAutoDelete(TRUE); - } - QListIterator<ListItemInfo> slii(*sli); - ListItemInfo *lii; - for (slii.toFirst();(lii=slii.current());++slii) - { - m_impl->xrefListItems->append(new ListItemInfo(*lii)); - } - } + m_impl->xrefListItems = sli; } void DefinitionImpl::mergeRefItems(Definition *d) { - //printf("%s::mergeRefItems()\n",name().data()); - QList<ListItemInfo> *xrefList = d->xrefListItems(); - if (xrefList!=0) - { - // deep copy the list - if (m_impl->xrefListItems==0) - { - m_impl->xrefListItems=new QList<ListItemInfo>; - m_impl->xrefListItems->setAutoDelete(TRUE); - } - QListIterator<ListItemInfo> slii(*xrefList); - QListIterator<ListItemInfo> mlii(*m_impl->xrefListItems); - ListItemInfo *lii; - ListItemInfo *mii; - for (slii.toFirst();(lii=slii.current());++slii) - { - bool found = false; - for (mlii.toFirst();(mii=mlii.current());++mlii) - { - if ((qstrcmp(lii->type,mii->type)==0) && (lii->itemId == mii->itemId)) - { - found = true; - break; - } - } - if (!found) m_impl->xrefListItems->append(new ListItemInfo(*lii)); - } - } + auto otherXrefList = d->xrefListItems(); + + // append vectors + m_impl->xrefListItems.reserve(m_impl->xrefListItems.size()+otherXrefList.size()); + m_impl->xrefListItems.insert (m_impl->xrefListItems.end(), + otherXrefList.begin(),otherXrefList.end()); + + // sort results on itemId + std::sort(m_impl->xrefListItems.begin(),m_impl->xrefListItems.end(), + [](const ListItemInfo &left,const ListItemInfo &right) + { return left.itemId<right.itemId || + (left.itemId==right.itemId && qstrcmp(left.type,right.type)<0); + }); + + // filter out duplicates + auto last = std::unique(m_impl->xrefListItems.begin(),m_impl->xrefListItems.end(), + [](const ListItemInfo &left,const ListItemInfo &right) + { return left.itemId==right.itemId && left.type==right.type; }); + m_impl->xrefListItems.erase(last, m_impl->xrefListItems.end()); } int DefinitionImpl::_getXRefListId(const char *listName) const { - if (m_impl->xrefListItems) + for (const ListItemInfo &lii : m_impl->xrefListItems) { - QListIterator<ListItemInfo> slii(*m_impl->xrefListItems); - ListItemInfo *lii; - for (slii.toFirst();(lii=slii.current());++slii) + if (lii.type==listName) { - if (qstrcmp(lii->type,listName)==0) - { - return lii->itemId; - } + return lii.itemId; } } return -1; } -QList<ListItemInfo> *DefinitionImpl::xrefListItems() const +const std::vector<ListItemInfo> &DefinitionImpl::xrefListItems() const { return m_impl->xrefListItems; } diff --git a/src/definition.h b/src/definition.h index db9bbbc..d458683 100644 --- a/src/definition.h +++ b/src/definition.h @@ -18,6 +18,7 @@ #ifndef DEFINITION_H #define DEFINITION_H +#include <vector> #include <qlist.h> #include <qdict.h> @@ -257,7 +258,7 @@ class Definition : public DefinitionIntf virtual GroupList *partOfGroups() const = 0; virtual bool isLinkableViaGroup() const = 0; - virtual QList<ListItemInfo> *xrefListItems() const = 0; + virtual const std::vector<ListItemInfo> &xrefListItems() const = 0; virtual Definition *findInnerCompound(const char *name) const = 0; virtual Definition *getOuterScope() const = 0; @@ -313,7 +314,7 @@ class Definition : public DefinitionIntf virtual void setBodySegment(int bls,int ble) = 0; virtual void setBodyDef(FileDef *fd) = 0; - virtual void setRefItems(const QList<ListItemInfo> *sli) = 0; + virtual void setRefItems(const std::vector<ListItemInfo> &sli) = 0; virtual void setOuterScope(Definition *d) = 0; virtual void setHidden(bool b) = 0; @@ -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<SectionInfo> *anchorList) = 0; + virtual void addSectionsToDefinition(const std::vector<const SectionInfo*> &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..036c875 100644 --- a/src/definitionimpl.h +++ b/src/definitionimpl.h @@ -66,7 +66,7 @@ class DefinitionImpl : virtual public Definition virtual SrcLangExt getLanguage() const; virtual GroupList *partOfGroups() const; virtual bool isLinkableViaGroup() const; - virtual QList<ListItemInfo> *xrefListItems() const; + virtual const std::vector<ListItemInfo> &xrefListItems() const; virtual Definition *findInnerCompound(const char *name) const; virtual Definition *getOuterScope() const; virtual MemberSDict *getReferencesMembers() const; @@ -83,12 +83,12 @@ 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<SectionInfo> *anchorList); + virtual void addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList); virtual void setBodySegment(int bls,int ble); virtual void setBodyDef(FileDef *fd); virtual void addSourceReferencedBy(const MemberDef *d); virtual void addSourceReferences(const MemberDef *d); - virtual void setRefItems(const QList<ListItemInfo> *sli); + virtual void setRefItems(const std::vector<ListItemInfo> &sli); virtual void mergeRefItems(Definition *d); virtual void addInnerCompound(const Definition *d); virtual void setOuterScope(Definition *d); @@ -210,7 +210,7 @@ class DefinitionAliasImpl : virtual public Definition { return m_def->partOfGroups(); } virtual bool isLinkableViaGroup() const { return m_def->isLinkableViaGroup(); } - virtual QList<ListItemInfo> *xrefListItems() const + virtual const std::vector<ListItemInfo> &xrefListItems() const { return m_def->xrefListItems(); } virtual Definition *findInnerCompound(const char *name) const { return m_def->findInnerCompound(name); } @@ -241,12 +241,12 @@ 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<SectionInfo> *anchorList) {} + virtual void addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList) {} virtual void setBodySegment(int bls,int ble) {} virtual void setBodyDef(FileDef *fd) {} virtual void addSourceReferencedBy(const MemberDef *d) {} virtual void addSourceReferences(const MemberDef *d) {} - virtual void setRefItems(const QList<ListItemInfo> *sli) {} + virtual void setRefItems(const std::vector<ListItemInfo> &sli) {} virtual void mergeRefItems(Definition *d) {} virtual void addInnerCompound(const Definition *d) {} virtual void setOuterScope(Definition *d) {} diff --git a/src/docgroup.cpp b/src/docgroup.cpp index ecaa1af..fbdb842 100644 --- a/src/docgroup.cpp +++ b/src/docgroup.cpp @@ -23,7 +23,6 @@ void DocGroup::enterFile(const char *fileName,int) { m_openCount = 0; - m_autoGroupStack.setAutoDelete(TRUE); m_autoGroupStack.clear(); m_memberGroupId = DOX_NOGROUP; m_memberGroupDocs.resize(0); @@ -40,7 +39,7 @@ void DocGroup::leaveFile(const char *fileName,int line) m_memberGroupId=DOX_NOGROUP; m_memberGroupRelates.resize(0); m_memberGroupDocs.resize(0); - if (!m_autoGroupStack.isEmpty()) + if (!m_autoGroupStack.empty()) { warn(fileName,line,"end of file while inside a group"); } @@ -109,10 +108,10 @@ void DocGroup::open(Entry *e,const char *,int, bool implicit) { if (!implicit) m_openCount++; //printf("==> openGroup(name=%s,sec=%x) m_autoGroupStack=%d\n", - // e->name.data(),e->section,m_autoGroupStack.count()); + // e->name.data(),e->section,m_autoGroupStack.size()); if (e->section==Entry::GROUPDOC_SEC) // auto group { - m_autoGroupStack.push(new Grouping(e->name,e->groupingPri())); + m_autoGroupStack.push_back(Grouping(e->name,e->groupingPri())); } else // start of a member group { @@ -148,7 +147,7 @@ void DocGroup::close(Entry *e,const char *fileName,int line,bool foundInline,boo } } //printf("==> closeGroup(name=%s,sec=%x,file=%s,line=%d) m_autoGroupStack=%d\n", - // e->name.data(),e->section,fileName,line,m_autoGroupStack.count()); + // e->name.data(),e->section,fileName,line,m_autoGroupStack.size()); if (m_memberGroupId!=DOX_NOGROUP) // end of member group { MemberGroupInfo *info=Doxygen::memGrpInfoDict.find(m_memberGroupId); @@ -164,13 +163,13 @@ void DocGroup::close(Entry *e,const char *fileName,int line,bool foundInline,boo if (!foundInline) e->mGrpId=DOX_NOGROUP; //printf("new group id=%d\n",m_memberGroupId); } - else if (!m_autoGroupStack.isEmpty()) // end of auto group + else if (!m_autoGroupStack.empty()) // end of auto group { - Grouping *grp = m_autoGroupStack.pop(); + Grouping grp = m_autoGroupStack.back(); + m_autoGroupStack.pop_back(); // see bug577005: we should not remove the last group for e - if (!foundInline) e->groups->removeLast(); + if (!foundInline && !e->groups.empty()) e->groups.pop_back(); //printf("Removing %s e=%p\n",grp->groupname.data(),e); - delete grp; if (!foundInline) initGroupInfo(e); } } @@ -181,12 +180,12 @@ void DocGroup::initGroupInfo(Entry *e) // m_memberGroupRelates.data(),e); e->mGrpId = m_memberGroupId; e->relates = m_memberGroupRelates; - if (!m_autoGroupStack.isEmpty()) + if (!m_autoGroupStack.empty()) { //printf("Appending group %s to %s: count=%d entry=%p\n", // m_autoGroupStack.top()->groupname.data(), // e->name.data(),e->groups->count(),e); - e->groups->append(new Grouping(*m_autoGroupStack.top())); + e->groups.push_back(Grouping(m_autoGroupStack.back())); } } diff --git a/src/docgroup.h b/src/docgroup.h index 4775d90..47a0a3e 100644 --- a/src/docgroup.h +++ b/src/docgroup.h @@ -16,7 +16,7 @@ #ifndef DOCGROUP_H #define DOCGROUP_H -#include <qstack.h> +#include <vector> #include <qstring.h> #include "membergroup.h" @@ -47,7 +47,7 @@ class DocGroup int m_memberGroupId; QCString m_memberGroupRelates; QCString m_memberGroupDocs; - QStack<Grouping> m_autoGroupStack; + std::vector<Grouping> m_autoGroupStack; QCString m_compoundName; }; diff --git a/src/docparser.cpp b/src/docparser.cpp index 48b46a9..4f52393 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -503,7 +503,7 @@ static void checkUnOrMultipleDocumentedParams() SrcLangExt lang = g_memberDef->getLanguage(); if (!al.empty()) { - bool found=FALSE; + int notArgCnt=0; for (const Argument &a: al) { int count = 0; @@ -518,7 +518,7 @@ static void checkUnOrMultipleDocumentedParams() } else if (!argName.isEmpty() && g_paramsFound.find(argName)==0 && a.docs.isEmpty()) { - found = TRUE; + notArgCnt++; } else { @@ -539,14 +539,16 @@ static void checkUnOrMultipleDocumentedParams() " has multiple @param documentation sections"); } } - if (found) + if (notArgCnt>0) { bool first=TRUE; QCString errMsg= - "The following parameters of "+ + "The following parameter"; + errMsg+= (notArgCnt>1 ? "s" : ""); + errMsg+=" of "+ QCString(g_memberDef->qualifiedName()) + QCString(argListToString(al)) + - " are not documented:\n"; + (notArgCnt>1 ? " are" : " is") + " not documented:\n"; for (const Argument &a : al) { QCString argName = g_memberDef->isDefine() ? a.type : a.name; diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 2a254ff..4f4d13b 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) { @@ -544,7 +544,7 @@ static void addSTLClasses(const std::unique_ptr<Entry> &root) //---------------------------------------------------------------------------- static Definition *findScopeFromQualifiedName(Definition *startScope,const QCString &n, - FileDef *fileScope,TagInfo *tagInfo); + FileDef *fileScope,const TagInfo *tagInfo); static void addPageToContext(PageDef *pd,Entry *root) { @@ -557,7 +557,7 @@ static void addPageToContext(PageDef *pd,Entry *root) } scope = stripAnonymousNamespaceScope(scope); scope+="::"+pd->name(); - Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,scope,0,root->tagInfo); + Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,scope,0,root->tagInfo()); if (d) { pd->setPageScope(d); @@ -568,11 +568,9 @@ static void addPageToContext(PageDef *pd,Entry *root) static void addRelatedPage(Entry *root) { GroupDef *gd=0; - QListIterator<Grouping> gli(*root->groups); - Grouping *g; - for (;(g=gli.current());++gli) + for (const Grouping &g : root->groups) { - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) break; + if (!g.groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g.groupname))) break; } //printf("---> addRelatedPage() %s gd=%p\n",root->name.data(),gd); QCString doc; @@ -585,10 +583,10 @@ 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, + gd,root->tagInfo(), FALSE, root->lang ); @@ -604,8 +602,8 @@ static void addRelatedPage(Entry *root) static void buildGroupListFiltered(const Entry *root,bool additional, bool includeExternal) { if (root->section==Entry::GROUPDOC_SEC && !root->name.isEmpty() && - ((!includeExternal && root->tagInfo==0) || - ( includeExternal && root->tagInfo!=0)) + ((!includeExternal && root->tagInfo()==0) || + ( includeExternal && root->tagInfo()!=0)) ) { if ((root->groupDocType==Entry::GROUPDOC_NORMAL && !additional) || @@ -636,10 +634,10 @@ static void buildGroupListFiltered(const Entry *root,bool additional, bool inclu } else { - if (root->tagInfo) + if (root->tagInfo()) { - gd = createGroupDef(root->fileName,root->startLine,root->name,root->type,root->tagInfo->fileName); - gd->setReference(root->tagInfo->tagName); + gd = createGroupDef(root->fileName,root->startLine,root->name,root->type,root->tagInfo()->fileName); + gd->setReference(root->tagInfo()->tagName); } else { @@ -689,7 +687,7 @@ static void findGroupScope(const Entry *root) } scope = stripAnonymousNamespaceScope(scope); scope+="::"+gd->name(); - Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,scope,0,root->tagInfo); + Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,scope,0,root->tagInfo()); if (d) { gd->setGroupScope(d); @@ -733,7 +731,7 @@ static void buildFileList(const Entry *root) { if (((root->section==Entry::FILEDOC_SEC) || ((root->section & Entry::FILE_MASK) && Config_getBool(EXTRACT_ALL))) && - !root->name.isEmpty() && !root->tagInfo // skip any file coming from tag files + !root->name.isEmpty() && !root->tagInfo() // skip any file coming from tag files ) { bool ambig; @@ -759,12 +757,10 @@ static void buildFileList(const Entry *root) fd->setBriefDescription(root->brief,root->briefFile,root->briefLine); fd->addSectionsToDefinition(root->anchors); fd->setRefItems(root->sli); - QListIterator<Grouping> gli(*root->groups); - Grouping *g; - for (;(g=gli.current());++gli) + for (const Grouping &g : root->groups) { GroupDef *gd=0; - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) + if (!g.groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g.groupname))) { gd->addFile(fd); fd->makePartOfGroup(gd); @@ -955,7 +951,7 @@ static Definition *findScope(Entry *root,int level=0) * not found and set the parent/child scope relation if the scope is found. */ static Definition *buildScopeFromQualifiedName(const QCString name, - int level,SrcLangExt lang,TagInfo *tagInfo) + int level,SrcLangExt lang,const TagInfo *tagInfo) { //printf("buildScopeFromQualifiedName(%s) level=%d\n",name.data(),level); int i=0; @@ -1014,7 +1010,7 @@ static Definition *buildScopeFromQualifiedName(const QCString name, } static Definition *findScopeFromQualifiedName(Definition *startScope,const QCString &n, - FileDef *fileScope,TagInfo *tagInfo) + FileDef *fileScope,const TagInfo *tagInfo) { //printf("<findScopeFromQualifiedName(%s,%s)\n",startScope ? startScope->name().data() : 0, n.data()); Definition *resultScope=startScope; @@ -1261,7 +1257,7 @@ static void addClassToContext(const Entry *root) QCString tagName; QCString refFileName; - TagInfo *tagInfo = root->tagInfo; + const TagInfo *tagInfo = root->tagInfo(); int i; if (tagInfo) { @@ -1415,7 +1411,7 @@ static void resolveClassNestingRelations() d->addInnerCompound(aliasCd); QCString aliasFullName = d->qualifiedName()+"::"+aliasCd->localName(); Doxygen::classSDict->append(aliasFullName,aliasCd); - printf("adding %s to %s as %s\n",qPrint(aliasCd->name()),qPrint(d->name()),qPrint(aliasFullName)); + //printf("adding %s to %s as %s\n",qPrint(aliasCd->name()),qPrint(d->name()),qPrint(aliasFullName)); aliasCd->setVisited(TRUE); } } @@ -1716,7 +1712,7 @@ static void buildNamespaceList(const Entry *root) { nd->setLanguage(root->lang); } - if (root->tagInfo==0) // if we found the namespace in a tag file + if (root->tagInfo()==0) // if we found the namespace in a tag file // and also in a project file, then remove // the tag file reference { @@ -1736,7 +1732,7 @@ static void buildNamespaceList(const Entry *root) { QCString tagName; QCString tagFileName; - TagInfo *tagInfo = root->tagInfo; + const TagInfo *tagInfo = root->tagInfo(); if (tagInfo) { tagName = tagInfo->tagName; @@ -1947,12 +1943,13 @@ static void findUsingDirectives(const Entry *root) nd->setMetaData(root->metaData); nd->setInline((root->spec&Entry::Inline)!=0); - QListIterator<Grouping> gli(*root->groups); - Grouping *g; - for (;(g=gli.current());++gli) + //QListIterator<Grouping> gli(*root->groups); + //Grouping *g; + //for (;(g=gli.current());++gli) + for (const Grouping &g : root->groups) { GroupDef *gd=0; - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) + if (!g.groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g.groupname))) gd->addNamespace(nd); } @@ -2124,9 +2121,9 @@ static void findUsingDeclImports(const Entry *root) MemberDef *newMd = 0; { QCString fileName = root->fileName; - if (fileName.isEmpty() && root->tagInfo) + if (fileName.isEmpty() && root->tagInfo()) { - fileName = root->tagInfo->tagName; + fileName = root->tagInfo()->tagName; } const ArgumentList &templAl = md->templateArguments(); const ArgumentList &al = md->templateArguments(); @@ -2319,9 +2316,9 @@ static MemberDef *addVariableToClass( } QCString fileName = root->fileName; - if (fileName.isEmpty() && root->tagInfo) + if (fileName.isEmpty() && root->tagInfo()) { - fileName = root->tagInfo->tagName; + fileName = root->tagInfo()->tagName; } // new member variable, typedef or enum value @@ -2331,7 +2328,7 @@ static MemberDef *addVariableToClass( prot,Normal,root->stat,related, mtype,!root->tArgLists.empty() ? root->tArgLists.back() : ArgumentList(), ArgumentList(), root->metaData); - md->setTagInfo(root->tagInfo); + md->setTagInfo(root->tagInfo()); md->setMemberClass(cd); // also sets outer scope (i.e. getOuterScope()) //md->setDefFile(root->fileName); //md->setDefLine(root->startLine); @@ -2577,13 +2574,13 @@ static MemberDef *addVariableToFile( } QCString fileName = root->fileName; - if (fileName.isEmpty() && root->tagInfo) + if (fileName.isEmpty() && root->tagInfo()) { - fileName = root->tagInfo->tagName; + fileName = root->tagInfo()->tagName; } Debug::print(Debug::Variables,0, - " new variable, nd=%s tagInfo=%p!\n",nd?qPrint(nd->name()):"<global>",root->tagInfo); + " new variable, nd=%s tagInfo=%p!\n",nd?qPrint(nd->name()):"<global>",root->tagInfo()); // new global variable, enum value or typedef MemberDef *md=createMemberDef( fileName,root->startLine,root->startColumn, @@ -2591,7 +2588,7 @@ static MemberDef *addVariableToFile( root->protection, Normal,root->stat,Member, mtype,!root->tArgLists.empty() ? root->tArgLists.back() : ArgumentList(), ArgumentList(), root->metaData); - md->setTagInfo(root->tagInfo); + md->setTagInfo(root->tagInfo()); md->setMemberSpecifiers(root->spec); md->setDocumentation(root->doc,root->docFile,root->docLine); md->setBriefDescription(root->brief,root->briefFile,root->briefLine); @@ -3114,15 +3111,15 @@ static void addInterfaceOrServiceToServiceOrSingleton( ? MemberType_Interface : MemberType_Service; QCString fileName = root->fileName; - if (fileName.isEmpty() && root->tagInfo) + if (fileName.isEmpty() && root->tagInfo()) { - fileName = root->tagInfo->tagName; + fileName = root->tagInfo()->tagName; } MemberDef *const md = createMemberDef( fileName, root->startLine, root->startColumn, root->type, rname, "", "", root->protection, root->virt, root->stat, Member, type, ArgumentList(), root->argList, root->metaData); - md->setTagInfo(root->tagInfo); + md->setTagInfo(root->tagInfo()); md->setMemberClass(cd); md->setDocumentation(root->doc,root->docFile,root->docLine); md->setDocsForDefinition(false); @@ -3292,9 +3289,9 @@ static void addMethodToClass(const Entry *root,ClassDef *cd, } QCString fileName = root->fileName; - if (fileName.isEmpty() && root->tagInfo) + if (fileName.isEmpty() && root->tagInfo()) { - fileName = root->tagInfo->tagName; + fileName = root->tagInfo()->tagName; } //printf("root->name='%s; args='%s' root->argList='%s'\n", @@ -3311,7 +3308,7 @@ static void addMethodToClass(const Entry *root,ClassDef *cd, root->relatesType == MemberOf ? Foreign : Related, mtype,!root->tArgLists.empty() ? root->tArgLists.back() : ArgumentList(), root->argList, root->metaData); - md->setTagInfo(root->tagInfo); + md->setTagInfo(root->tagInfo()); md->setMemberClass(cd); md->setDocumentation(root->doc,root->docFile,root->docLine); md->setDocsForDefinition(!root->proto); @@ -3575,9 +3572,9 @@ static void buildFunctionList(const Entry *root) ) { GroupDef *gd=0; - if (root->groups->getFirst() && !root->groups->getFirst()->groupname.isEmpty()) + if (!root->groups.empty() && !root->groups.front().groupname.isEmpty()) { - gd = Doxygen::groupSDict->find(root->groups->getFirst()->groupname); + gd = Doxygen::groupSDict->find(root->groups.front().groupname); } //printf("match!\n"); //printf("mnd=%p rnd=%p nsName=%s rnsName=%s\n",mnd,rnd,nsName.data(),rnsName.data()); @@ -3641,16 +3638,15 @@ static void buildFunctionList(const Entry *root) md->enableReferencesRelation(md->hasReferencesRelation() || root->referencesRelation); // merge ingroup specifiers - if (md->getGroupDef()==0 && root->groups->getFirst()!=0) + if (md->getGroupDef()==0 && !root->groups.empty()) { addMemberToGroups(root,md); } - else if (md->getGroupDef()!=0 && root->groups->count()==0) + else if (md->getGroupDef()!=0 && root->groups.empty()) { //printf("existing member is grouped, new member not\n"); - root->groups->append(new Grouping(md->getGroupDef()->name(), md->getGroupPri())); } - else if (md->getGroupDef()!=0 && root->groups->getFirst()!=0) + else if (md->getGroupDef()!=0 && !root->groups.empty()) { //printf("both members are grouped\n"); } @@ -3688,7 +3684,7 @@ static void buildFunctionList(const Entry *root) !root->tArgLists.empty() ? root->tArgLists.back() : ArgumentList(), root->argList,root->metaData); - md->setTagInfo(root->tagInfo); + md->setTagInfo(root->tagInfo()); md->setLanguage(root->lang); md->setId(root->id); //md->setDefFile(root->fileName); @@ -3943,7 +3939,7 @@ static void transferFunctionDocumentation() MemberNameIterator mni2(*mn); for (;(mdef=mni2.current());++mni2) { - if (!mdec->isAlias() && !mdef->isAlias()) + if (mdec!=mdef && !mdec->isAlias() && !mdef->isAlias()) { combineDeclarationAndDefinition(mdec,mdef); } @@ -4340,20 +4336,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 +4544,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 +4772,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 { @@ -4833,7 +4827,7 @@ static bool findClassRelation( int si = baseClassName.findRev("::"); if (si!=-1) // class is nested { - Definition *sd = findScopeFromQualifiedName(Doxygen::globalScope,baseClassName.left(si),0,root->tagInfo); + Definition *sd = findScopeFromQualifiedName(Doxygen::globalScope,baseClassName.left(si),0,root->tagInfo()); if (sd==0 || sd==Doxygen::globalScope) // outer scope not found { baseClass->setArtificial(TRUE); // see bug678139 @@ -4916,8 +4910,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 +5041,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 +5076,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)) { @@ -5189,7 +5180,7 @@ static void addListReferences() name = pd->getGroupDef()->getOutputFileBase(); } { - QList<ListItemInfo> *xrefItems = pd->xrefListItems(); + const std::vector<ListItemInfo> &xrefItems = pd->xrefListItems(); addRefItem(xrefItems, name, theTranslator->trPage(TRUE,TRUE), @@ -5206,7 +5197,7 @@ static void addListReferences() //{ // name = dd->getGroupDef()->getOutputFileBase(); //} - QList<ListItemInfo> *xrefItems = dd->xrefListItems(); + const std::vector<ListItemInfo> &xrefItems = dd->xrefListItems(); addRefItem(xrefItems, name, theTranslator->trDir(TRUE,TRUE), @@ -6355,7 +6346,7 @@ static void findMember(const Entry *root, root->virt,root->stat,Member, mtype,tArgList,root->argList,root->metaData); //printf("new specialized member %s args='%s'\n",md->name().data(),funcArgs.data()); - md->setTagInfo(root->tagInfo); + md->setTagInfo(root->tagInfo()); md->setLanguage(root->lang); md->setId(root->id); md->setMemberClass(cd); @@ -6422,7 +6413,7 @@ static void findMember(const Entry *root, funcType,funcName,funcArgs,exceptions, root->protection,root->virt,root->stat,Related, mtype,tArgList,root->argList,root->metaData); - md->setTagInfo(root->tagInfo); + md->setTagInfo(root->tagInfo()); md->setLanguage(root->lang); md->setId(root->id); md->setTypeConstraints(root->typeConstr); @@ -6582,7 +6573,7 @@ static void findMember(const Entry *root, // md->setDefinitionTemplateParameterLists(root->tArgLists); - md->setTagInfo(root->tagInfo); + md->setTagInfo(root->tagInfo()); @@ -6703,7 +6694,7 @@ localObjCMethod: funcType,funcName,funcArgs,exceptions, root->protection,root->virt,root->stat,Member, MemberType_Function,ArgumentList(),root->argList,root->metaData); - md->setTagInfo(root->tagInfo); + md->setTagInfo(root->tagInfo()); md->setLanguage(root->lang); md->setId(root->id); md->makeImplementationDetail(); @@ -7058,7 +7049,7 @@ static void findEnums(const Entry *root) isMemberOf ? Foreign : isRelated ? Related : Member, MemberType_Enumeration, ArgumentList(),ArgumentList(),root->metaData); - md->setTagInfo(root->tagInfo); + md->setTagInfo(root->tagInfo()); md->setLanguage(root->lang); md->setId(root->id); if (!isGlobal) md->setMemberClass(cd); else md->setFileDef(fd); @@ -7256,7 +7247,7 @@ static void addEnumValuesToEnums(const Entry *root) //printf("md->qualifiedName()=%s e->name=%s tagInfo=%p name=%s\n", // md->qualifiedName().data(),e->name.data(),e->tagInfo,e->name.data()); QCString qualifiedName = substitute(root->name,"::","."); - if (!scope.isEmpty() && root->tagInfo) + if (!scope.isEmpty() && root->tagInfo()) { qualifiedName=substitute(scope,"::",".")+"."+qualifiedName; } @@ -7265,9 +7256,9 @@ static void addEnumValuesToEnums(const Entry *root) ) { QCString fileName = e->fileName; - if (fileName.isEmpty() && e->tagInfo) + if (fileName.isEmpty() && e->tagInfo()) { - fileName = e->tagInfo->tagName; + fileName = e->tagInfo()->tagName; } MemberDef *fmd=createMemberDef( fileName,e->startLine,e->startColumn, @@ -7278,7 +7269,7 @@ static void addEnumValuesToEnums(const Entry *root) else if (md->getNamespaceDef()) fmd->setNamespace(md->getNamespaceDef()); else if (md->getFileDef()) fmd->setFileDef(md->getFileDef()); fmd->setOuterScope(md->getOuterScope()); - fmd->setTagInfo(e->tagInfo); + fmd->setTagInfo(e->tagInfo()); fmd->setLanguage(e->lang); fmd->setId(e->id); fmd->setDocumentation(e->doc,e->docFile,e->docLine); @@ -7460,7 +7451,7 @@ static void findEnumDocumentation(const Entry *root) md->setRefItems(root->sli); const GroupDef *gd=md->getGroupDef(); - if (gd==0 &&root->groups->getFirst()!=0) // member not grouped but out-of-line documentation is + if (gd==0 && !root->groups.empty()) // member not grouped but out-of-line documentation is { addMemberToGroups(root,md); } @@ -7494,7 +7485,7 @@ static void findEnumDocumentation(const Entry *root) md->setMemberGroupId(root->mGrpId); const GroupDef *gd=md->getGroupDef(); - if (gd==0 && root->groups->getFirst()!=0) // member not grouped but out-of-line documentation is + if (gd==0 && !root->groups.empty()) // member not grouped but out-of-line documentation is { addMemberToGroups(root,md); } @@ -8503,13 +8494,13 @@ static void findDefineDocumentation(Entry *root) //printf("found define '%s' '%s' brief='%s' doc='%s'\n", // root->name.data(),root->args.data(),root->brief.data(),root->doc.data()); - if (root->tagInfo && !root->name.isEmpty()) // define read from a tag file + if (root->tagInfo() && !root->name.isEmpty()) // define read from a tag file { - MemberDef *md=createMemberDef(root->tagInfo->tagName,1,1, + MemberDef *md=createMemberDef(root->tagInfo()->tagName,1,1, "#define",root->name,root->args,0, Public,Normal,FALSE,Member,MemberType_Define, ArgumentList(),ArgumentList(),""); - md->setTagInfo(root->tagInfo); + md->setTagInfo(root->tagInfo()); md->setLanguage(root->lang); //printf("Searching for '%s' fd=%p\n",filePathName.data(),fd); md->setFileDef(root->parent()->fileDef()); @@ -8728,7 +8719,7 @@ static void findMainPage(Entry *root) { if (root->section == Entry::MAINPAGEDOC_SEC) { - if (Doxygen::mainPage==0 && root->tagInfo==0) + if (Doxygen::mainPage==0 && root->tagInfo()==0) { //printf("Found main page! \n======\n%s\n=======\n",root->doc.data()); QCString title=root->args.stripWhiteSpace(); @@ -8767,7 +8758,7 @@ static void findMainPage(Entry *root) Doxygen::mainPage->addSectionsToDefinition(root->anchors); } } - else if (root->tagInfo==0) + else if (root->tagInfo()==0) { warn(root->fileName,root->startLine, "found more than one \\mainpage comment block! (first occurrence: %s, line %d), Skipping current block!", @@ -8782,7 +8773,7 @@ static void findMainPageTagFiles(Entry *root) { if (root->section == Entry::MAINPAGEDOC_SEC) { - if (Doxygen::mainPage && root->tagInfo) + if (Doxygen::mainPage && root->tagInfo()) { Doxygen::mainPage->addSectionsToDefinition(root->anchors); } @@ -8803,11 +8794,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 e700fab..066c4a0 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -38,15 +38,9 @@ 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! //printf("Entry::Entry() tArgList=0\n"); mGrpId = -1; - tagInfo = 0; - sli = 0; + hasTagInfo = FALSE; relatesType = Simple; hidden = FALSE; groupDocType = GROUPDOC_NORMAL; @@ -60,7 +54,8 @@ Entry::Entry(const Entry &e) section = e.section; type = e.type; name = e.name; - tagInfo = e.tagInfo; + hasTagInfo = e.hasTagInfo; + tagInfoData = e.tagInfoData; protection = e.protection; mtype = e.mtype; spec = e.spec; @@ -102,69 +97,27 @@ 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>; + anchors = e.anchors; fileName = e.fileName; startLine = e.startLine; startColumn = e.startColumn; - if (e.sli) - { - sli = new QList<ListItemInfo>; - sli->setAutoDelete(TRUE); - QListIterator<ListItemInfo> slii(*e.sli); - ListItemInfo *ili; - for (slii.toFirst();(ili=slii.current());++slii) - { - sli->append(new ListItemInfo(*ili)); - } - } - else - { - sli=0; - } + sli = e.sli; lang = e.lang; hidden = e.hidden; artificial = e.artificial; groupDocType = e.groupDocType; id = e.id; + extends = e.extends; + groups = e.groups; + m_fileDef = e.m_fileDef; m_parent = e.m_parent; - // deep copy child entries m_sublist.reserve(e.m_sublist.size()); for (const auto &cur : e.m_sublist) { 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)); - } - - // deep copy group list - QListIterator<Grouping> gli(*e.groups); - Grouping *g; - for (;(g=gli.current());++gli) - { - groups->append(new Grouping(*g)); - } - - QListIterator<SectionInfo> 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; - } Entry::~Entry() @@ -173,11 +126,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 tagInfo; - delete sli; num--; } @@ -302,24 +250,17 @@ void Entry::reset() id.resize(0); metaData.resize(0); m_sublist.clear(); - extends->clear(); - groups->clear(); - anchors->clear(); + extends.clear(); + groups.clear(); + anchors.clear(); argList.clear(); tArgLists.clear(); argList.reset(); typeConstr.reset(); - if (tagInfo) { delete tagInfo; tagInfo=0; } - if (sli) { delete sli; sli=0; } + sli.clear(); m_fileDef = 0; } - -int Entry::getSize() -{ - return sizeof(Entry); -} - void Entry::setFileDef(FileDef *fd) { m_fileDef = fd; @@ -331,15 +272,10 @@ void Entry::setFileDef(FileDef *fd) void Entry::addSpecialListItem(const char *listName,int itemId) { - if (sli==0) - { - sli = new QList<ListItemInfo>; - sli->setAutoDelete(TRUE); - } - ListItemInfo *ili=new ListItemInfo; - ili->type = listName; - ili->itemId = itemId; - sli->append(ili); + ListItemInfo ili; + ili.type = listName; + ili.itemId = itemId; + sli.push_back(ili); } diff --git a/src/entry.h b/src/entry.h index 12bd897..9d4ae9d 100644 --- a/src/entry.h +++ b/src/entry.h @@ -18,7 +18,6 @@ #ifndef ENTRY_H #define ENTRY_H -#include <qlist.h> #include <qgstring.h> #include <vector> @@ -30,8 +29,6 @@ struct SectionInfo; class QFile; class FileDef; -class FileStorage; -class StorageIntf; struct ListItemInfo; /** This class stores information about an inheritance relation @@ -197,9 +194,6 @@ class Entry Entry(const Entry &); ~Entry(); - /*! Returns the static size of the Entry (so excluding any dynamic memory) */ - int getSize(); - void addSpecialListItem(const char *listName,int index); /*! Returns the parent for this Entry or 0 if this entry has no parent. */ @@ -208,7 +202,6 @@ class Entry /*! Returns the list of children for this Entry * @see addSubEntry() and removeSubEntry() */ - //const QList<Entry> *children() const { return m_sublist; } const std::vector< std::unique_ptr<Entry> > &children() const { return m_sublist; } /*! @name add entry as a child and pass ownership. @@ -244,13 +237,13 @@ class Entry void setFileDef(FileDef *fd); FileDef *fileDef() const { return m_fileDef; } - public: - // identification int section; //!< entry type (see Sections); QCString type; //!< member type QCString name; //!< member name - TagInfo *tagInfo; //!< tag file info + bool hasTagInfo; //!< is tag info valid + TagInfo tagInfoData; //!< tag file info data + const TagInfo *tagInfo() const { return hasTagInfo ? &tagInfoData : 0; } // content Protection protection; //!< class protection @@ -293,13 +286,13 @@ 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 - QList<Grouping> *groups; //!< list of groups this entry belongs to - QList<SectionInfo> *anchors; //!< list of anchors defined in this entry + std::vector<BaseInfo> extends; //!< list of base classes + std::vector<Grouping> groups; //!< list of groups this entry belongs to + std::vector<const SectionInfo*> 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 - QList<ListItemInfo> *sli; //!< special lists (test/todo/bug/deprecated/..) this entry is in + std::vector<ListItemInfo> sli; //!< special lists (test/todo/bug/deprecated/..) this entry is in SrcLangExt lang; //!< programming language in which this entry was found bool hidden; //!< does this represent an entity that is hidden from the output bool artificial; //!< Artificially introduced item diff --git a/src/filedef.cpp b/src/filedef.cpp index e4f6c86..f358dba 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -1680,7 +1680,7 @@ bool FileDefImpl::generateSourceFile() const void FileDefImpl::addListReferences() { { - QList<ListItemInfo> *xrefItems = xrefListItems(); + const std::vector<ListItemInfo> &xrefItems = xrefListItems(); addRefItem(xrefItems, getOutputFileBase(), theTranslator->trFile(TRUE,TRUE), 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/groupdef.cpp b/src/groupdef.cpp index bcdb3d0..0d6d43f 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -1460,12 +1460,10 @@ void GroupDefImpl::writeQuickMemberLinks(OutputList &ol,const MemberDef *current void addClassToGroups(const Entry *root,ClassDef *cd) { - QListIterator<Grouping> gli(*root->groups); - Grouping *g; - for (;(g=gli.current());++gli) + for (const Grouping &g : root->groups) { GroupDef *gd=0; - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) + if (!g.groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g.groupname))) { if (gd->addClass(cd)) { @@ -1478,14 +1476,12 @@ void addClassToGroups(const Entry *root,ClassDef *cd) void addNamespaceToGroups(const Entry *root,NamespaceDef *nd) { - //printf("root->groups->count()=%d\n",root->groups->count()); - QListIterator<Grouping> gli(*root->groups); - Grouping *g; - for (;(g=gli.current());++gli) + //printf("root->groups.size()=%d\n",root->groups.size()); + for (const Grouping &g : root->groups) { GroupDef *gd=0; //printf("group '%s'\n",s->data()); - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) + if (!g.groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g.groupname))) { if (gd->addNamespace(nd)) nd->makePartOfGroup(gd); //printf("Namespace %s: in group %s\n",nd->name().data(),s->data()); @@ -1495,14 +1491,12 @@ void addNamespaceToGroups(const Entry *root,NamespaceDef *nd) void addDirToGroups(const Entry *root,DirDef *dd) { - //printf("*** root->groups->count()=%d\n",root->groups->count()); - QListIterator<Grouping> gli(*root->groups); - Grouping *g; - for (;(g=gli.current());++gli) + //printf("*** root->groups.size()=%d\n",root->groups.size()); + for (const Grouping &g : root->groups) { GroupDef *gd=0; //printf("group '%s'\n",g->groupname.data()); - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) + if (!g.groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g.groupname))) { gd->addDir(dd); dd->makePartOfGroup(gd); @@ -1513,14 +1507,11 @@ void addDirToGroups(const Entry *root,DirDef *dd) void addGroupToGroups(const Entry *root,GroupDef *subGroup) { - //printf("addGroupToGroups for %s groups=%d\n",root->name.data(), - // root->groups?root->groups->count():-1); - QListIterator<Grouping> gli(*root->groups); - Grouping *g; - for (;(g=gli.current());++gli) + //printf("addGroupToGroups for %s groups=%d\n",root->name.data(),root->groups.size()); + for (const Grouping &g : root->groups) { GroupDef *gd=0; - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) + if (!g.groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g.groupname))) { if (gd==subGroup) { @@ -1546,20 +1537,18 @@ void addMemberToGroups(const Entry *root,MemberDef *md) { //printf("addMemberToGroups: Root %p = %s, md %p=%s groups=%d\n", // root, root->name.data(), md, md->name().data(), root->groups->count() ); - QListIterator<Grouping> gli(*root->groups); - Grouping *g; // Search entry's group list for group with highest pri. Grouping::GroupPri_t pri = Grouping::GROUPING_LOWEST; GroupDef *fgd=0; - for (;(g=gli.current());++gli) + for (const Grouping &g : root->groups) { GroupDef *gd=0; - if (!g->groupname.isEmpty() && - (gd=Doxygen::groupSDict->find(g->groupname)) && - g->pri >= pri) + if (!g.groupname.isEmpty() && + (gd=Doxygen::groupSDict->find(g.groupname)) && + g.pri >= pri) { - if (fgd && gd!=fgd && g->pri==pri) + if (fgd && gd!=fgd && g.pri==pri) { warn(root->fileName.data(), root->startLine, "Member %s found in multiple %s groups! " @@ -1570,7 +1559,7 @@ void addMemberToGroups(const Entry *root,MemberDef *md) } fgd = gd; - pri = g->pri; + pri = g.pri; } } //printf("fgd=%p\n",fgd); @@ -1650,12 +1639,10 @@ void addMemberToGroups(const Entry *root,MemberDef *md) void addExampleToGroups(const Entry *root,PageDef *eg) { - QListIterator<Grouping> gli(*root->groups); - Grouping *g; - for (;(g=gli.current());++gli) + for (const Grouping &g : root->groups) { GroupDef *gd=0; - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) + if (!g.groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g.groupname))) { gd->addExample(eg); eg->makePartOfGroup(gd); @@ -1672,7 +1659,7 @@ QCString GroupDefImpl::getOutputFileBase() const void GroupDefImpl::addListReferences() { { - QList<ListItemInfo> *xrefItems = xrefListItems(); + const std::vector<ListItemInfo> &xrefItems = xrefListItems(); addRefItem(xrefItems, getOutputFileBase(), theTranslator->trGroup(TRUE,TRUE), diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 28c0abb..b79bd50 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -262,7 +262,7 @@ class MemberDefImpl : public DefinitionImpl, public MemberDef virtual void makeRelated(); virtual void makeForeign(); virtual void setInheritsDocsFrom(MemberDef *md); - virtual void setTagInfo(TagInfo *i); + virtual void setTagInfo(const TagInfo *i); virtual void setArgsString(const char *as); virtual void setReimplements(MemberDef *md); virtual void insertReimplementedBy(MemberDef *md); @@ -774,7 +774,7 @@ class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef virtual void makeRelated() {} virtual void makeForeign() {} virtual void setInheritsDocsFrom(MemberDef *md) {} - virtual void setTagInfo(TagInfo *i) {} + virtual void setTagInfo(const TagInfo *i) {} virtual void setArgsString(const char *as) {} virtual void setReimplements(MemberDef *md) {} virtual void insertReimplementedBy(MemberDef *md) {} @@ -4460,14 +4460,11 @@ void MemberDefImpl::addListReference(Definition *) memArgs = argsString(); } } - QList<ListItemInfo> *xrefItems = xrefListItems(); - if (xrefItems) - { - addRefItem(xrefItems, + const std::vector<ListItemInfo> &xrefItems = xrefListItems(); + addRefItem(xrefItems, qualifiedName()+argsString(), // argsString is needed for overloaded functions (see bug 609624) memLabel, getOutputFileBase()+"#"+anchor(),memName,memArgs,pd); - } } const MemberList *MemberDefImpl::getSectionList() const @@ -4928,7 +4925,7 @@ QCString MemberDefImpl::qualifiedName() const } } -void MemberDefImpl::setTagInfo(TagInfo *ti) +void MemberDefImpl::setTagInfo(const TagInfo *ti) { if (ti) { diff --git a/src/memberdef.h b/src/memberdef.h index 986ceca..a9103e1 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -307,7 +307,7 @@ class MemberDef : virtual public Definition virtual void makeRelated() = 0; virtual void makeForeign() = 0; virtual void setInheritsDocsFrom(MemberDef *md) = 0; - virtual void setTagInfo(TagInfo *i) = 0; + virtual void setTagInfo(const TagInfo *i) = 0; virtual void setArgsString(const char *as) = 0; virtual void incrementFlowKeyWordCount() = 0; diff --git a/src/membergroup.cpp b/src/membergroup.cpp index c127302..da52d64 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -56,7 +56,6 @@ MemberGroup::MemberGroup(int id,const char *hdr,const char *d,const char *docFil m_numDocMembers = -1; m_docFile = docFile; m_docLine = docLine; - m_xrefListItems = 0; //printf("Member group docs='%s'\n",doc.data()); } @@ -340,7 +339,7 @@ QCString MemberGroup::anchor() const void MemberGroup::addListReferences(Definition *def) { memberList->addListReferences(def); - if (m_xrefListItems && def) + if (def) { QCString name = def->getOutputFileBase()+"#"+anchor(); addRefItem(m_xrefListItems, @@ -357,23 +356,9 @@ void MemberGroup::findSectionsInDocumentation(const Definition *d) memberList->findSectionsInDocumentation(d); } -void MemberGroup::setRefItems(const QList<ListItemInfo> *sli) +void MemberGroup::setRefItems(const std::vector<ListItemInfo> &sli) { - if (sli) - { - // deep copy the list - if (m_xrefListItems==0) - { - m_xrefListItems=new QList<ListItemInfo>; - m_xrefListItems->setAutoDelete(TRUE); - } - QListIterator<ListItemInfo> slii(*sli); - ListItemInfo *lii; - for (slii.toFirst();(lii=slii.current());++slii) - { - m_xrefListItems->append(new ListItemInfo(*lii)); - } - } + m_xrefListItems = sli; } void MemberGroup::writeTagFile(FTextStream &tagFile) @@ -383,18 +368,7 @@ void MemberGroup::writeTagFile(FTextStream &tagFile) //-------------------------------------------------------------------------- -void MemberGroupInfo::setRefItems(const QList<ListItemInfo> *sli) +void MemberGroupInfo::setRefItems(const std::vector<ListItemInfo> &sli) { - if (!sli) return; - if (m_sli==0) - { - m_sli = new QList<ListItemInfo>; - m_sli->setAutoDelete(TRUE); - } - QListIterator<ListItemInfo> slii(*sli); - ListItemInfo *ili; - for (slii.toFirst();(ili=slii.current());++slii) - { - m_sli->append(new ListItemInfo(*ili)); - } + m_sli = sli; } diff --git a/src/membergroup.h b/src/membergroup.h index c332b56..0fda3d7 100644 --- a/src/membergroup.h +++ b/src/membergroup.h @@ -18,6 +18,8 @@ #ifndef MEMBERGROUP_H #define MEMBERGROUP_H +#include <vector> + #include <qlist.h> #include "sortdict.h" #include "types.h" @@ -32,7 +34,6 @@ class FileDef; class GroupDef; class OutputList; class Definition; -class StorageIntf; class FTextStream; struct ListItemInfo; @@ -80,7 +81,7 @@ class MemberGroup int countInheritableMembers(const ClassDef *inheritedFrom) const; void setInGroup(bool b); void addListReferences(Definition *d); - void setRefItems(const QList<ListItemInfo> *sli); + void setRefItems(const std::vector<ListItemInfo> &sli); MemberList *members() const { return memberList; } QCString anchor() const; @@ -100,7 +101,7 @@ class MemberGroup const Definition *m_parent; QCString m_docFile; int m_docLine; - QList<ListItemInfo> *m_xrefListItems; + std::vector<ListItemInfo> m_xrefListItems; }; /** A list of MemberGroup objects. */ @@ -132,15 +133,13 @@ class MemberGroupSDict : public SIntDict<MemberGroup> /** Data collected for a member group */ struct MemberGroupInfo { - MemberGroupInfo() : docLine(-1), m_sli(0) {} - ~MemberGroupInfo() { delete m_sli; m_sli=0; } - void setRefItems(const QList<ListItemInfo> *sli); + void setRefItems(const std::vector<ListItemInfo> &sli); QCString header; QCString doc; QCString docFile; - int docLine; + int docLine = -1; QCString compoundName; - QList<ListItemInfo> *m_sli; + std::vector<ListItemInfo> m_sli; }; #endif diff --git a/src/memberlist.h b/src/memberlist.h index 0697df4..422c162 100644 --- a/src/memberlist.h +++ b/src/memberlist.h @@ -26,7 +26,6 @@ class GroupDef; class MemberGroup; class MemberGroupList; -class StorageIntf; /** A list of MemberDef objects. */ class MemberList : private QList<MemberDef> diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 9a98e0d..fa258a0 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -1269,7 +1269,7 @@ void NamespaceDefImpl::addListReferences() { //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); { - QList<ListItemInfo> *xrefItems = xrefListItems(); + const std::vector<ListItemInfo> &xrefItems = xrefListItems(); addRefItem(xrefItems, qualifiedName(), getLanguage()==SrcLangExt_Fortran ? 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/reflist.cpp b/src/reflist.cpp index e874653..016ef49 100644 --- a/src/reflist.cpp +++ b/src/reflist.cpp @@ -206,6 +206,6 @@ void RefList::generatePage() } doc += "</dl>\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,std::vector<ListItemInfo>(),0,0,TRUE); } diff --git a/src/scanner.l b/src/scanner.l index c8951e5..2259085 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -251,11 +251,6 @@ static void initEntry() current->stat = gstat; current->lang = language; //printf("*** initEntry() language=%d\n",language); - //if (!autoGroupStack.isEmpty()) - //{ - // //printf("Appending group %s\n",autoGroupStack.top()->groupname.data()); - // current->groups->append(new Grouping(*autoGroupStack.top())); - //} Doxygen::docGroup.initGroupInfo(current.get()); isTypedef=FALSE; } @@ -263,42 +258,6 @@ static void initEntry() //----------------------------------------------------------------------------- -///// remove any automatic grouping and add new one (if given) -//static void setCurrentGroup( QCString *newgroup, Grouping::GroupPri_t pri ) -//{ -// /* remove auto group name from current entry and discard it */ -// Grouping *g = current->groups->first(); -// int i=0; -// while (g) -// { -// if (g->pri <= Grouping::GROUPING_AUTO_DEF) -// { -// current->groups->remove(i); -// i--; -// } -// g=current->groups->next(); -// i++; -// } -// -// /* use new group name instead? */ -// if ( newgroup ) -// { -// current->groups->append(new Grouping(*newgroup, pri)); -// } -//} -// -//static int newMemberGroupId() -//{ -// static int curGroupId=0; -// return curGroupId++; -//} -// -// forward declarations -//static void startGroupInDoc(); -//static void endGroup(); - -//----------------------------------------------------------------------------- - static void lineCount() { static int tabSize = Config_getInt(TAB_SIZE); @@ -3510,10 +3469,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { mtype = Method; virt = Normal; - if (current->groups) - { - current->groups->clear(); - } + current->groups.clear(); initEntry(); } } @@ -4215,23 +4171,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) varEntry->brief = current->brief.copy(); varEntry->mGrpId = current->mGrpId; varEntry->initializer = current->initializer; - - // deep copy group list - QListIterator<Grouping> gli(*current->groups); - Grouping *g; - for (;(g=gli.current());++gli) - { - varEntry->groups->append(new Grouping(*g)); - } - if (current->sli) // copy special list items - { - QListIterator<ListItemInfo> li(*current->sli); - ListItemInfo *lii; - for (li.toFirst();(lii=li.current());++li) - { - varEntry->addSpecialListItem(lii->type,lii->itemId); - } - } + varEntry->groups = current->groups; + varEntry->sli = current->sli; //printf("Add: type='%s',name='%s',args='%s' brief=%s doc=%s\n", // varEntry->type.data(),varEntry->name.data(), @@ -5262,16 +5203,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - if (current->sli && previous) // copy special list items + if (!current->sli.empty() && previous) // copy special list items { - QListIterator<ListItemInfo> li(*current->sli); - ListItemInfo *lii; - for (li.toFirst();(lii=li.current());++li) - { - previous->addSpecialListItem(lii->type,lii->itemId); - } - delete current->sli; - current->sli = 0; + previous->sli = current->sli; + current->sli.clear(); } if (previous) previous->endBodyLine=yyLineNr; BEGIN( lastCurlyContext ) ; @@ -5476,8 +5411,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 +6091,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 +6133,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) @@ -7132,14 +7067,9 @@ static void parseCompounds(const std::unique_ptr<Entry> &rt) // deep copy group list from parent (see bug 727732) static bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS); - if (autoGroupNested && rt->groups && ce->section!=Entry::ENUM_SEC && !(ce->spec&Entry::Enum)) + if (autoGroupNested && ce->section!=Entry::ENUM_SEC && !(ce->spec&Entry::Enum)) { - QListIterator<Grouping> gli(*rt->groups); - Grouping *g; - for (;(g=gli.current());++gli) - { - ce->groups->append(new Grouping(*g)); - } + ce->groups = rt->groups; } int ni=ce->name.findRev("::"); if (ni==-1) ni=0; else ni+=2; 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 f498c5f..65336e3 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); @@ -1162,7 +1152,7 @@ void TagFileParser::addDocAnchors(const std::unique_ptr<Entry> &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 { @@ -1197,11 +1187,10 @@ void TagFileParser::buildMemberList(const std::unique_ptr<Entry> &ce,QList<TagMe ev->name = evi->name; ev->id = evi->clangid; ev->section = Entry::VARIABLE_SEC; - TagInfo *ti = new TagInfo; - ti->tagName = m_tagName; - ti->anchor = evi->anchor; - ti->fileName = evi->file; - ev->tagInfo = ti; + ev->tagInfoData.tagName = m_tagName; + ev->tagInfoData.anchor = evi->anchor; + ev->tagInfoData.fileName = evi->file; + ev->hasTagInfo = TRUE; me->moveToSubEntryAndKeep(ev); } } @@ -1212,14 +1201,13 @@ void TagFileParser::buildMemberList(const std::unique_ptr<Entry> &ce,QList<TagMe me->id = tmi->clangId; if (ce->section == Entry::GROUPDOC_SEC) { - me->groups->append(new Grouping(ce->name,Grouping::GROUPING_INGROUP)); + me->groups.push_back(Grouping(ce->name,Grouping::GROUPING_INGROUP)); } addDocAnchors(me,tmi->docAnchors); - TagInfo *ti = new TagInfo; - ti->tagName = m_tagName; - ti->anchor = tmi->anchor; - ti->fileName = tmi->anchorFile; - me->tagInfo = ti; + me->tagInfoData.tagName = m_tagName; + me->tagInfoData.anchor = tmi->anchor; + me->tagInfoData.fileName = tmi->anchorFile; + me->hasTagInfo = TRUE; if (tmi->kind=="define") { me->type="#define"; @@ -1339,19 +1327,15 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root) ce->name+="-p"; } addDocAnchors(ce,tci->docAnchors); - TagInfo *ti = new TagInfo; - ti->tagName = m_tagName; - ti->anchor = tci->anchor; - ti->fileName = tci->filename; + ce->tagInfoData.tagName = m_tagName; + ce->tagInfoData.anchor = tci->anchor; + ce->tagInfoData.fileName = tci->filename; + ce->hasTagInfo = TRUE; ce->id = tci->clangId; - ce->tagInfo = ti; 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; @@ -1380,10 +1364,9 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root) fe->section = guessSection(tfi->name); fe->name = tfi->name; addDocAnchors(fe,tfi->docAnchors); - TagInfo *ti = new TagInfo; - ti->tagName = m_tagName; - ti->fileName = tfi->filename; - fe->tagInfo = ti; + fe->tagInfoData.tagName = m_tagName; + fe->tagInfoData.fileName = tfi->filename; + fe->hasTagInfo = TRUE; QCString fullName = m_tagName+":"+tfi->path+stripPath(tfi->name); fe->fileName = fullName; @@ -1417,11 +1400,10 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root) ne->section = Entry::NAMESPACE_SEC; ne->name = tni->name; addDocAnchors(ne,tni->docAnchors); - TagInfo *ti = new TagInfo; - ti->tagName = m_tagName; - ti->fileName = tni->filename; + ne->tagInfoData.tagName = m_tagName; + ne->tagInfoData.fileName = tni->filename; + ne->hasTagInfo = TRUE; ne->id = tni->clangId; - ne->tagInfo = ti; buildMemberList(ne,tni->members); root->moveToSubEntryAndKeep(ne); @@ -1436,10 +1418,9 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root) pe->section = Entry::PACKAGE_SEC; pe->name = tpgi->name; addDocAnchors(pe,tpgi->docAnchors); - TagInfo *ti = new TagInfo; - ti->tagName = m_tagName; - ti->fileName = tpgi->filename; - pe->tagInfo = ti; + pe->tagInfoData.tagName = m_tagName; + pe->tagInfoData.fileName = tpgi->filename; + pe->hasTagInfo = TRUE; buildMemberList(pe,tpgi->members); root->moveToSubEntryAndKeep(pe); @@ -1455,10 +1436,9 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root) ge->name = tgi->name; ge->type = tgi->title; addDocAnchors(ge,tgi->docAnchors); - TagInfo *ti = new TagInfo; - ti->tagName = m_tagName; - ti->fileName = tgi->filename; - ge->tagInfo = ti; + ge->tagInfoData.tagName = m_tagName; + ge->tagInfoData.fileName = tgi->filename; + ge->hasTagInfo = TRUE; buildMemberList(ge,tgi->members); root->moveToSubEntryAndKeep(ge); @@ -1478,7 +1458,7 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root) [&](const std::unique_ptr<Entry> &e) { return e->name = *it; }); if (i!=children.end()) { - (*i)->groups->append(new Grouping(tgi->name,Grouping::GROUPING_INGROUP)); + (*i)->groups.push_back(Grouping(tgi->name,Grouping::GROUPING_INGROUP)); } } } @@ -1493,10 +1473,9 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root) pe->name = tpi->name; pe->args = tpi->title; addDocAnchors(pe,tpi->docAnchors); - TagInfo *ti = new TagInfo; - ti->tagName = m_tagName; - ti->fileName = tpi->filename; - pe->tagInfo = ti; + pe->tagInfoData.tagName = m_tagName; + pe->tagInfoData.fileName = tpi->filename; + pe->hasTagInfo = TRUE; root->moveToSubEntryAndKeep(pe); } } 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; diff --git a/src/types.h b/src/types.h index 4d305b6..189a93d 100644 --- a/src/types.h +++ b/src/types.h @@ -92,7 +92,6 @@ struct Grouping } Grouping( const char *gn, GroupPri_t p ) : groupname(gn), pri(p) {} - Grouping( const Grouping &g ) : groupname(g.groupname), pri(g.pri) {} QCString groupname; //!< name of the group GroupPri_t pri; //!< priority of this definition diff --git a/src/util.cpp b/src/util.cpp index 27b2222..8e0884f 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -6612,11 +6612,10 @@ found: PageDef *addRelatedPage(const char *name,const QCString &ptitle, const QCString &doc, - const QList<SectionInfo> * /*anchors*/, const char *fileName,int startLine, - const QList<ListItemInfo> *sli, + const std::vector<ListItemInfo> &sli, GroupDef *gd, - TagInfo *tagInfo, + const TagInfo *tagInfo, bool xref, SrcLangExt lang ) @@ -6702,30 +6701,28 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, //---------------------------------------------------------------------------- -void addRefItem(const QList<ListItemInfo> *sli, +void addRefItem(const std::vector<ListItemInfo> &sli, const char *key, const char *prefix, const char *name,const char *title,const char *args,Definition *scope) { //printf("addRefItem(sli=%p,key=%s,prefix=%s,name=%s,title=%s,args=%s)\n",sli,key,prefix,name,title,args); - if (sli && key && key[0]!='@') // check for @ to skip anonymous stuff (see bug427012) + if (key && key[0]!='@') // check for @ to skip anonymous stuff (see bug427012) { - QListIterator<ListItemInfo> slii(*sli); - ListItemInfo *lii; - for (slii.toFirst();(lii=slii.current());++slii) + for (const ListItemInfo &lii : sli) { - RefList *refList = Doxygen::xrefLists->find(lii->type); + RefList *refList = Doxygen::xrefLists->find(lii.type); if (refList && ( // either not a built-in list or the list is enabled - (lii->type!="todo" || Config_getBool(GENERATE_TODOLIST)) && - (lii->type!="test" || Config_getBool(GENERATE_TESTLIST)) && - (lii->type!="bug" || Config_getBool(GENERATE_BUGLIST)) && - (lii->type!="deprecated" || Config_getBool(GENERATE_DEPRECATEDLIST)) + (lii.type!="todo" || Config_getBool(GENERATE_TODOLIST)) && + (lii.type!="test" || Config_getBool(GENERATE_TESTLIST)) && + (lii.type!="bug" || Config_getBool(GENERATE_BUGLIST)) && + (lii.type!="deprecated" || Config_getBool(GENERATE_DEPRECATEDLIST)) ) ) { - RefItem *item = refList->getRefItem(lii->itemId); + RefItem *item = refList->getRefItem(lii.itemId); ASSERT(item!=0); item->prefix = prefix; @@ -327,18 +327,17 @@ int getScopeFragment(const QCString &s,int p,int *l); int filterCRLF(char *buf,int len); -void addRefItem(const QList<ListItemInfo> *sli,const char *prefix, +void addRefItem(const std::vector<ListItemInfo> &sli,const char *prefix, const char *key, const char *name,const char *title,const char *args,Definition *scope); PageDef *addRelatedPage(const char *name, const QCString &ptitle, const QCString &doc, - const QList<SectionInfo> *anchors, const char *fileName,int startLine, - const QList<ListItemInfo> *sli, + const std::vector<ListItemInfo> &sli = std::vector<ListItemInfo>(), GroupDef *gd=0, - TagInfo *tagInfo=0, + const TagInfo *tagInfo=0, bool xref=FALSE, SrcLangExt lang=SrcLangExt_Unknown ); diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 7db56c3..3585230 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -1121,7 +1121,6 @@ void VhdlDocGen::prepareComment(QCString& qcs) /*! * parses a function proto * @param text function string - * @param qlist stores the function types * @param name points to the function name * @param ret Stores the return type * @param doc ??? diff --git a/src/vhdljjparser.h b/src/vhdljjparser.h index a179630..d38a731 100644 --- a/src/vhdljjparser.h +++ b/src/vhdljjparser.h @@ -30,7 +30,6 @@ void parserVhdlfile(const char* inputBuffer); class Entry; class ClassSDict; -class FileStorage; class ClassDef; class MemberDef; struct VhdlConfNode; |