diff options
Diffstat (limited to 'src/namespacedef.cpp')
-rw-r--r-- | src/namespacedef.cpp | 363 |
1 files changed, 251 insertions, 112 deletions
diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index d0a88f0..fee5dc9 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -32,6 +32,7 @@ #include "config.h" #include "definitionimpl.h" #include "membername.h" +#include "conceptdef.h" //------------------------------------------------------------------ static QCString makeDisplayName(const NamespaceDef *nd,bool includeScope) @@ -43,7 +44,7 @@ static QCString makeDisplayName(const NamespaceDef *nd,bool includeScope) { result = substitute(result,"::",sep); } - //printf("makeDisplayName() %s->%s lang=%d\n",name().data(),result.data(),lang); + //printf("makeDisplayName() %s->%s lang=%d\n",qPrint(name()),qPrint(result),lang); return result; } //------------------------------------------------------------------ @@ -51,9 +52,9 @@ static QCString makeDisplayName(const NamespaceDef *nd,bool includeScope) class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> { public: - NamespaceDefImpl(const char *defFileName,int defLine,int defColumn, - const char *name,const char *ref=0, - const char *refFile=0,const char*type=0, + NamespaceDefImpl(const QCString &defFileName,int defLine,int defColumn, + const QCString &name,const QCString &ref=QCString(), + const QCString &refFile=QCString(),const QCString &type=QCString(), bool isPublished=false); virtual ~NamespaceDefImpl(); virtual DefType definitionType() const { return TypeNamespace; } @@ -63,8 +64,9 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> virtual void writeDocumentation(OutputList &ol); virtual void writeMemberPages(OutputList &ol); virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const; - virtual void writeTagFile(FTextStream &); + virtual void writeTagFile(TextStream &); virtual void insertClass(const ClassDef *cd); + virtual void insertConcept(const ConceptDef *cd); virtual void insertNamespace(const NamespaceDef *nd); virtual void insertMember(MemberDef *md); virtual void computeAnchors(); @@ -89,7 +91,7 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> virtual void distributeMemberGroupDocumentation(); virtual void findSectionsInDocumentation(); virtual void sortMemberLists(); - virtual const Definition *findInnerCompound(const char *name) const; + virtual const Definition *findInnerCompound(const QCString &name) const; virtual void addInnerCompound(const Definition *d); virtual void addListReferences(); virtual void setFileName(const QCString &fn); @@ -103,6 +105,7 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> virtual ClassLinkedRefMap getStructs() const { return structs; } virtual ClassLinkedRefMap getExceptions() const { return exceptions; } virtual NamespaceLinkedRefMap getNamespaces() const { return namespaces; } + virtual ConceptLinkedRefMap getConcepts() const { return m_concepts; } virtual QCString title() const; virtual QCString compoundTypeString() const; @@ -118,6 +121,7 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> void startMemberDeclarations(OutputList &ol); void endMemberDeclarations(OutputList &ol); void writeClassDeclarations(OutputList &ol,const QCString &title,const ClassLinkedRefMap &d); + void writeConcepts(OutputList &ol,const QCString &title); void writeInlineClasses(OutputList &ol); void writeMemberGroups(OutputList &ol); void writeAuthorSection(OutputList &ol); @@ -125,7 +129,8 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> void endMemberDocumentation(OutputList &ol); void writeSummaryLinks(OutputList &ol) const; void addNamespaceAttributes(OutputList &ol); - void writeClassesToTagFile(FTextStream &,const ClassLinkedRefMap &d); + void writeClassesToTagFile(TextStream &,const ClassLinkedRefMap &d); + void writeConceptsToTagFile(TextStream &); void writeNamespaceDeclarations(OutputList &ol,const QCString &title, bool isConstantGroup=false); @@ -135,7 +140,7 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> LinkedRefMap<const NamespaceDef> m_usingDirList; LinkedRefMap<const ClassDef> m_usingDeclList; - SDict<Definition> *m_innerCompounds = 0; + LinkedRefMap<const Definition> m_innerCompounds; MemberLinkedRefMap m_allMembers; MemberLists m_memberLists; @@ -144,6 +149,7 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> ClassLinkedRefMap interfaces; ClassLinkedRefMap structs; ClassLinkedRefMap exceptions; + ConceptLinkedRefMap m_concepts; NamespaceLinkedRefMap namespaces; bool m_subGrouping = false; enum { NAMESPACE, MODULE, CONSTANT_GROUP, LIBRARY } m_type; @@ -152,9 +158,9 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> bool m_inline = false; }; -NamespaceDefMutable *createNamespaceDef(const char *defFileName,int defLine,int defColumn, - const char *name,const char *ref, - const char *refFile,const char*type, +NamespaceDefMutable *createNamespaceDef(const QCString &defFileName,int defLine,int defColumn, + const QCString &name,const QCString &ref, + const QCString &refFile,const QCString &type, bool isPublished) { return new NamespaceDefImpl(defFileName,defLine,defColumn,name,ref,refFile,type,isPublished); @@ -201,7 +207,7 @@ class NamespaceDefAliasImpl : public DefinitionAliasMixin<NamespaceDef> { return getNSAlias()->isLinkable(); } virtual bool hasDetailedDescription() const { return getNSAlias()->hasDetailedDescription(); } - virtual const Definition *findInnerCompound(const char *name) const + virtual const Definition *findInnerCompound(const QCString &name) const { return getNSAlias()->findInnerCompound(name); } virtual bool subGrouping() const { return getNSAlias()->subGrouping(); } @@ -223,6 +229,8 @@ class NamespaceDefAliasImpl : public DefinitionAliasMixin<NamespaceDef> { return getNSAlias()->getExceptions(); } virtual NamespaceLinkedRefMap getNamespaces() const { return getNSAlias()->getNamespaces(); } + virtual ConceptLinkedRefMap getConcepts() const + { return getNSAlias()->getConcepts(); } virtual QCString title() const { return getNSAlias()->title(); } virtual QCString compoundTypeString() const @@ -233,23 +241,23 @@ NamespaceDef *createNamespaceDefAlias(const Definition *newScope,const Namespace { NamespaceDef *alnd = new NamespaceDefAliasImpl(newScope,nd); //printf("alnd name=%s localName=%s qualifiedName=%s displayName()=%s\n", - // alnd->name().data(),alnd->localName().data(),alnd->qualifiedName().data(), - // alnd->displayName().data()); + // qPrint(alnd->name()),qPrint(alnd->localName()),qPrint(alnd->qualifiedName()), + // qPrint(alnd->displayName())); return alnd; } //------------------------------------------------------------------ -NamespaceDefImpl::NamespaceDefImpl(const char *df,int dl,int dc, - const char *name,const char *lref, - const char *fName, const char*type, +NamespaceDefImpl::NamespaceDefImpl(const QCString &df,int dl,int dc, + const QCString &name,const QCString &lref, + const QCString &fName, const QCString &type, bool isPublished) : DefinitionMixin(df,dl,dc,name) ,m_isPublished(isPublished) { - if (fName) + if (!fName.isEmpty()) { - if (lref) + if (!lref.isEmpty()) { fileName = stripExtension(fName); } @@ -262,19 +270,18 @@ NamespaceDefImpl::NamespaceDefImpl(const char *df,int dl,int dc, { setFileName(name); } - m_innerCompounds = new SDict<Definition>(17); setReference(lref); m_inline=FALSE; m_subGrouping=Config_getBool(SUBGROUPING); - if (type && !strcmp("module", type)) + if (type=="module") { m_type = MODULE; } - else if (type && !strcmp("constants", type)) + else if (type=="constants") { m_type = CONSTANT_GROUP; } - else if (type && !strcmp("library", type)) + else if (type=="library") { m_type = LIBRARY; } @@ -286,7 +293,6 @@ NamespaceDefImpl::NamespaceDefImpl(const char *df,int dl,int dc, NamespaceDefImpl::~NamespaceDefImpl() { - delete m_innerCompounds; } void NamespaceDefImpl::setFileName(const QCString &fn) @@ -329,18 +335,16 @@ void NamespaceDefImpl::findSectionsInDocumentation() void NamespaceDefImpl::insertUsedFile(FileDef *fd) { if (fd==0) return; - if (files.find(fd)==-1) + auto it = std::find(files.begin(),files.end(),fd); + if (it==files.end()) { - if (Config_getBool(SORT_MEMBER_DOCS)) - files.inSort(fd); - else - files.append(fd); + files.push_back(fd); } } void NamespaceDefImpl::addInnerCompound(const Definition *d) { - m_innerCompounds->append(d->localName(),d); + m_innerCompounds.add(d->localName(),d); if (d->definitionType()==Definition::TypeNamespace) { insertNamespace(toNamespaceDef(d)); @@ -349,6 +353,10 @@ void NamespaceDefImpl::addInnerCompound(const Definition *d) { insertClass(toClassDef(d)); } + else if (d->definitionType()==Definition::TypeConcept) + { + insertConcept(toConceptDef(d)); + } } void NamespaceDefImpl::insertClass(const ClassDef *cd) @@ -374,6 +382,11 @@ void NamespaceDefImpl::insertClass(const ClassDef *cd) d.add(cd->name(),cd); } +void NamespaceDefImpl::insertConcept(const ConceptDef *cd) +{ + m_concepts.add(cd->name(),cd); +} + void NamespaceDefImpl::insertNamespace(const NamespaceDef *nd) { namespaces.add(nd->name(),nd); @@ -395,7 +408,7 @@ void NamespaceDefImpl::addMembersToMemberGroup() { if (mg->allMembersInSameSection() && m_subGrouping) { - //printf("----> addToDeclarationSection(%s)\n",mg->header().data()); + //printf("----> addToDeclarationSection(%s)\n",qPrint(mg->header())); mg->addToDeclarationSection(); } } @@ -447,8 +460,8 @@ void NamespaceDefImpl::insertMember(MemberDef *md) m_memberLists.emplace_back(std::make_unique<MemberList>(MemberListType_allMembersList)); allMemberList = m_memberLists.back().get(); } - allMemberList->append(md); - //printf("%s::m_allMembersDict->append(%s)\n",name().data(),md->localName().data()); + allMemberList->push_back(md); + //printf("%s::m_allMembersDict->append(%s)\n",qPrint(name()),qPrint(md->localName())); m_allMembers.add(md->localName(),md); //::addNamespaceMemberNameToIndex(md); //static bool sortBriefDocs=Config_getBool(SORT_BRIEF_DOCS); @@ -487,9 +500,9 @@ void NamespaceDefImpl::insertMember(MemberDef *md) default: err("NamespaceDefImpl::insertMembers(): " "member '%s' with class scope '%s' inserted in namespace scope '%s'!\n", - md->name().data(), - md->getClassDef() ? md->getClassDef()->name().data() : "", - name().data()); + qPrint(md->name()), + md->getClassDef() ? qPrint(md->getClassDef()->name()) : "", + qPrint(name())); } // if this is an inline namespace, then insert an alias of this member in the outer scope. if (isInline()) @@ -537,20 +550,17 @@ bool NamespaceDefImpl::hasDetailedDescription() const !documentation().isEmpty()); } -void NamespaceDefImpl::writeTagFile(FTextStream &tagFile) +void NamespaceDefImpl::writeTagFile(TextStream &tagFile) { - tagFile << " <compound kind=\"namespace\">" << endl; - tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; - tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl; + tagFile << " <compound kind=\"namespace\">\n"; + tagFile << " <name>" << convertToXML(name()) << "</name>\n"; + tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>\n"; QCString idStr = id(); if (!idStr.isEmpty()) { - tagFile << " <clangid>" << convertToXML(idStr) << "</clangid>" << endl; + tagFile << " <clangid>" << convertToXML(idStr) << "</clangid>\n"; } - QListIterator<LayoutDocEntry> eli( - LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)); - LayoutDocEntry *lde; - for (eli.toFirst();(lde=eli.current());++eli) + for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)) { switch (lde->kind()) { @@ -560,7 +570,7 @@ void NamespaceDefImpl::writeTagFile(FTextStream &tagFile) { if (nd->isLinkableInProject()) { - tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl; + tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>\n"; } } } @@ -585,9 +595,14 @@ void NamespaceDefImpl::writeTagFile(FTextStream &tagFile) writeClassesToTagFile(tagFile, exceptions); } break; + case LayoutDocEntry::NamespaceConcepts: + { + writeConceptsToTagFile(tagFile); + } + break; case LayoutDocEntry::MemberDecl: { - LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde; + const LayoutDocEntryMemberDecl *lmd = (const LayoutDocEntryMemberDecl*)lde.get(); MemberList * ml = getMemberList(lmd->type); if (ml) { @@ -608,7 +623,7 @@ void NamespaceDefImpl::writeTagFile(FTextStream &tagFile) } } writeDocAnchorsToTagFile(tagFile); - tagFile << " </compound>" << endl; + tagFile << " </compound>\n"; } void NamespaceDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) @@ -621,7 +636,7 @@ void NamespaceDefImpl::writeDetailedDescription(OutputList &ol,const QCString &t ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - ol.writeAnchor(0,"details"); + ol.writeAnchor(QCString(),"details"); ol.popGeneratorState(); ol.startGroupHeader(); ol.parseText(title); @@ -631,7 +646,7 @@ void NamespaceDefImpl::writeDetailedDescription(OutputList &ol,const QCString &t if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) { ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && !documentation().isEmpty()) @@ -649,7 +664,7 @@ void NamespaceDefImpl::writeDetailedDescription(OutputList &ol,const QCString &t if (!documentation().isEmpty()) { ol.generateDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } ol.endTextBlock(); } @@ -661,7 +676,7 @@ void NamespaceDefImpl::writeBriefDescription(OutputList &ol) { DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0, briefDescription(),TRUE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); if (rootNode && !rootNode->isEmpty()) { ol.startParagraph(); @@ -747,6 +762,11 @@ void NamespaceDefImpl::writeClassDeclarations(OutputList &ol,const QCString &tit d.writeDeclaration(ol,0,title,TRUE); } +void NamespaceDefImpl::writeConcepts(OutputList &ol,const QCString &title) +{ + m_concepts.writeDeclaration(ol,title,TRUE); +} + void NamespaceDefImpl::writeInlineClasses(OutputList &ol) { classes.writeDocumentation(ol,this); @@ -787,55 +807,59 @@ void NamespaceDefImpl::writeSummaryLinks(OutputList &ol) const { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - QListIterator<LayoutDocEntry> eli( - LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)); - LayoutDocEntry *lde; bool first=TRUE; SrcLangExt lang = getLanguage(); - for (eli.toFirst();(lde=eli.current());++eli) + for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)) { if (lde->kind()==LayoutDocEntry::NamespaceClasses && classes.declVisible()) { - LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "nested-classes"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceInterfaces && interfaces.declVisible()) { - LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "interfaces"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceStructs && structs.declVisible()) { - LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "structs"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceExceptions && exceptions.declVisible()) { - LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "exceptions"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceNestedNamespaces && namespaces.declVisible()) { - LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "namespaces"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); + first=FALSE; + } + else if (lde->kind()==LayoutDocEntry::NamespaceConcepts && m_concepts.declVisible()) + { + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); + QCString label = "concepts"; + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()== LayoutDocEntry::MemberDecl) { - LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde; + const LayoutDocEntryMemberDecl *lmd = (const LayoutDocEntryMemberDecl*)lde.get(); MemberList * ml = getMemberList(lmd->type); if (ml && ml->declVisible()) { - ol.writeSummaryLink(0,MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first); + ol.writeSummaryLink(QCString(),MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first); first=FALSE; } } @@ -861,14 +885,25 @@ void NamespaceDefImpl::addNamespaceAttributes(OutputList &ol) } } -void NamespaceDefImpl::writeClassesToTagFile(FTextStream &tagFile,const ClassLinkedRefMap &list) +void NamespaceDefImpl::writeClassesToTagFile(TextStream &tagFile,const ClassLinkedRefMap &list) { for (const auto &cd : list) { if (cd->isLinkableInProject()) { tagFile << " <class kind=\"" << cd->compoundTypeString() - << "\">" << convertToXML(cd->name()) << "</class>" << endl; + << "\">" << convertToXML(cd->name()) << "</class>\n"; + } + } +} + +void NamespaceDefImpl::writeConceptsToTagFile(TextStream &tagFile) +{ + for (const auto &cd : m_concepts) + { + if (cd->isLinkableInProject()) + { + tagFile << " <concept>" << convertToXML(cd->name()) << "</concept>\n"; } } } @@ -909,10 +944,7 @@ void NamespaceDefImpl::writeDocumentation(OutputList &ol) //---------------------------------------- start flexible part ------------------------------- SrcLangExt lang = getLanguage(); - QListIterator<LayoutDocEntry> eli( - LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)); - LayoutDocEntry *lde; - for (eli.toFirst();(lde=eli.current());++eli) + for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)) { switch (lde->kind()) { @@ -924,37 +956,43 @@ void NamespaceDefImpl::writeDocumentation(OutputList &ol) break; case LayoutDocEntry::NamespaceClasses: { - LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); writeClassDeclarations(ol,ls->title(lang),classes); } break; case LayoutDocEntry::NamespaceInterfaces: { - LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); writeClassDeclarations(ol,ls->title(lang),interfaces); } break; case LayoutDocEntry::NamespaceStructs: { - LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); writeClassDeclarations(ol,ls->title(lang),structs); } break; case LayoutDocEntry::NamespaceExceptions: { - LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); writeClassDeclarations(ol,ls->title(lang),exceptions); } break; + case LayoutDocEntry::NamespaceConcepts: + { + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); + writeConcepts(ol,ls->title(lang)); + } + break; case LayoutDocEntry::NamespaceNestedNamespaces: { - LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); writeNamespaceDeclarations(ol,ls->title(lang),false); } break; case LayoutDocEntry::NamespaceNestedConstantGroups: { - LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); writeNamespaceDeclarations(ol,ls->title(lang),true); } break; @@ -963,7 +1001,7 @@ void NamespaceDefImpl::writeDocumentation(OutputList &ol) break; case LayoutDocEntry::MemberDecl: { - LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde; + const LayoutDocEntryMemberDecl *lmd = (const LayoutDocEntryMemberDecl*)lde.get(); writeMemberDeclarations(ol,lmd->type,lmd->title(lang)); } break; @@ -972,7 +1010,7 @@ void NamespaceDefImpl::writeDocumentation(OutputList &ol) break; case LayoutDocEntry::DetailedDesc: { - LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); writeDetailedDescription(ol,ls->title(lang)); } break; @@ -984,7 +1022,7 @@ void NamespaceDefImpl::writeDocumentation(OutputList &ol) break; case LayoutDocEntry::MemberDef: { - LayoutDocEntryMemberDef *lmd = (LayoutDocEntryMemberDef*)lde; + const LayoutDocEntryMemberDef *lmd = (const LayoutDocEntryMemberDef*)lde.get(); writeMemberDocumentation(ol,lmd->type,lmd->title(lang)); } break; @@ -1001,7 +1039,9 @@ void NamespaceDefImpl::writeDocumentation(OutputList &ol) case LayoutDocEntry::ClassAllMembersLink: case LayoutDocEntry::ClassUsedFiles: case LayoutDocEntry::ClassInlineClasses: + case LayoutDocEntry::ConceptDefinition: case LayoutDocEntry::FileClasses: + case LayoutDocEntry::FileConcepts: case LayoutDocEntry::FileInterfaces: case LayoutDocEntry::FileStructs: case LayoutDocEntry::FileExceptions: @@ -1013,6 +1053,7 @@ void NamespaceDefImpl::writeDocumentation(OutputList &ol) case LayoutDocEntry::FileSourceLink: case LayoutDocEntry::FileInlineClasses: case LayoutDocEntry::GroupClasses: + case LayoutDocEntry::GroupConcepts: case LayoutDocEntry::GroupInlineClasses: case LayoutDocEntry::GroupNamespaces: case LayoutDocEntry::GroupDirs: @@ -1068,9 +1109,7 @@ void NamespaceDefImpl::writeQuickMemberLinks(OutputList &ol,const MemberDef *cur MemberList *allMemberList = getMemberList(MemberListType_allMembersList); if (allMemberList) { - MemberListIterator mli(*allMemberList); - MemberDef *md; - for (mli.toFirst();(md=mli.current());++mli) + for (const auto &md : *allMemberList) { if (md->getNamespaceDef()==this && md->isLinkable() && !md->isEnumValue()) { @@ -1118,13 +1157,13 @@ void NamespaceDefImpl::countMembers() int NamespaceDefImpl::numDocMembers() const { MemberList *allMemberList = getMemberList(MemberListType_allMembersList); - return (allMemberList ? allMemberList->numDocMembers() : 0) + m_innerCompounds->count(); + return (allMemberList ? allMemberList->numDocMembers() : 0) + (int)m_innerCompounds.size(); } void NamespaceDefImpl::addUsingDirective(const NamespaceDef *nd) { m_usingDirList.add(nd->qualifiedName(),nd); - //printf("%p: NamespaceDefImpl::addUsingDirective: %s:%d\n",this,name().data(),m_usingDirList->count()); + //printf("%p: NamespaceDefImpl::addUsingDirective: %s:%d\n",this,qPrint(name()),m_usingDirList->count()); } void NamespaceDefImpl::addUsingDeclaration(const ClassDef *cd) @@ -1137,10 +1176,10 @@ QCString NamespaceDefImpl::getOutputFileBase() const return fileName; } -const Definition *NamespaceDefImpl::findInnerCompound(const char *n) const +const Definition *NamespaceDefImpl::findInnerCompound(const QCString &n) const { if (n==0) return 0; - const Definition *d = m_innerCompounds->find(n); + const Definition *d = m_innerCompounds.find(n); if (d==0) { if (!m_usingDirList.empty()) @@ -1166,7 +1205,7 @@ void NamespaceDefImpl::addListReferences() theTranslator->trModule(TRUE,TRUE) : theTranslator->trNamespace(TRUE,TRUE), getOutputFileBase(),displayName(), - 0, + QCString(), this ); } @@ -1243,7 +1282,7 @@ bool NamespaceLinkedRefMap::declVisible() const return FALSE; } -void NamespaceLinkedRefMap::writeDeclaration(OutputList &ol,const char *title, +void NamespaceLinkedRefMap::writeDeclaration(OutputList &ol,const QCString &title, bool const isConstantGroup,bool localName) { @@ -1308,16 +1347,16 @@ void NamespaceLinkedRefMap::writeDeclaration(OutputList &ol,const char *title, { name = nd->displayName(); } - ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),0,name); + ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),QCString(),name); ol.endMemberItem(); if (!nd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(nd->getOutputFileBase()); ol.generateDoc(nd->briefFile(),nd->briefLine(),nd,0,nd->briefDescription(),FALSE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberDescription(); } - ol.endMemberDeclaration(0,0); + ol.endMemberDeclaration(QCString(),QCString()); } } ol.endMemberList(); @@ -1333,7 +1372,7 @@ void NamespaceDefImpl::addMemberToList(MemberListType lt,MemberDef *md) ml->setNeedsSorting( ((ml->listType()&MemberListType_declarationLists) && sortBriefDocs) || ((ml->listType()&MemberListType_documentationLists) && sortMemberDocs)); - ml->append(md); + ml->push_back(md); if (ml->listType()&MemberListType_declarationLists) { @@ -1352,23 +1391,19 @@ void NamespaceDefImpl::sortMemberLists() if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } } - if (Config_getBool(SORT_BRIEF_DOCS)) + auto classComp = [](const ClassLinkedRefMap::Ptr &c1,const ClassLinkedRefMap::Ptr &c2) { - auto classComp = [](const ClassLinkedRefMap::Ptr &c1,const ClassLinkedRefMap::Ptr &c2) - { - return Config_getBool(SORT_BY_SCOPE_NAME) ? - qstricmp(c1->name(), c2->name())<0 : - qstricmp(c1->className(), c2->className())<0; - }; + return Config_getBool(SORT_BY_SCOPE_NAME) ? + qstricmp(c1->name(), c2->name())<0 : + qstricmp(c1->className(), c2->className())<0; + }; - std::sort(classes.begin(), classes.end(), classComp); - std::sort(interfaces.begin(),interfaces.end(),classComp); - std::sort(structs.begin(), structs.end(), classComp); - std::sort(exceptions.begin(),exceptions.end(),classComp); + std::sort(classes.begin(), classes.end(), classComp); + std::sort(interfaces.begin(),interfaces.end(),classComp); + std::sort(structs.begin(), structs.end(), classComp); + std::sort(exceptions.begin(),exceptions.end(),classComp); - } - // TODO: inconsistent: should be only done when SORT_BRIEF_DOCS is enabled... auto namespaceComp = [](const NamespaceLinkedRefMap::Ptr &n1,const NamespaceLinkedRefMap::Ptr &n2) { return qstricmp(n1->name(),n2->name())<0; @@ -1392,7 +1427,7 @@ MemberList *NamespaceDefImpl::getMemberList(MemberListType lt) const void NamespaceDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title) { MemberList * ml = getMemberList(lt); - if (ml) ml->writeDeclarations(ol,0,this,0,0,title,0); + if (ml) ml->writeDeclarations(ol,0,this,0,0,title,QCString()); } void NamespaceDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title) @@ -1464,7 +1499,7 @@ QCString NamespaceDefImpl::compoundTypeString() const } else if(lang==SrcLangExt_CSharp) { - return "namespace"; + return "namespace"; } else if (lang==SrcLangExt_Fortran) { @@ -1489,7 +1524,7 @@ QCString NamespaceDefImpl::compoundTypeString() const err_full(getDefFileName(),getDefLine(),"Internal inconsistency: namespace in IDL not module, library or constant group"); } } - return ""; + return "namespace"; } void NamespaceDefImpl::setMetaData(const QCString &m) @@ -1561,3 +1596,107 @@ NamespaceDefMutable *toNamespaceDefMutable(const Definition *d) } } +// --- Helpers + + +NamespaceDef *getResolvedNamespace(const QCString &name) +{ + if (name.isEmpty()) return 0; + auto it = Doxygen::namespaceAliasMap.find(name.str()); + if (it!=Doxygen::namespaceAliasMap.end()) + { + int count=0; // recursion detection guard + StringUnorderedMap::iterator it2; + while ((it2=Doxygen::namespaceAliasMap.find(it->second))!=Doxygen::namespaceAliasMap.end() && + count<10) + { + it=it2; + count++; + } + if (count==10) + { + warn_uncond("possible recursive namespace alias detected for %s!\n",qPrint(name)); + } + return Doxygen::namespaceLinkedMap->find(it->second); + } + else + { + return Doxygen::namespaceLinkedMap->find(name); + } +} + +//-------------------------------------------------------------------------------------- +// +bool namespaceHasNestedNamespace(const NamespaceDef *nd) +{ + for (const auto &cnd : nd->getNamespaces()) + { + if (cnd->isLinkableInProject() && !cnd->isAnonymous()) + { + return true; + } + } + return false; +} + +bool namespaceHasNestedConcept(const NamespaceDef *nd) +{ + for (const auto &cnd : nd->getNamespaces()) + { + if (namespaceHasNestedConcept(cnd)) + { + //printf("<namespaceHasVisibleChild(%s,includeClasses=%d): case2\n",qPrint(nd->name()),includeClasses); + return true; + } + } + for (const auto &cnd : nd->getConcepts()) + { + if (cnd->isLinkableInProject()) + { + return true; + } + } + return false; +} + +bool namespaceHasNestedClass(const NamespaceDef *nd,bool filterClasses,ClassDef::CompoundType ct) +{ + //printf(">namespaceHasVisibleChild(%s,includeClasses=%d)\n",qPrint(nd->name()),includeClasses); + for (const auto &cnd : nd->getNamespaces()) + { + if (namespaceHasNestedClass(cnd,filterClasses,ct)) + { + //printf("<namespaceHasVisibleChild(%s,includeClasses=%d): case2\n",qPrint(nd->name()),includeClasses); + return TRUE; + } + } + + ClassLinkedRefMap list = nd->getClasses(); + if (filterClasses) + { + if (ct == ClassDef::Interface) + { + list = nd->getInterfaces(); + } + else if (ct == ClassDef::Struct) + { + list = nd->getStructs(); + } + else if (ct == ClassDef::Exception) + { + list = nd->getExceptions(); + } + } + + for (const auto &cd : list) + { + if (cd->isLinkableInProject() && cd->templateMaster()==0) + { + //printf("<namespaceHasVisibleChild(%s,includeClasses=%d): case3\n",qPrint(nd->name()),includeClasses); + return TRUE; + } + } + return FALSE; +} + + |