From 1ed8e5b7d77aa2d75d5799cec072a6b47a5722e3 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Tue, 25 May 2021 19:27:33 +0200 Subject: issue #8232: Incorrect link from summary links for namespaces --- src/filedef.cpp | 2 +- src/groupdef.cpp | 2 +- src/namespacedef.cpp | 52 ++++++++++++++++++++++++++-------------------------- src/namespacedef.h | 2 +- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/filedef.cpp b/src/filedef.cpp index 7149b97..842808e 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -790,7 +790,7 @@ void FileDefImpl::writeSummaryLinks(OutputList &ol) const ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } - else if (lde->kind()==LayoutDocEntry::FileNamespaces && m_namespaces.declVisible()) + else if (lde->kind()==LayoutDocEntry::FileNamespaces && m_namespaces.declVisible(false)) { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "namespaces"; diff --git a/src/groupdef.cpp b/src/groupdef.cpp index a1ed4d5..7670d27 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -1059,7 +1059,7 @@ void GroupDefImpl::writeSummaryLinks(OutputList &ol) const { if ((lde->kind()==LayoutDocEntry::GroupClasses && m_classes.declVisible()) || (lde->kind()==LayoutDocEntry::GroupConcepts && m_concepts.declVisible()) || - (lde->kind()==LayoutDocEntry::GroupNamespaces && m_namespaces.declVisible()) || + (lde->kind()==LayoutDocEntry::GroupNamespaces && m_namespaces.declVisible(false)) || (lde->kind()==LayoutDocEntry::GroupFiles && !m_fileList.empty()) || (lde->kind()==LayoutDocEntry::GroupNestedGroups && !m_groups.empty()) || (lde->kind()==LayoutDocEntry::GroupDirs && !m_dirList.empty()) diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 58d0ff0..f3ec7ae 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -839,13 +839,20 @@ void NamespaceDefImpl::writeSummaryLinks(OutputList &ol) const ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } - else if (lde->kind()==LayoutDocEntry::NamespaceNestedNamespaces && namespaces.declVisible()) + else if (lde->kind()==LayoutDocEntry::NamespaceNestedNamespaces && namespaces.declVisible(false)) { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "namespaces"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } + else if (lde->kind()==LayoutDocEntry::NamespaceNestedConstantGroups && namespaces.declVisible(true)) + { + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); + QCString label = "constantgroups"; + 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(); @@ -1270,28 +1277,9 @@ void NamespaceDefImpl::combineUsingRelations(NamespaceDefSet &visitedNamespaces) //------------------------------------------------------------------------------- -bool NamespaceLinkedRefMap::declVisible() const -{ - for (const auto &nd : *this) - { - if (nd->isLinkable()) - { - return TRUE; - } - } - return FALSE; -} - -void NamespaceLinkedRefMap::writeDeclaration(OutputList &ol,const QCString &title, - bool const isConstantGroup,bool localName) +bool NamespaceLinkedRefMap::declVisible(bool isConstantGroup) const { - - - if (empty()) return; // no namespaces in the list - - if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) return; - - bool found=FALSE; + bool found=false; for (const auto &nd : *this) { if (nd->isLinkable() && nd->hasDocumentation()) @@ -1301,7 +1289,7 @@ void NamespaceLinkedRefMap::writeDeclaration(OutputList &ol,const QCString &titl { if (isConstantGroup == nd->isConstantGroup()) { - found=TRUE; + found=true; break; } } @@ -1311,15 +1299,27 @@ void NamespaceLinkedRefMap::writeDeclaration(OutputList &ol,const QCString &titl { err("Internal inconsistency: constant group but not IDL?\n"); } - found=TRUE; + found=true; break; } } } - if (!found) return; // no linkable namespaces in the list + return found; +} + +void NamespaceLinkedRefMap::writeDeclaration(OutputList &ol,const QCString &title, + bool const isConstantGroup,bool localName) +{ + + + if (empty()) return; // no namespaces in the list + + if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) return; + + if (!declVisible(isConstantGroup)) return; // write list of namespaces - ol.startMemberHeader("namespaces"); + ol.startMemberHeader(isConstantGroup ? "constantgroups" : "namespaces"); //bool javaOpt = Config_getBool(OPTIMIZE_OUTPUT_JAVA); //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); ol.parseText(title); diff --git a/src/namespacedef.h b/src/namespacedef.h index 3c80470..46d2b1e 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -47,7 +47,7 @@ class NamespaceLinkedRefMap : public LinkedRefMap public: void writeDeclaration(OutputList &ol,const QCString &title, bool isConstantGroup=false, bool localName=FALSE); - bool declVisible() const; + bool declVisible(bool isContantGroup) const; }; /** An abstract interface of a namespace symbol. */ -- cgit v0.12