diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2021-01-06 17:39:50 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2021-01-22 20:45:18 (GMT) |
commit | 09edc28292f90497c9f9282691fdaccd478eb405 (patch) | |
tree | 04e6dc2742c4a9e8d3a730d0f19cc2204c580624 /src | |
parent | 14a610f2ba9e360b636a3390b3c459f4207aee9a (diff) | |
download | Doxygen-09edc28292f90497c9f9282691fdaccd478eb405.zip Doxygen-09edc28292f90497c9f9282691fdaccd478eb405.tar.gz Doxygen-09edc28292f90497c9f9282691fdaccd478eb405.tar.bz2 |
Refactoring: change visitedClasses type to ClassDefSet
Diffstat (limited to 'src')
-rw-r--r-- | src/classdef.cpp | 63 | ||||
-rw-r--r-- | src/classdef.h | 19 | ||||
-rw-r--r-- | src/context.cpp | 10 |
3 files changed, 44 insertions, 48 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 4c8638c..52cac64 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -306,11 +306,11 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> virtual int countMembersIncludingGrouped(MemberListType lt,const ClassDef *inheritedFrom,bool additional) const; virtual int countInheritanceNodes() const; virtual int countMemberDeclarations(MemberListType lt,const ClassDef *inheritedFrom, - int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses) const; - virtual void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title, + int lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const; + virtual void writeMemberDeclarations(OutputList &ol,ClassDefSet &visitedClasses, + MemberListType lt,const QCString &title, const char *subTitle=0,bool showInline=FALSE,const ClassDef *inheritedFrom=0, - int lt2=-1,bool invert=FALSE,bool showAlways=FALSE, - QPtrDict<void> *visitedClasses=0) const; + int lt2=-1,bool invert=FALSE,bool showAlways=FALSE) const; private: void addUsedInterfaceClasses(MemberDef *md,const char *typeStr); @@ -319,9 +319,10 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> void writeDocumentationContents(OutputList &ol,const QCString &pageTitle) const; void internalInsertMember(MemberDef *md,Protection prot,bool addToAllList); void addMemberToList(MemberListType lt,MemberDef *md,bool isBrief); - void writeInheritedMemberDeclarations(OutputList &ol,MemberListType lt,int lt2,const QCString &title, + void writeInheritedMemberDeclarations(OutputList &ol,ClassDefSet &visitedClasses, + MemberListType lt,int lt2,const QCString &title, const ClassDef *inheritedFrom,bool invert, - bool showAlways,QPtrDict<void> *visitedClasses) const; + bool showAlways) const; void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title,bool showInline=FALSE) const; void writeSimpleMemberDocumentation(OutputList &ol,MemberListType lt) const; void writePlainMemberDeclaration(OutputList &ol,MemberListType lt,bool inGroup,const ClassDef *inheritedFrom,const char *inheritId) const; @@ -349,7 +350,7 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> void addClassAttributes(OutputList &ol) const; int countInheritedDecMembers(MemberListType lt, const ClassDef *inheritedFrom,bool invert,bool showAlways, - QPtrDict<void> *visitedClasses) const; + ClassDefSet &visitedClasses) const; void getTitleForMemberListType(MemberListType type, QCString &title,QCString &subtitle) const; QCString includeStatement() const; @@ -534,7 +535,7 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef> virtual int countInheritanceNodes() const { return getCdAlias()->countInheritanceNodes(); } virtual int countMemberDeclarations(MemberListType lt,const ClassDef *inheritedFrom, - int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses) const + int lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const { return getCdAlias()->countMemberDeclarations(lt,inheritedFrom,lt2,invert,showAlways,visitedClasses); } virtual void writeDeclarationLink(OutputList &ol,bool &found, @@ -2237,8 +2238,9 @@ void ClassDefImpl::writeInlineDocumentation(OutputList &ol) const break; case LayoutDocEntry::MemberDecl: { + ClassDefSet visitedClasses; const LayoutDocEntryMemberDecl *lmd = (const LayoutDocEntryMemberDecl*)lde.get(); - if (!isSimple) writeMemberDeclarations(ol,lmd->type,lmd->title(lang),lmd->subtitle(lang),TRUE); + if (!isSimple) writeMemberDeclarations(ol,visitedClasses,lmd->type,lmd->title(lang),lmd->subtitle(lang),TRUE); } break; case LayoutDocEntry::MemberGroups: @@ -2525,8 +2527,9 @@ void ClassDefImpl::writeDocumentationContents(OutputList &ol,const QCString & /* break; case LayoutDocEntry::MemberDecl: { + ClassDefSet visitedClasses; const LayoutDocEntryMemberDecl *lmd = (const LayoutDocEntryMemberDecl*)lde.get(); - writeMemberDeclarations(ol,lmd->type,lmd->title(lang),lmd->subtitle(lang)); + writeMemberDeclarations(ol,visitedClasses,lmd->type,lmd->title(lang),lmd->subtitle(lang)); } break; case LayoutDocEntry::ClassNestedClasses: @@ -4172,7 +4175,7 @@ void ClassDefImpl::sortMemberLists() } int ClassDefImpl::countMemberDeclarations(MemberListType lt,const ClassDef *inheritedFrom, - int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses) const + int lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const { //printf("%s: countMemberDeclarations for %d and %d\n",name().data(),lt,lt2); int count=0; @@ -4248,7 +4251,7 @@ void ClassDefImpl::countMembers() int ClassDefImpl::countInheritedDecMembers(MemberListType lt, const ClassDef *inheritedFrom,bool invert,bool showAlways, - QPtrDict<void> *visitedClasses) const + ClassDefSet &visitedClasses) const { int inhCount = 0; int count = countMembersIncludingGrouped(lt,inheritedFrom,FALSE); @@ -4266,9 +4269,9 @@ int ClassDefImpl::countInheritedDecMembers(MemberListType lt, convertProtectionLevel(lt,ibcd.prot,<1,<2); //printf("%s: convert %d->(%d,%d) prot=%d\n", // icd->name().data(),lt,lt1,lt2,ibcd->prot); - if (visitedClasses->find(icd)==0) + if (visitedClasses.find(icd)==visitedClasses.end()) { - visitedClasses->insert(icd,icd); // guard for multiple virtual inheritance + visitedClasses.insert(icd); // guard for multiple virtual inheritance if (lt1!=-1) { inhCount+=icd->countMemberDeclarations((MemberListType)lt1,inheritedFrom,lt2,FALSE,TRUE,visitedClasses); @@ -4311,8 +4314,8 @@ int ClassDefImpl::countAdditionalInheritedMembers() const const LayoutDocEntryMemberDecl *lmd = (const LayoutDocEntryMemberDecl*)lde.get(); if (lmd->type!=MemberListType_friends) // friendship is not inherited { - QPtrDict<void> visited(17); - totalCount+=countInheritedDecMembers(lmd->type,this,TRUE,FALSE,&visited); + ClassDefSet visited; + totalCount+=countInheritedDecMembers(lmd->type,this,TRUE,FALSE,visited); } } } @@ -4330,8 +4333,8 @@ void ClassDefImpl::writeAdditionalInheritedMembers(OutputList &ol) const const LayoutDocEntryMemberDecl *lmd = (const LayoutDocEntryMemberDecl*)lde.get(); if (lmd->type!=MemberListType_friends) { - QPtrDict<void> visited(17); - writeInheritedMemberDeclarations(ol,lmd->type,-1,lmd->title(getLanguage()),this,TRUE,FALSE,&visited); + ClassDefSet visited; + writeInheritedMemberDeclarations(ol,visited,lmd->type,-1,lmd->title(getLanguage()),this,TRUE,FALSE); } } } @@ -4362,10 +4365,9 @@ int ClassDefImpl::countMembersIncludingGrouped(MemberListType lt, } -void ClassDefImpl::writeInheritedMemberDeclarations(OutputList &ol, +void ClassDefImpl::writeInheritedMemberDeclarations(OutputList &ol,ClassDefSet &visitedClasses, MemberListType lt,int lt2,const QCString &title, - const ClassDef *inheritedFrom,bool invert,bool showAlways, - QPtrDict<void> *visitedClasses) const + const ClassDef *inheritedFrom,bool invert,bool showAlways) const { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -4387,13 +4389,13 @@ void ClassDefImpl::writeInheritedMemberDeclarations(OutputList &ol, lt2=lt3; } //printf("%s:convert %d->(%d,%d) prot=%d\n",icd->name().data(),lt,lt1,lt2,ibcd->prot); - if (visitedClasses->find(icd)==0) + if (visitedClasses.find(icd)==visitedClasses.end()) { - visitedClasses->insert(icd,icd); // guard for multiple virtual inheritance + visitedClasses.insert(icd); // guard for multiple virtual inheritance if (lt1!=-1) { - icd->writeMemberDeclarations(ol,(MemberListType)lt1, - title,QCString(),FALSE,inheritedFrom,lt2,FALSE,TRUE,visitedClasses); + icd->writeMemberDeclarations(ol,visitedClasses,(MemberListType)lt1, + title,QCString(),FALSE,inheritedFrom,lt2,FALSE,TRUE); } } else @@ -4406,9 +4408,10 @@ void ClassDefImpl::writeInheritedMemberDeclarations(OutputList &ol, ol.popGeneratorState(); } -void ClassDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title, +void ClassDefImpl::writeMemberDeclarations(OutputList &ol,ClassDefSet &visitedClasses, + MemberListType lt,const QCString &title, const char *subTitle,bool showInline,const ClassDef *inheritedFrom,int lt2, - bool invert,bool showAlways,QPtrDict<void> *visitedClasses) const + bool invert,bool showAlways) const { //printf("%s: ClassDefImpl::writeMemberDeclarations lt=%d lt2=%d\n",name().data(),lt,lt2); MemberList * ml = getMemberList(lt); @@ -4445,11 +4448,9 @@ void ClassDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,cons static bool inlineInheritedMembers = Config_getBool(INLINE_INHERITED_MEMB); if (!inlineInheritedMembers) // show inherited members as separate lists { - QPtrDict<void> visited(17); - writeInheritedMemberDeclarations(ol,lt,lt2,title, + writeInheritedMemberDeclarations(ol,visitedClasses,lt,lt2,title, inheritedFrom ? inheritedFrom : this, - invert,showAlways, - visitedClasses==0 ? &visited: visitedClasses); + invert,showAlways); } } } diff --git a/src/classdef.h b/src/classdef.h index e8db3dd..414b54f 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -21,10 +21,6 @@ #include <vector> #include <set> -#include <qlist.h> -#include <qdict.h> -#include <qptrdict.h> - #include "containers.h" #include "definition.h" #include "arguments.h" @@ -97,6 +93,9 @@ using TemplateInstanceList = std::vector<TemplateInstanceDef>; using TemplateNameMap = std::map<std::string,int>; +using ClassDefSet = std::set<const ClassDef*>; + + /** A abstract class representing of a compound symbol. * * A compound can be a class, struct, union, interface, service, singleton, @@ -368,7 +367,7 @@ class ClassDef : public Definition const ClassDef *inheritedFrom,bool additional) const = 0; virtual int countInheritanceNodes() const = 0; virtual int countMemberDeclarations(MemberListType lt,const ClassDef *inheritedFrom, - int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses) const = 0; + int lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const = 0; //----------------------------------------------------------------------------------- // --- helpers ---- @@ -451,10 +450,10 @@ class ClassDefMutable : public DefinitionMutable, public ClassDef virtual void writeSummaryLinks(OutputList &ol) const = 0; virtual void writeInlineDocumentation(OutputList &ol) const = 0; virtual void writeTagFile(FTextStream &) = 0; - virtual void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title, + virtual void writeMemberDeclarations(OutputList &ol,ClassDefSet &visitedClasses, + MemberListType lt,const QCString &title, const char *subTitle=0,bool showInline=FALSE,const ClassDef *inheritedFrom=0, - int lt2=-1,bool invert=FALSE,bool showAlways=FALSE, - QPtrDict<void> *visitedClasses=0) const = 0; + int lt2=-1,bool invert=FALSE,bool showAlways=FALSE) const = 0; virtual void addGroupedInheritedMembers(OutputList &ol,MemberListType lt, const ClassDef *inheritedFrom,const QCString &inheritId) const = 0; @@ -470,10 +469,6 @@ ClassDefMutable *createClassDef( ClassDef *createClassDefAlias(const Definition *newScope,const ClassDef *cd); -// --- Set of classes - -using ClassDefSet = std::set<const ClassDef*>; - // --- Cast functions ClassDef *toClassDef(Definition *d); diff --git a/src/context.cpp b/src/context.cpp index 7f3a33e..87e574f 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -9166,7 +9166,7 @@ class InheritedMemberInfoListContext::Private : public GenericNodeListContext } void findInheritedMembers(const ClassDef *inheritedFrom,const ClassDef *cd,MemberListType lt, int lt2, const QCString &title,bool additionalList, - QPtrDict<void> *visitedClasses) + ClassDefSet &visitedClasses) { for (const auto &ibcd : cd->baseClasses()) { @@ -9179,9 +9179,9 @@ class InheritedMemberInfoListContext::Private : public GenericNodeListContext { lt2=lt3; } - if (visitedClasses->find(icd)==0) + if (visitedClasses.find(icd)==visitedClasses.end()) { - visitedClasses->insert(icd,icd); // guard for multiple virtual inheritance + visitedClasses.insert(icd); // guard for multiple virtual inheritance if (lt1!=-1) { // add member info for members of cd with list type lt @@ -9203,14 +9203,14 @@ InheritedMemberInfoListContext::InheritedMemberInfoListContext() : RefCountedCon void InheritedMemberInfoListContext::addMemberList( const ClassDef *cd,MemberListType lt,const QCString &title,bool additionalList) { - QPtrDict<void> visited(17); + ClassDefSet visited; bool memberInSection = cd->countMembersIncludingGrouped(lt,cd,FALSE)>0; bool show = (additionalList && !memberInSection) || // inherited member to show in the additional inherited members list (!additionalList && memberInSection); // inherited member to show in a member list of the class //printf("%s:%s show=%d\n",cd->name().data(),MemberList::listTypeAsString(lt).data(),show); if (show) { - p->findInheritedMembers(cd,cd,lt,-1,title,additionalList,&visited); + p->findInheritedMembers(cd,cd,lt,-1,title,additionalList,visited); } } |