diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-11-05 17:53:20 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2020-11-09 18:47:45 (GMT) |
commit | 075229e586b391c3ec7ad79597aaeae392ca64e5 (patch) | |
tree | 2ad99929371727ad0811a55e597fa81a70ba43a7 /src/memberlist.cpp | |
parent | 6922d5d63d77c8f640c58e9c68a9955f9f0aa9a7 (diff) | |
download | Doxygen-075229e586b391c3ec7ad79597aaeae392ca64e5.zip Doxygen-075229e586b391c3ec7ad79597aaeae392ca64e5.tar.gz Doxygen-075229e586b391c3ec7ad79597aaeae392ca64e5.tar.bz2 |
Refactoring: Introduce immutable and mutable interfaces
Split Definition/ClassDef/NamespaceDef/MemberDef into a immutable and mutable part
Aliases are immutable, other symbols are stored using an immutable
interface but can be made mutable explicitly by dynamic casting.
Diffstat (limited to 'src/memberlist.cpp')
-rw-r--r-- | src/memberlist.cpp | 110 |
1 files changed, 74 insertions, 36 deletions
diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 0c608ff..589aa7e 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -334,10 +334,14 @@ void MemberList::setAnonymousEnumType() MemberDef *vmd; for ( ; (vmd=vmli.current()) ; ++vmli) { - QCString vtype=vmd->typeString(); - if ((vtype.find(name))!=-1) + MemberDefMutable *vmdm = MemberDef::make_mutable(vmd); + if (vmdm) { - vmd->setAnonymousEnumType(md); + QCString vtype=vmd->typeString(); + if ((vtype.find(name))!=-1) + { + vmdm->setAnonymousEnumType(md); + } } } } @@ -576,7 +580,8 @@ void MemberList::writePlainDeclarations(OutputList &ol, { if (md->fromAnonymousScope() && !md->anonymousDeclShown()) { - md->setFromAnonymousScope(FALSE); + MemberDefMutable *mdm = MemberDef::make_mutable(md); + if (mdm) mdm->setFromAnonymousScope(FALSE); //printf("anonymous compound members\n"); if (md->isBriefSectionVisible()) { @@ -587,7 +592,7 @@ void MemberList::writePlainDeclarations(OutputList &ol, } md->writeDeclaration(ol,cd,nd,fd,gd,m_inGroup); } - md->setFromAnonymousScope(TRUE); + if (mdm) mdm->setFromAnonymousScope(TRUE); } } } @@ -747,9 +752,13 @@ void MemberList::writeDeclarations(OutputList &ol, } if (inheritedFrom && cd) { - // also add members that of this list type, that are grouped together - // in a separate list in class 'inheritedFrom' - cd->addGroupedInheritedMembers(ol,m_listType,inheritedFrom,inheritId); + const ClassDefMutable *cdm = ClassDef::make_mutable(cd); + if (cdm) + { + // also add members that of this list type, that are grouped together + // in a separate list in class 'inheritedFrom' + cdm->addGroupedInheritedMembers(ol,m_listType,inheritedFrom,inheritId); + } } //printf("----- end writeDeclaration() ----\n"); } @@ -812,9 +821,13 @@ void MemberList::writeDocumentation(OutputList &ol, { uint overloadCount = *overloadTotalDict.find(md->name()); uint *pCount = overloadCountDict.find(md->name()); - md->writeDocumentation(this,*pCount,overloadCount,ol,scopeName,container, - m_inGroup,showEnumValues,showInline); - (*pCount)++; + MemberDefMutable *mdm = MemberDef::make_mutable(md); + if (mdm) + { + mdm->writeDocumentation(this,*pCount,overloadCount,ol,scopeName,container, + m_inGroup,showEnumValues,showInline); + (*pCount)++; + } } } if (memberGroupList) @@ -847,14 +860,18 @@ void MemberList::writeSimpleDocumentation(OutputList &ol, const MemberDef *md; for ( ; (md=mli.current()) ; ++mli) { - md->writeMemberDocSimple(ol,container); + MemberDefMutable *mdm = MemberDef::make_mutable(md); + if (mdm) + { + mdm->writeMemberDocSimple(ol,container); + } } ol.endMemberDocSimple(cd && cd->isJavaEnum()); } // separate member pages void MemberList::writeDocumentationPage(OutputList &ol, - const char *scopeName, const Definition *container) const + const char *scopeName, const DefinitionMutable *container) const { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); @@ -864,9 +881,11 @@ void MemberList::writeDocumentationPage(OutputList &ol, overloadTotalDict.setAutoDelete(TRUE); overloadCountDict.setAutoDelete(TRUE); MemberListIterator mli(*this); - const MemberDef *md; - for (mli.toFirst() ; (md=mli.current()) ; ++mli) + const MemberDef *imd; + for (mli.toFirst() ; (imd=mli.current()) ; ++mli) { + MemberDefMutable *md = MemberDef::make_mutable(imd); + if (md->isDetailedSectionLinkable()) { uint *pCount = overloadTotalDict.find(md->name()); @@ -882,8 +901,9 @@ void MemberList::writeDocumentationPage(OutputList &ol, } } - for ( mli.toFirst() ; (md=mli.current()) ; ++mli) + for ( mli.toFirst() ; (imd=mli.current()) ; ++mli) { + MemberDefMutable *md = MemberDef::make_mutable(imd); if (md->isDetailedSectionLinkable()) { uint overloadCount = *overloadTotalDict.find(md->name()); @@ -902,6 +922,7 @@ void MemberList::writeDocumentationPage(OutputList &ol, { md->writeDocumentation(this,*pCount,overloadCount,ol,scopeName,container,m_inGroup); (*pCount)++; + ol.endContents(); endFileWithNavPath(container,ol); } @@ -952,9 +973,10 @@ void MemberList::addMemberGroup(MemberGroup *mg) void MemberList::addListReferences(Definition *def) { MemberListIterator mli(*this); - MemberDef *md; - for ( ; (md=mli.current()) ; ++mli) + MemberDef *imd; + for ( ; (imd=mli.current()) ; ++mli) { + MemberDefMutable *md = MemberDef::make_mutable(imd); if (!md->isAlias() && (md->getGroupDef()==0 || def->definitionType()==Definition::TypeGroup)) { md->addListReference(def); @@ -966,8 +988,12 @@ void MemberList::addListReferences(Definition *def) MemberDef *vmd; for ( ; (vmd=vmli.current()) ; ++vmli) { - //printf(" adding %s\n",vmd->name().data()); - vmd->addListReference(def); + MemberDefMutable *vmdm = MemberDef::make_mutable(vmd); + if (vmdm) + { + //printf(" adding %s\n",vmd->name().data()); + vmdm->addListReference(def); + } } } } @@ -986,10 +1012,14 @@ void MemberList::addListReferences(Definition *def) void MemberList::findSectionsInDocumentation(const Definition *d) { MemberListIterator mli(*this); - MemberDef *md; - for ( ; (md=mli.current()) ; ++mli) + MemberDef *imd; + for ( ; (imd=mli.current()) ; ++mli) { - md->findSectionsInDocumentation(); + MemberDefMutable *md = MemberDef::make_mutable(imd); + if (md) + { + md->findSectionsInDocumentation(); + } } if (memberGroupList) { @@ -1068,25 +1098,33 @@ QCString MemberList::listTypeAsString(MemberListType type) void MemberList::writeTagFile(FTextStream &tagFile) { MemberListIterator mli(*this); - MemberDef *md; - for ( ; (md=mli.current()) ; ++mli) + MemberDef *imd; + for ( ; (imd=mli.current()) ; ++mli) { - if (md->getLanguage()!=SrcLangExt_VHDL) + MemberDefMutable *md = MemberDef::make_mutable(imd); + if (md) { - md->writeTagFile(tagFile); - if (md->memberType()==MemberType_Enumeration && md->enumFieldList() && !md->isStrong()) + if (md->getLanguage()!=SrcLangExt_VHDL) { - MemberListIterator vmli(*md->enumFieldList()); - MemberDef *vmd; - for ( ; (vmd=vmli.current()) ; ++vmli) + md->writeTagFile(tagFile); + if (md->memberType()==MemberType_Enumeration && md->enumFieldList() && !md->isStrong()) { - vmd->writeTagFile(tagFile); + MemberListIterator vmli(*md->enumFieldList()); + MemberDef *ivmd; + for ( ; (ivmd=vmli.current()) ; ++vmli) + { + MemberDefMutable *vmd = MemberDef::make_mutable(ivmd); + if (vmd) + { + vmd->writeTagFile(tagFile); + } + } } } - } - else - { - VhdlDocGen::writeTagFile(md,tagFile); + else + { + VhdlDocGen::writeTagFile(md,tagFile); + } } } if (memberGroupList) |