diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2019-10-29 21:52:33 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2019-10-29 21:54:24 (GMT) |
commit | 38f1441dc329e72ba4c782fdc721ce5199e01a67 (patch) | |
tree | ceccd8fa1b4172dd3e4a01bacac11f420c1c9d58 /src | |
parent | 4b745debaec0dbff60f7fe82ac32c59e3b21dfea (diff) | |
download | Doxygen-38f1441dc329e72ba4c782fdc721ce5199e01a67.zip Doxygen-38f1441dc329e72ba4c782fdc721ce5199e01a67.tar.gz Doxygen-38f1441dc329e72ba4c782fdc721ce5199e01a67.tar.bz2 |
Replaced QList<ListItemInfo> with std::vector<ListItemInfo>
Diffstat (limited to 'src')
-rw-r--r-- | src/cite.cpp | 2 | ||||
-rw-r--r-- | src/classdef.cpp | 2 | ||||
-rw-r--r-- | src/commentscan.l | 15 | ||||
-rw-r--r-- | src/definition.cpp | 91 | ||||
-rw-r--r-- | src/definition.h | 4 | ||||
-rw-r--r-- | src/definitionimpl.h | 8 | ||||
-rw-r--r-- | src/doxygen.cpp | 6 | ||||
-rw-r--r-- | src/entry.cpp | 49 | ||||
-rw-r--r-- | src/entry.h | 7 | ||||
-rw-r--r-- | src/filedef.cpp | 2 | ||||
-rw-r--r-- | src/groupdef.cpp | 2 | ||||
-rw-r--r-- | src/memberdef.cpp | 15 | ||||
-rw-r--r-- | src/membergroup.cpp | 36 | ||||
-rw-r--r-- | src/membergroup.h | 14 | ||||
-rw-r--r-- | src/namespacedef.cpp | 2 | ||||
-rw-r--r-- | src/reflist.cpp | 2 | ||||
-rw-r--r-- | src/scanner.l | 22 | ||||
-rw-r--r-- | src/util.cpp | 22 | ||||
-rw-r--r-- | src/util.h | 4 |
19 files changed, 93 insertions, 212 deletions
diff --git a/src/cite.cpp b/src/cite.cpp index 3a204de..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,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) diff --git a/src/commentscan.l b/src/commentscan.l index b3fe0ae..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 diff --git a/src/definition.cpp b/src/definition.cpp index 3c37686..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); @@ -1614,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 e03ca97..d458683 100644 --- a/src/definition.h +++ b/src/definition.h @@ -258,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; @@ -314,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; diff --git a/src/definitionimpl.h b/src/definitionimpl.h index 410122c..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; @@ -88,7 +88,7 @@ class DefinitionImpl : virtual public Definition 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); } @@ -246,7 +246,7 @@ class DefinitionAliasImpl : virtual public Definition 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/doxygen.cpp b/src/doxygen.cpp index 6b976ca..9c77086 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -3939,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); } @@ -5180,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), @@ -5197,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), diff --git a/src/entry.cpp b/src/entry.cpp index 16401bf..066c4a0 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -41,7 +41,6 @@ Entry::Entry() //printf("Entry::Entry() tArgList=0\n"); mGrpId = -1; hasTagInfo = FALSE; - sli = 0; relatesType = Simple; hidden = FALSE; groupDocType = GROUPDOC_NORMAL; @@ -102,41 +101,23 @@ Entry::Entry(const Entry &e) 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)); } - - extends = e.extends; - groups = e.groups; - - m_fileDef = e.m_fileDef; - } Entry::~Entry() @@ -145,7 +126,6 @@ Entry::~Entry() //printf("Deleting entry %d name %s type %x children %d\n", // num,name.data(),section,sublist->count()); - delete sli; num--; } @@ -277,16 +257,10 @@ void Entry::reset() tArgLists.clear(); argList.reset(); typeConstr.reset(); - 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; @@ -298,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 d2f2783..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> @@ -195,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. */ @@ -206,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. @@ -297,7 +292,7 @@ class 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/groupdef.cpp b/src/groupdef.cpp index 882cebd..0d6d43f 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -1659,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 6fed840..f19a805 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -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 @@ -5964,15 +5961,15 @@ static void transferArgumentDocumentation(ArgumentList &decAl,ArgumentList &defA void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef) { - //printf("mdec=%s isPrototype()=%d\n",mdec->name().data(),mdec->isPrototype()); + printf("mdec=%s isPrototype()=%d\n",mdec->name().data(),mdec->isPrototype()); if ( (mdef->isFunction() && !mdef->isStatic() && !mdef->isPrototype()) || (mdef->isVariable() && !mdef->isExternal() && !mdef->isStatic()) ) { - //printf("mdef=(%p,%s) mdec=(%p,%s)\n", - // mdef, mdef ? mdef->name().data() : "", - // mdec, mdec ? mdec->name().data() : ""); + printf("mdef=(%p,%s) mdec=(%p,%s)\n", + mdef, mdef ? mdef->name().data() : "", + mdec, mdec ? mdec->name().data() : ""); const MemberDef *cmdec = const_cast<const MemberDef*>(mdec); const MemberDef *cmdef = const_cast<const MemberDef*>(mdef); 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 51dc04b..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" @@ -79,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; @@ -99,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. */ @@ -131,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/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/reflist.cpp b/src/reflist.cpp index 57cd0c7..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,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 6524272..957c1e4 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -4172,15 +4172,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) varEntry->mGrpId = current->mGrpId; varEntry->initializer = current->initializer; varEntry->groups = current->groups; - 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->sli = current->sli; //printf("Add: type='%s',name='%s',args='%s' brief=%s doc=%s\n", // varEntry->type.data(),varEntry->name.data(), @@ -5211,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 ) ; diff --git a/src/util.cpp b/src/util.cpp index 523b437..8e0884f 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -6613,7 +6613,7 @@ found: PageDef *addRelatedPage(const char *name,const QCString &ptitle, const QCString &doc, const char *fileName,int startLine, - const QList<ListItemInfo> *sli, + const std::vector<ListItemInfo> &sli, GroupDef *gd, const TagInfo *tagInfo, bool xref, @@ -6701,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,7 +327,7 @@ 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); @@ -335,7 +335,7 @@ PageDef *addRelatedPage(const char *name, const QCString &ptitle, const QCString &doc, const char *fileName,int startLine, - const QList<ListItemInfo> *sli, + const std::vector<ListItemInfo> &sli = std::vector<ListItemInfo>(), GroupDef *gd=0, const TagInfo *tagInfo=0, bool xref=FALSE, |