summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-12-23 12:07:03 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-12-23 12:07:03 (GMT)
commitbf5c2ac20e42f440ae0199d4d809b9d5e7e22191 (patch)
treeb4d2a77dfec1d6dcc57543d065ac5ce8ce648824
parent9bf7658013e49dabaafb818a639b5ca62f845538 (diff)
downloadDoxygen-bf5c2ac20e42f440ae0199d4d809b9d5e7e22191.zip
Doxygen-bf5c2ac20e42f440ae0199d4d809b9d5e7e22191.tar.gz
Doxygen-bf5c2ac20e42f440ae0199d4d809b9d5e7e22191.tar.bz2
Refactoring: replaced getNamespaceSDict() by getNamespaces()
-rw-r--r--addon/doxyapp/doxyapp.cpp4
-rw-r--r--src/context.cpp93
-rw-r--r--src/context.h2
-rw-r--r--src/dotgroupcollaboration.cpp11
-rw-r--r--src/filedef.cpp49
-rw-r--r--src/filedef.h6
-rw-r--r--src/groupdef.cpp49
-rw-r--r--src/groupdef.h3
-rw-r--r--src/index.cpp275
-rw-r--r--src/namespacedef.cpp66
-rw-r--r--src/namespacedef.h19
-rw-r--r--src/perlmodgen.cpp16
-rw-r--r--src/sqlite3gen.cpp26
-rw-r--r--src/util.cpp17
-rw-r--r--src/xmlgen.cpp24
15 files changed, 315 insertions, 345 deletions
diff --git a/addon/doxyapp/doxyapp.cpp b/addon/doxyapp/doxyapp.cpp
index c034bab..b89c5d9 100644
--- a/addon/doxyapp/doxyapp.cpp
+++ b/addon/doxyapp/doxyapp.cpp
@@ -186,9 +186,9 @@ static void lookupSymbol(Definition *d)
case Definition::TypeNamespace:
{
NamespaceDef *nd = dynamic_cast<NamespaceDef*>(d);
- printf("Kind: Namespace: contains %zu classes and %d namespaces\n",
+ printf("Kind: Namespace: contains %zu classes and %zu namespaces\n",
nd->getClasses().size(),
- nd->getNamespaceSDict() ? nd->getNamespaceSDict()->count() : 0);
+ nd->getNamespaces().size());
}
break;
case Definition::TypeMember:
diff --git a/src/context.cpp b/src/context.cpp
index 213e068..8c6de66 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -2765,16 +2765,11 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri
if (!cache.namespaces)
{
TemplateList *namespaceList = TemplateList::alloc();
- if (m_namespaceDef->getNamespaceSDict())
+ for (const auto &nd : m_namespaceDef->getNamespaces())
{
- NamespaceSDict::Iterator sdi(*m_namespaceDef->getNamespaceSDict());
- const NamespaceDef *nd;
- for (sdi.toFirst();(nd=sdi.current());++sdi)
+ if (nd->isLinkable() && !nd->isConstantGroup())
{
- if (nd->isLinkable() && !nd->isConstantGroup())
- {
- namespaceList->append(NamespaceContext::alloc(nd));
- }
+ namespaceList->append(NamespaceContext::alloc(nd));
}
}
cache.namespaces.reset(namespaceList);
@@ -2787,16 +2782,11 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri
if (!cache.constantgroups)
{
TemplateList *namespaceList = TemplateList::alloc();
- if (m_namespaceDef->getNamespaceSDict())
+ for (const auto &nd : m_namespaceDef->getNamespaces())
{
- NamespaceSDict::Iterator sdi(*m_namespaceDef->getNamespaceSDict());
- const NamespaceDef *nd;
- for (sdi.toFirst();(nd=sdi.current());++sdi)
+ if (nd->isLinkable() && nd->isConstantGroup())
{
- if (nd->isLinkable() && nd->isConstantGroup())
- {
- namespaceList->append(NamespaceContext::alloc(nd));
- }
+ namespaceList->append(NamespaceContext::alloc(nd));
}
}
cache.constantgroups.reset(namespaceList);
@@ -3214,16 +3204,11 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
if (!cache.namespaces)
{
TemplateList *namespaceList = TemplateList::alloc();
- if (m_fileDef->getNamespaceSDict())
+ for (const auto &nd : m_fileDef->getNamespaces())
{
- NamespaceSDict::Iterator sdi(*m_fileDef->getNamespaceSDict());
- const NamespaceDef *nd;
- for (sdi.toFirst();(nd=sdi.current());++sdi)
+ if (nd->isLinkable() && !nd->isConstantGroup())
{
- if (nd->isLinkable() && !nd->isConstantGroup())
- {
- namespaceList->append(NamespaceContext::alloc(nd));
- }
+ namespaceList->append(NamespaceContext::alloc(nd));
}
}
cache.namespaces.reset(namespaceList);
@@ -3236,16 +3221,11 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
if (!cache.constantgroups)
{
TemplateList *namespaceList = TemplateList::alloc();
- if (m_fileDef->getNamespaceSDict())
+ for (const auto &nd : m_fileDef->getNamespaces())
{
- NamespaceSDict::Iterator sdi(*m_fileDef->getNamespaceSDict());
- NamespaceDef *nd;
- for (sdi.toFirst();(nd=sdi.current());++sdi)
+ if (nd->isLinkable() && nd->isConstantGroup())
{
- if (nd->isLinkable() && nd->isConstantGroup())
- {
- namespaceList->append(NamespaceContext::alloc(nd));
- }
+ namespaceList->append(NamespaceContext::alloc(nd));
}
}
cache.constantgroups.reset(namespaceList);
@@ -5496,16 +5476,11 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private>
if (!cache.namespaces)
{
TemplateList *namespaceList = TemplateList::alloc();
- if (m_groupDef->getNamespaces())
+ for (const auto &nd : m_groupDef->getNamespaces())
{
- NamespaceSDict::Iterator sdi(*m_groupDef->getNamespaces());
- const NamespaceDef *nd;
- for (sdi.toFirst();(nd=sdi.current());++sdi)
+ if (nd->isLinkable() && !nd->isConstantGroup())
{
- if (nd->isLinkable() && !nd->isConstantGroup())
- {
- namespaceList->append(NamespaceContext::alloc(nd));
- }
+ namespaceList->append(NamespaceContext::alloc(nd));
}
}
cache.namespaces.reset(namespaceList);
@@ -5518,16 +5493,11 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private>
if (!cache.constantgroups)
{
TemplateList *namespaceList = TemplateList::alloc();
- if (m_groupDef->getNamespaces())
+ for (const auto &nd : m_groupDef->getNamespaces())
{
- NamespaceSDict::Iterator sdi(*m_groupDef->getNamespaces());
- NamespaceDef *nd;
- for (sdi.toFirst();(nd=sdi.current());++sdi)
+ if (nd->isLinkable() && nd->isConstantGroup())
{
- if (nd->isLinkable() && nd->isConstantGroup())
- {
- namespaceList->append(NamespaceContext::alloc(nd));
- }
+ namespaceList->append(NamespaceContext::alloc(nd));
}
}
cache.constantgroups.reset(namespaceList);
@@ -6403,9 +6373,9 @@ class NestingNodeContext::Private
void addNamespaces(bool addClasses,ClassDefSet &visitedClasses)
{
const NamespaceDef *nd = toNamespaceDef(m_def);
- if (nd && nd->getNamespaceSDict())
+ if (nd && !nd->getNamespaces().empty())
{
- m_children->addNamespaces(*nd->getNamespaceSDict(),FALSE,addClasses,visitedClasses);
+ m_children->addNamespaces(nd->getNamespaces(),FALSE,addClasses,visitedClasses);
}
if (addClasses && nd)
{
@@ -6515,6 +6485,24 @@ class NestingContext::Private : public GenericNodeListContext
}
}
}
+ void addNamespaces(const NamespaceLinkedRefMap &nsLinkedMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses)
+ {
+ for (const auto &nd : nsLinkedMap)
+ {
+ if (!nd->isAnonymous() &&
+ (!rootOnly || nd->getOuterScope()==Doxygen::globalScope))
+ {
+ bool hasChildren = namespaceHasNestedNamespace(nd);
+ bool isLinkable = nd->isLinkableInProject();
+ if (isLinkable || hasChildren)
+ {
+ NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,nd,m_index,m_level,addClasses,FALSE,FALSE,visitedClasses);
+ append(nnc);
+ m_index++;
+ }
+ }
+ }
+ }
void addClass(const ClassDef *cd,bool rootOnly,ClassDefSet &visitedClasses)
{
if (cd->getLanguage()==SrcLangExt_VHDL)
@@ -6747,6 +6735,11 @@ void NestingContext::addNamespaces(const NamespaceSDict &nsDict,bool rootOnly,bo
p->addNamespaces(nsDict,rootOnly,addClasses,visitedClasses);
}
+void NestingContext::addNamespaces(const NamespaceLinkedRefMap &nsLinkedRefMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses)
+{
+ p->addNamespaces(nsLinkedRefMap,rootOnly,addClasses,visitedClasses);
+}
+
void NestingContext::addDirs(const DirSDict &dirs,ClassDefSet &visitedClasses)
{
p->addDirs(dirs,visitedClasses);
diff --git a/src/context.h b/src/context.h
index 709fc83..25ce78b 100644
--- a/src/context.h
+++ b/src/context.h
@@ -28,6 +28,7 @@ class PageDef;
class GroupDef;
class NamespaceDef;
class NamespaceSDict;
+class NamespaceLinkedRefMap;
class FileDef;
class FileList;
class FileNameLinkedMap;
@@ -545,6 +546,7 @@ class NestingContext : public RefCountedContext, public TemplateListIntf
virtual int release() { return RefCountedContext::release(); }
void addNamespaces(const NamespaceSDict &nsDict,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses);
+ void addNamespaces(const NamespaceLinkedRefMap &nsLinkedMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses);
void addClasses(const ClassLinkedRefMap &clLinkedMap,bool rootOnly,ClassDefSet &visitedClasses);
void addClasses(const ClassLinkedMap &clLinkedMap,bool rootOnly,ClassDefSet &visitedClasses);
void addDirs(const DirSDict &,ClassDefSet &visitedClasses);
diff --git a/src/dotgroupcollaboration.cpp b/src/dotgroupcollaboration.cpp
index ecc937f..655a0e8 100644
--- a/src/dotgroupcollaboration.cpp
+++ b/src/dotgroupcollaboration.cpp
@@ -120,15 +120,10 @@ void DotGroupCollaboration::buildGraph(const GroupDef* gd)
}
// Add namespaces
- if ( gd->getNamespaces() && gd->getNamespaces()->count() )
+ for (const auto &def : gd->getNamespaces())
{
- NamespaceSDict::Iterator defli(*gd->getNamespaces());
- NamespaceDef *def;
- for (;(def=defli.current());++defli)
- {
- tmp_url = def->getReference()+"$"+def->getOutputFileBase()+Doxygen::htmlFileExtension;
- addCollaborationMember( def, tmp_url, DotGroupCollaboration::tnamespace );
- }
+ tmp_url = def->getReference()+"$"+def->getOutputFileBase()+Doxygen::htmlFileExtension;
+ addCollaborationMember( def, tmp_url, DotGroupCollaboration::tnamespace );
}
// Add files
diff --git a/src/filedef.cpp b/src/filedef.cpp
index 4d80ae4..e8d6066 100644
--- a/src/filedef.cpp
+++ b/src/filedef.cpp
@@ -86,7 +86,7 @@ class FileDefImpl : public DefinitionMixin<FileDef>
virtual MemberList *getMemberList(MemberListType lt) const;
virtual const QList<MemberList> &getMemberLists() const { return m_memberLists; }
virtual MemberGroupSDict *getMemberGroupSDict() const { return m_memberGroupSDict; }
- virtual NamespaceSDict *getNamespaceSDict() const { return m_namespaceSDict; }
+ virtual NamespaceLinkedRefMap getNamespaces() const { return m_namespaces; }
virtual ClassLinkedRefMap getClasses() const { return m_classes; }
virtual QCString title() const;
virtual bool hasDetailedDescription() const;
@@ -108,7 +108,7 @@ class FileDefImpl : public DefinitionMixin<FileDef>
virtual void setDiskName(const QCString &name);
virtual void insertMember(MemberDef *md);
virtual void insertClass(const ClassDef *cd);
- virtual void insertNamespace(NamespaceDef *nd);
+ virtual void insertNamespace(const NamespaceDef *nd);
virtual void computeAnchors();
virtual void setPackageDef(PackageDef *pd) { m_package=pd; }
virtual void setDirDef(DirDef *dd) { m_dir=dd; }
@@ -170,7 +170,7 @@ class FileDefImpl : public DefinitionMixin<FileDef>
DirDef *m_dir;
QList<MemberList> m_memberLists;
MemberGroupSDict *m_memberGroupSDict;
- NamespaceSDict *m_namespaceSDict;
+ NamespaceLinkedRefMap m_namespaces;
ClassLinkedRefMap m_classes;
ClassLinkedRefMap m_interfaces;
ClassLinkedRefMap m_structs;
@@ -230,7 +230,6 @@ FileDefImpl::FileDefImpl(const char *p,const char *nm,
m_includeDict = 0;
m_includedByList = 0;
m_includedByDict = 0;
- m_namespaceSDict = 0;
m_srcDefDict = 0;
m_srcMemberDict = 0;
m_package = 0;
@@ -254,7 +253,6 @@ FileDefImpl::~FileDefImpl()
delete m_includeList;
delete m_includedByDict;
delete m_includedByList;
- delete m_namespaceSDict;
delete m_srcDefDict;
delete m_srcMemberDict;
delete m_memberGroupSDict;
@@ -392,16 +390,11 @@ void FileDefImpl::writeTagFile(FTextStream &tagFile)
break;
case LayoutDocEntry::FileNamespaces:
{
- if (m_namespaceSDict)
+ for (const auto *nd : m_namespaces)
{
- SDict<NamespaceDef>::Iterator ni(*m_namespaceSDict);
- NamespaceDef *nd;
- for (ni.toFirst();(nd=ni.current());++ni)
+ if (nd->isLinkableInProject())
{
- if (nd->isLinkableInProject())
- {
- tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
- }
+ tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
}
}
}
@@ -705,7 +698,7 @@ void FileDefImpl::writeNamespaceDeclarations(OutputList &ol,const QCString &titl
bool const isConstantGroup)
{
// write list of namespaces
- if (m_namespaceSDict) m_namespaceSDict->writeDeclaration(ol,title,isConstantGroup);
+ m_namespaces.writeDeclaration(ol,title,isConstantGroup);
}
void FileDefImpl::writeClassDeclarations(OutputList &ol,const QCString &title,const ClassLinkedRefMap &list)
@@ -825,7 +818,7 @@ void FileDefImpl::writeSummaryLinks(OutputList &ol) const
ol.writeSummaryLink(0,label,ls->title(lang),first);
first=FALSE;
}
- else if (lde->kind()==LayoutDocEntry::FileNamespaces && m_namespaceSDict && m_namespaceSDict->declVisible())
+ else if (lde->kind()==LayoutDocEntry::FileNamespaces && m_namespaces.declVisible())
{
LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde;
QCString label = "namespaces";
@@ -1389,25 +1382,10 @@ void FileDefImpl::insertClass(const ClassDef *cd)
}
/*! Adds namespace definition \a nd to the list of all compounds of this file */
-void FileDefImpl::insertNamespace(NamespaceDef *nd)
+void FileDefImpl::insertNamespace(const NamespaceDef *nd)
{
if (nd->isHidden()) return;
- if (!nd->name().isEmpty() &&
- (m_namespaceSDict==0 || m_namespaceSDict->find(nd->name())==0))
- {
- if (m_namespaceSDict==0)
- {
- m_namespaceSDict = new NamespaceSDict;
- }
- if (Config_getBool(SORT_BRIEF_DOCS))
- {
- m_namespaceSDict->inSort(nd->name(),nd);
- }
- else
- {
- m_namespaceSDict->append(nd->name(),nd);
- }
- }
+ m_namespaces.add(nd->name(),nd);
}
QCString FileDefImpl::name() const
@@ -2028,6 +2006,13 @@ void FileDefImpl::sortMemberLists()
std::sort(m_interfaces.begin(),m_interfaces.end(),classComp);
std::sort(m_structs.begin(), m_structs.end(), classComp);
std::sort(m_exceptions.begin(),m_exceptions.end(),classComp);
+
+ auto namespaceComp = [](const NamespaceLinkedRefMap::Ptr &n1,const NamespaceLinkedRefMap::Ptr &n2)
+ {
+ return qstricmp(n1->name(),n2->name())<0;
+ };
+
+ std::sort(m_namespaces.begin(),m_namespaces.end(),namespaceComp);
}
}
diff --git a/src/filedef.h b/src/filedef.h
index e9816b4..26e5de5 100644
--- a/src/filedef.h
+++ b/src/filedef.h
@@ -38,7 +38,7 @@ class ClassList;
class MemberDef;
class OutputList;
class NamespaceDef;
-class NamespaceSDict;
+class NamespaceLinkedRefMap;
class MemberGroupSDict;
class PackageDef;
class DirDef;
@@ -133,7 +133,7 @@ class FileDef : public DefinitionMutable, public Definition
/* user defined member groups */
virtual MemberGroupSDict *getMemberGroupSDict() const = 0;
- virtual NamespaceSDict *getNamespaceSDict() const = 0;
+ virtual NamespaceLinkedRefMap getNamespaces() const = 0;
virtual ClassLinkedRefMap getClasses() const = 0;
virtual QCString title() const = 0;
@@ -164,7 +164,7 @@ class FileDef : public DefinitionMutable, public Definition
virtual void insertMember(MemberDef *md) = 0;
virtual void insertClass(const ClassDef *cd) = 0;
- virtual void insertNamespace(NamespaceDef *nd) = 0;
+ virtual void insertNamespace(const NamespaceDef *nd) = 0;
virtual void computeAnchors() = 0;
virtual void setPackageDef(PackageDef *pd) = 0;
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index b234d9c..e0d60bd 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -102,7 +102,7 @@ class GroupDefImpl : public DefinitionMixin<GroupDef>
virtual FileList * getFiles() const { return m_fileList; }
virtual ClassLinkedRefMap getClasses() const { return m_classes; }
- virtual NamespaceSDict * getNamespaces() const { return m_namespaceSDict; }
+ virtual NamespaceLinkedRefMap getNamespaces() const { return m_namespaces; }
virtual GroupList * getSubGroups() const { return m_groupList; }
virtual PageSDict * getPages() const { return m_pageDict; }
virtual const DirList & getDirs() const { return m_dirList; }
@@ -141,7 +141,7 @@ class GroupDefImpl : public DefinitionMixin<GroupDef>
QCString m_fileName; // base name of the generated file
FileList * m_fileList; // list of files in the group
ClassLinkedRefMap m_classes; // list of classes in the group
- NamespaceSDict * m_namespaceSDict; // list of namespaces in the group
+ NamespaceLinkedRefMap m_namespaces; // list of namespaces in the group
GroupList * m_groupList; // list of sub groups.
PageSDict * m_pageDict; // list of pages in the group
PageSDict * m_exampleDict; // list of examples in the group
@@ -169,7 +169,6 @@ GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t,
{
m_fileList = new FileList;
m_groupList = new GroupList;
- m_namespaceSDict = new NamespaceSDict(17);
m_pageDict = new PageSDict(17);
m_exampleDict = new PageSDict(17);
if (refFileName)
@@ -195,7 +194,6 @@ GroupDefImpl::~GroupDefImpl()
{
delete m_fileList;
delete m_groupList;
- delete m_namespaceSDict;
delete m_pageDict;
delete m_exampleDict;
delete m_allMemberList;
@@ -276,18 +274,14 @@ bool GroupDefImpl::addClass(const ClassDef *cd)
bool GroupDefImpl::addNamespace(const NamespaceDef *def)
{
- static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
- if (def->isHidden()) return FALSE;
- updateLanguage(def);
- if (m_namespaceSDict->find(def->name())==0)
+ if (def->isHidden()) return false;
+ if (m_namespaces.find(def->name())!=0)
{
- if (sortBriefDocs)
- m_namespaceSDict->inSort(def->name(),def);
- else
- m_namespaceSDict->append(def->name(),def);
- return TRUE;
+ updateLanguage(def);
+ m_namespaces.add(def->name(),def);
+ return true;
}
- return FALSE;
+ return false;
}
void GroupDefImpl::addDir(DirDef *def)
@@ -621,7 +615,7 @@ size_t GroupDefImpl::numDocMembers() const
{
return m_fileList->count()+
m_classes.size()+
- m_namespaceSDict->count()+
+ m_namespaces.size()+
m_groupList->count()+
m_allMemberList->count()+
m_pageDict->count()+
@@ -662,17 +656,12 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile)
break;
case LayoutDocEntry::GroupNamespaces:
{
- if (m_namespaceSDict)
+ for (const auto &nd : m_namespaces)
{
- SDict<NamespaceDef>::Iterator ni(*m_namespaceSDict);
- NamespaceDef *nd;
- for (ni.toFirst();(nd=ni.current());++ni)
+ if (nd->isLinkableInProject())
{
- if (nd->isLinkableInProject())
- {
- tagFile << " <namespace>" << convertToXML(nd->name())
- << "</namespace>" << endl;
- }
+ tagFile << " <namespace>" << convertToXML(nd->name())
+ << "</namespace>" << endl;
}
}
}
@@ -923,7 +912,7 @@ void GroupDefImpl::writeFiles(OutputList &ol,const QCString &title)
void GroupDefImpl::writeNamespaces(OutputList &ol,const QCString &title)
{
// write list of namespaces
- m_namespaceSDict->writeDeclaration(ol,title);
+ m_namespaces.writeDeclaration(ol,title);
}
void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title)
@@ -1115,7 +1104,7 @@ void GroupDefImpl::writeSummaryLinks(OutputList &ol) const
for (eli.toFirst();(lde=eli.current());++eli)
{
if ((lde->kind()==LayoutDocEntry::GroupClasses && m_classes.declVisible()) ||
- (lde->kind()==LayoutDocEntry::GroupNamespaces && m_namespaceSDict->declVisible()) ||
+ (lde->kind()==LayoutDocEntry::GroupNamespaces && m_namespaces.declVisible()) ||
(lde->kind()==LayoutDocEntry::GroupFiles && m_fileList->count()>0) ||
(lde->kind()==LayoutDocEntry::GroupNestedGroups && m_groupList->count()>0) ||
(lde->kind()==LayoutDocEntry::GroupDirs && !m_dirList.empty())
@@ -1739,10 +1728,18 @@ void GroupDefImpl::sortMemberLists()
qstricmp(c1->className(), c2->className())<0;
};
std::sort(m_classes.begin(), m_classes.end(), classComp);
+
+ auto namespaceComp = [](const NamespaceLinkedRefMap::Ptr &n1,const NamespaceLinkedRefMap::Ptr &n2)
+ {
+ return qstricmp(n1->name(),n2->name())<0;
+ };
+
+ std::sort(m_namespaces.begin(),m_namespaces.end(),namespaceComp);
}
else
{
groupClassesWithSameScope(m_classes);
+ groupClassesWithSameScope(m_namespaces);
}
}
diff --git a/src/groupdef.h b/src/groupdef.h
index 7109656..0b682c2 100644
--- a/src/groupdef.h
+++ b/src/groupdef.h
@@ -28,6 +28,7 @@
class MemberList;
class FileList;
class ClassLinkedRefMap;
+class NamespaceLinkedRefMap;
class FileDef;
class ClassDef;
class NamespaceDef;
@@ -96,7 +97,7 @@ class GroupDef : public DefinitionMutable, public Definition
virtual FileList * getFiles() const = 0;
virtual ClassLinkedRefMap getClasses() const = 0;
- virtual NamespaceSDict * getNamespaces() const = 0;
+ virtual NamespaceLinkedRefMap getNamespaces() const = 0;
virtual GroupList * getSubGroups() const = 0;
virtual PageSDict * getPages() const = 0;
virtual const DirList & getDirs() const = 0;
diff --git a/src/index.cpp b/src/index.cpp
index 106204c..2e5d9f8 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -1641,153 +1641,182 @@ static void writeNamespaceMembers(const NamespaceDef *nd,bool addToIndex)
}
}
-static void writeNamespaceTree(const NamespaceSDict *nsDict,FTVHelp *ftv,
- bool rootOnly,bool addToIndex)
+static void writeNamespaceTree(const NamespaceLinkedRefMap &nsLinkedMap,FTVHelp *ftv,
+ bool rootOnly,bool addToIndex);
+
+static void writeNamespaceTreeElement(const NamespaceDef *nd,FTVHelp *ftv,
+ bool rootOnly,bool addToIndex)
{
- if (nsDict)
+ if (!nd->isAnonymous() &&
+ (!rootOnly || nd->getOuterScope()==Doxygen::globalScope))
{
- NamespaceSDict::Iterator nli(*nsDict);
- const NamespaceDef *nd;
- for (nli.toFirst();(nd=nli.current());++nli)
- {
- if (!nd->isAnonymous() &&
- (!rootOnly || nd->getOuterScope()==Doxygen::globalScope))
- {
- bool hasChildren = namespaceHasNestedNamespace(nd) ||
- namespaceHasNestedClass(nd,false,ClassDef::Class);
- bool isLinkable = nd->isLinkableInProject();
- int visibleMembers = countVisibleMembers(nd);
+ bool hasChildren = namespaceHasNestedNamespace(nd) ||
+ namespaceHasNestedClass(nd,false,ClassDef::Class);
+ bool isLinkable = nd->isLinkableInProject();
+ int visibleMembers = countVisibleMembers(nd);
- //printf("namespace %s hasChildren=%d visibleMembers=%d\n",nd->name().data(),hasChildren,visibleMembers);
+ //printf("namespace %s hasChildren=%d visibleMembers=%d\n",nd->name().data(),hasChildren,visibleMembers);
- QCString ref;
- QCString file;
- if (isLinkable)
- {
- ref = nd->getReference();
- file = nd->getOutputFileBase();
- if (nd->getLanguage()==SrcLangExt_VHDL) // UGLY HACK
- {
- file=file.replace(0,qstrlen("namespace"),"class");
- }
- }
+ QCString ref;
+ QCString file;
+ if (isLinkable)
+ {
+ ref = nd->getReference();
+ file = nd->getOutputFileBase();
+ if (nd->getLanguage()==SrcLangExt_VHDL) // UGLY HACK
+ {
+ file=file.replace(0,qstrlen("namespace"),"class");
+ }
+ }
- bool isDir = hasChildren || visibleMembers>0;
- if ((isLinkable) || isDir)
- {
- ftv->addContentsItem(hasChildren,nd->localName(),ref,file,0,FALSE,TRUE,nd);
+ bool isDir = hasChildren || visibleMembers>0;
+ if ((isLinkable) || isDir)
+ {
+ ftv->addContentsItem(hasChildren,nd->localName(),ref,file,0,FALSE,TRUE,nd);
- if (addToIndex)
- {
- Doxygen::indexList->addContentsItem(isDir,nd->localName(),ref,file,QCString(),
- hasChildren && !file.isEmpty(),addToIndex);
- }
- if (addToIndex && isDir)
- {
- Doxygen::indexList->incContentsDepth();
- }
+ if (addToIndex)
+ {
+ Doxygen::indexList->addContentsItem(isDir,nd->localName(),ref,file,QCString(),
+ hasChildren && !file.isEmpty(),addToIndex);
+ }
+ if (addToIndex && isDir)
+ {
+ Doxygen::indexList->incContentsDepth();
+ }
- //printf("*** writeNamespaceTree count=%d addToIndex=%d false=%d classCount=%d\n",
- // count,addToIndex,false,classCount);
- if (isDir)
- {
- ftv->incContentsDepth();
- writeNamespaceTree(nd->getNamespaceSDict(),ftv,FALSE,addToIndex);
- writeClassTree(nd->getClasses(),ftv,FALSE,FALSE,ClassDef::Class);
- writeNamespaceMembers(nd,addToIndex);
- ftv->decContentsDepth();
- }
- if (addToIndex && isDir)
- {
- Doxygen::indexList->decContentsDepth();
- }
- }
+ //printf("*** writeNamespaceTree count=%d addToIndex=%d false=%d classCount=%d\n",
+ // count,addToIndex,false,classCount);
+ if (isDir)
+ {
+ ftv->incContentsDepth();
+ writeNamespaceTree(nd->getNamespaces(),ftv,FALSE,addToIndex);
+ writeClassTree(nd->getClasses(),ftv,FALSE,FALSE,ClassDef::Class);
+ writeNamespaceMembers(nd,addToIndex);
+ ftv->decContentsDepth();
+ }
+ if (addToIndex && isDir)
+ {
+ Doxygen::indexList->decContentsDepth();
}
}
}
}
-static void writeClassTreeInsideNamespace(const NamespaceSDict *nsDict,FTVHelp *ftv,
+static void writeNamespaceTree(const NamespaceLinkedRefMap &nsLinkedMap,FTVHelp *ftv,
+ bool rootOnly,bool addToIndex)
+{
+ for (const auto &nd : nsLinkedMap)
+ {
+ writeNamespaceTreeElement(nd,ftv,rootOnly,addToIndex);
+ }
+}
+
+static void writeNamespaceTree(const NamespaceSDict &nsDict,FTVHelp *ftv,
+ bool rootOnly,bool addToIndex)
+{
+ NamespaceSDict::Iterator nli(nsDict);
+ const NamespaceDef *nd;
+ for (nli.toFirst();(nd=nli.current());++nli)
+ {
+ writeNamespaceTreeElement(nd,ftv,rootOnly,addToIndex);
+ }
+}
+
+static void writeClassTreeInsideNamespace(const NamespaceLinkedRefMap &nsLinkedMap,FTVHelp *ftv,
+ bool rootOnly,bool addToIndex,ClassDef::CompoundType ct);
+
+static void writeClassTreeInsideNamespaceElement(const NamespaceDef *nd,FTVHelp *ftv,
bool rootOnly,bool addToIndex,ClassDef::CompoundType ct)
{
static bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE);
- if (nsDict)
+ if (!nd->isAnonymous() &&
+ (!rootOnly || nd->getOuterScope()==Doxygen::globalScope))
{
- NamespaceSDict::Iterator nli(*nsDict);
- const NamespaceDef *nd;
- for (nli.toFirst();(nd=nli.current());++nli)
+ bool isDir = namespaceHasNestedClass(nd,sliceOpt,ct);
+ bool isLinkable = nd->isLinkableInProject();
+
+ //printf("namespace %s isDir=%d\n",nd->name().data(),isDir);
+
+ QCString ref;
+ QCString file;
+ if (isLinkable)
{
- if (!nd->isAnonymous() &&
- (!rootOnly || nd->getOuterScope()==Doxygen::globalScope))
+ ref = nd->getReference();
+ file = nd->getOutputFileBase();
+ if (nd->getLanguage()==SrcLangExt_VHDL) // UGLY HACK
{
- bool isDir = namespaceHasNestedClass(nd,sliceOpt,ct);
- bool isLinkable = nd->isLinkableInProject();
+ file=file.replace(0,qstrlen("namespace"),"class");
+ }
+ }
- //printf("namespace %s isDir=%d\n",nd->name().data(),isDir);
+ if (isDir)
+ {
+ ftv->addContentsItem(isDir,nd->localName(),ref,file,0,FALSE,TRUE,nd);
- QCString ref;
- QCString file;
- if (isLinkable)
+ if (addToIndex)
+ {
+ // the namespace entry is already shown under the namespace list so don't
+ // add it to the nav index and don't create a separate index file for it otherwise
+ // it will overwrite the one written for the namespace list.
+ Doxygen::indexList->addContentsItem(isDir,nd->localName(),ref,file,QCString(),
+ false, // separateIndex
+ false // addToNavIndex
+ );
+ }
+ if (addToIndex)
+ {
+ Doxygen::indexList->incContentsDepth();
+ }
+
+ ftv->incContentsDepth();
+ writeClassTreeInsideNamespace(nd->getNamespaces(),ftv,FALSE,addToIndex,ct);
+ ClassLinkedRefMap d = nd->getClasses();
+ if (sliceOpt)
+ {
+ if (ct == ClassDef::Interface)
{
- ref = nd->getReference();
- file = nd->getOutputFileBase();
- if (nd->getLanguage()==SrcLangExt_VHDL) // UGLY HACK
- {
- file=file.replace(0,qstrlen("namespace"),"class");
- }
+ d = nd->getInterfaces();
}
-
- if (isDir)
+ else if (ct == ClassDef::Struct)
{
- ftv->addContentsItem(isDir,nd->localName(),ref,file,0,FALSE,TRUE,nd);
-
- if (addToIndex)
- {
- // the namespace entry is already shown under the namespace list so don't
- // add it to the nav index and don't create a separate index file for it otherwise
- // it will overwrite the one written for the namespace list.
- Doxygen::indexList->addContentsItem(isDir,nd->localName(),ref,file,QCString(),
- false, // separateIndex
- false // addToNavIndex
- );
- }
- if (addToIndex)
- {
- Doxygen::indexList->incContentsDepth();
- }
-
- ftv->incContentsDepth();
- writeClassTreeInsideNamespace(nd->getNamespaceSDict(),ftv,FALSE,addToIndex,ct);
- ClassLinkedRefMap d = nd->getClasses();
- if (sliceOpt)
- {
- if (ct == ClassDef::Interface)
- {
- d = nd->getInterfaces();
- }
- else if (ct == ClassDef::Struct)
- {
- d = nd->getStructs();
- }
- else if (ct == ClassDef::Exception)
- {
- d = nd->getExceptions();
- }
- }
- writeClassTree(d,ftv,addToIndex,FALSE,ct);
- ftv->decContentsDepth();
-
- if (addToIndex)
- {
- Doxygen::indexList->decContentsDepth();
- }
+ d = nd->getStructs();
+ }
+ else if (ct == ClassDef::Exception)
+ {
+ d = nd->getExceptions();
}
}
+ writeClassTree(d,ftv,addToIndex,FALSE,ct);
+ ftv->decContentsDepth();
+
+ if (addToIndex)
+ {
+ Doxygen::indexList->decContentsDepth();
+ }
}
}
}
+static void writeClassTreeInsideNamespace(const NamespaceLinkedRefMap &nsLinkedMap,FTVHelp *ftv,
+ bool rootOnly,bool addToIndex,ClassDef::CompoundType ct)
+{
+ for (const auto &nd : nsLinkedMap)
+ {
+ writeClassTreeInsideNamespaceElement(nd,ftv,rootOnly,addToIndex,ct);
+ }
+}
+
+static void writeClassTreeInsideNamespace(const NamespaceSDict &nsDict,FTVHelp *ftv,
+ bool rootOnly,bool addToIndex,ClassDef::CompoundType ct)
+{
+ NamespaceSDict::Iterator nli(nsDict);
+ const NamespaceDef *nd;
+ for (nli.toFirst();(nd=nli.current());++nli)
+ {
+ writeClassTreeInsideNamespaceElement(nd,ftv,rootOnly,addToIndex,ct);
+ }
+}
static void writeNamespaceIndex(OutputList &ol)
{
@@ -1878,7 +1907,7 @@ static void writeNamespaceIndex(OutputList &ol)
Doxygen::indexList->incContentsDepth();
}
FTVHelp* ftv = new FTVHelp(FALSE);
- writeNamespaceTree(Doxygen::namespaceSDict,ftv,TRUE,addToIndex);
+ writeNamespaceTree(*Doxygen::namespaceSDict,ftv,TRUE,addToIndex);
QGString outStr;
FTextStream t(&outStr);
ftv->generateTreeViewInline(t);
@@ -2447,7 +2476,7 @@ static void writeAnnotatedIndexGeneric(OutputList &ol,const AnnotatedIndexContex
Doxygen::indexList->incContentsDepth();
}
FTVHelp ftv(false);
- writeClassTreeInsideNamespace(Doxygen::namespaceSDict,&ftv,TRUE,addToIndex,ctx.compoundType);
+ writeClassTreeInsideNamespace(*Doxygen::namespaceSDict,&ftv,TRUE,addToIndex,ctx.compoundType);
writeClassTree(*Doxygen::classLinkedMap,&ftv,addToIndex,TRUE,ctx.compoundType);
QGString outStr;
FTextStream t(&outStr);
@@ -3779,7 +3808,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp*
numSubItems += ml->count();
}
}
- numSubItems += gd->getNamespaces()->count();
+ numSubItems += gd->getNamespaces().size();
numSubItems += gd->getClasses().size();
numSubItems += gd->getFiles()->count();
numSubItems += gd->getDirs().size();
@@ -3885,9 +3914,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp*
}
else if (lde->kind()==LayoutDocEntry::GroupNamespaces && addToIndex)
{
- NamespaceSDict::Iterator it(*gd->getNamespaces());
- NamespaceDef *nd;
- for (;(nd=it.current());++it)
+ for (const auto &nd : gd->getNamespaces())
{
if (nd->isVisible())
{
@@ -3913,7 +3940,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp*
}
else if (lde->kind()==LayoutDocEntry::GroupDirs && addToIndex)
{
- for (const auto dd : gd->getDirs())
+ for (const auto &dd : gd->getDirs())
{
if (dd->isVisible())
{
diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp
index 6a0bd4b..11597bc 100644
--- a/src/namespacedef.cpp
+++ b/src/namespacedef.cpp
@@ -102,7 +102,7 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable>
virtual ClassLinkedRefMap getInterfaces() const { return interfaces; }
virtual ClassLinkedRefMap getStructs() const { return structs; }
virtual ClassLinkedRefMap getExceptions() const { return exceptions; }
- virtual const NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; }
+ virtual NamespaceLinkedRefMap getNamespaces() const { return namespaces; }
virtual QCString title() const;
virtual QCString compoundTypeString() const;
@@ -145,7 +145,7 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable>
ClassLinkedRefMap interfaces;
ClassLinkedRefMap structs;
ClassLinkedRefMap exceptions;
- NamespaceSDict *namespaceSDict = 0;
+ NamespaceLinkedRefMap namespaces;
bool m_subGrouping = false;
enum { NAMESPACE, MODULE, CONSTANT_GROUP, LIBRARY } m_type;
bool m_isPublished = false;
@@ -222,8 +222,8 @@ class NamespaceDefAliasImpl : public DefinitionAliasMixin<NamespaceDef>
{ return getNSAlias()->getStructs(); }
virtual ClassLinkedRefMap getExceptions() const
{ return getNSAlias()->getExceptions(); }
- virtual const NamespaceSDict *getNamespaceSDict() const
- { return getNSAlias()->getNamespaceSDict(); }
+ virtual NamespaceLinkedRefMap getNamespaces() const
+ { return getNSAlias()->getNamespaces(); }
virtual QCString title() const
{ return getNSAlias()->title(); }
virtual QCString compoundTypeString() const
@@ -263,7 +263,6 @@ NamespaceDefImpl::NamespaceDefImpl(const char *df,int dl,int dc,
{
setFileName(name);
}
- namespaceSDict = new NamespaceSDict(17);
m_innerCompounds = new SDict<Definition>(17);
m_allMembersDict = 0;
setReference(lref);
@@ -291,7 +290,6 @@ NamespaceDefImpl::NamespaceDefImpl(const char *df,int dl,int dc,
NamespaceDefImpl::~NamespaceDefImpl()
{
- delete namespaceSDict;
delete m_innerCompounds;
delete memberGroupSDict;
delete m_allMembersDict;
@@ -390,13 +388,7 @@ void NamespaceDefImpl::insertClass(const ClassDef *cd)
void NamespaceDefImpl::insertNamespace(const NamespaceDef *nd)
{
- if (namespaceSDict->find(nd->name())==0)
- {
- if (Config_getBool(SORT_MEMBER_DOCS))
- namespaceSDict->inSort(nd->name(),nd);
- else
- namespaceSDict->append(nd->name(),nd);
- }
+ namespaces.add(nd->name(),nd);
}
@@ -587,16 +579,11 @@ void NamespaceDefImpl::writeTagFile(FTextStream &tagFile)
{
case LayoutDocEntry::NamespaceNestedNamespaces:
{
- if (namespaceSDict)
+ for (const auto &nd : namespaces)
{
- SDict<NamespaceDef>::Iterator ni(*namespaceSDict);
- NamespaceDef *nd;
- for (ni.toFirst();(nd=ni.current());++ni)
+ if (nd->isLinkableInProject())
{
- if (nd->isLinkableInProject())
- {
- tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
- }
+ tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
}
}
}
@@ -796,7 +783,7 @@ void NamespaceDefImpl::writeInlineClasses(OutputList &ol)
void NamespaceDefImpl::writeNamespaceDeclarations(OutputList &ol,const QCString &title,
bool const isConstantGroup)
{
- if (namespaceSDict) namespaceSDict->writeDeclaration(ol,title,isConstantGroup,TRUE);
+ namespaces.writeDeclaration(ol,title,isConstantGroup,TRUE);
}
void NamespaceDefImpl::writeMemberGroups(OutputList &ol)
@@ -869,7 +856,7 @@ void NamespaceDefImpl::writeSummaryLinks(OutputList &ol) const
ol.writeSummaryLink(0,label,ls->title(lang),first);
first=FALSE;
}
- else if (lde->kind()==LayoutDocEntry::NamespaceNestedNamespaces && namespaceSDict && namespaceSDict->declVisible())
+ else if (lde->kind()==LayoutDocEntry::NamespaceNestedNamespaces && namespaces.declVisible())
{
LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde;
QCString label = "namespaces";
@@ -1289,11 +1276,11 @@ void NamespaceDefImpl::combineUsingRelations(NamespaceDefSet &visitedNamespaces)
}
}
-bool NamespaceSDict::declVisible() const
+//-------------------------------------------------------------------------------
+
+bool NamespaceLinkedRefMap::declVisible() const
{
- SDict<NamespaceDef>::Iterator ni(*this);
- NamespaceDef *nd;
- for (ni.toFirst();(nd=ni.current());++ni)
+ for (const auto &nd : *this)
{
if (nd->isLinkable())
{
@@ -1303,20 +1290,17 @@ bool NamespaceSDict::declVisible() const
return FALSE;
}
-void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title,
+void NamespaceLinkedRefMap::writeDeclaration(OutputList &ol,const char *title,
bool const isConstantGroup,bool localName)
{
- if (count()==0) return; // no namespaces in the list
+ if (empty()) return; // no namespaces in the list
if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) return;
-
- SDict<NamespaceDef>::Iterator ni(*this);
- NamespaceDef *nd;
bool found=FALSE;
- for (ni.toFirst();(nd=ni.current()) && !found;++ni)
+ for (const auto &nd : *this)
{
if (nd->isLinkable() && nd->hasDocumentation())
{
@@ -1349,7 +1333,7 @@ void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title,
ol.parseText(title);
ol.endMemberHeader();
ol.startMemberList();
- for (ni.toFirst();(nd=ni.current());++ni)
+ for (const auto &nd : *this)
{
if (nd->isLinkable() && nd->hasDocumentation())
{
@@ -1386,6 +1370,8 @@ void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title,
ol.endMemberList();
}
+//-------------------------------------------------------------------------------
+
MemberList *NamespaceDefImpl::createMemberList(MemberListType lt)
{
m_memberLists.setAutoDelete(TRUE);
@@ -1438,7 +1424,7 @@ void NamespaceDefImpl::sortMemberLists()
{
auto classComp = [](const ClassLinkedRefMap::Ptr &c1,const ClassLinkedRefMap::Ptr &c2)
{
- return Config_getBool(SORT_BY_SCOPE_NAME) ?
+ return Config_getBool(SORT_BY_SCOPE_NAME) ?
qstricmp(c1->name(), c2->name())<0 :
qstricmp(c1->className(), c2->className())<0;
};
@@ -1447,12 +1433,16 @@ void NamespaceDefImpl::sortMemberLists()
std::sort(interfaces.begin(),interfaces.end(),classComp);
std::sort(structs.begin(), structs.end(), classComp);
std::sort(exceptions.begin(),exceptions.end(),classComp);
+
}
- if (namespaceSDict)
+ // TODO: inconsistent: should be only done when SORT_BRIEF_DOCS is enabled...
+ auto namespaceComp = [](const NamespaceLinkedRefMap::Ptr &n1,const NamespaceLinkedRefMap::Ptr &n2)
{
- namespaceSDict->sort();
- }
+ return qstricmp(n1->name(),n2->name())<0;
+ };
+
+ std::sort(namespaces.begin(),namespaces.end(),namespaceComp);
}
MemberList *NamespaceDefImpl::getMemberList(MemberListType lt) const
diff --git a/src/namespacedef.h b/src/namespacedef.h
index e22f069..c9f1280 100644
--- a/src/namespacedef.h
+++ b/src/namespacedef.h
@@ -31,7 +31,7 @@ class OutputList;
class ClassLinkedRefMap;
class MemberDef;
class MemberGroupSDict;
-class NamespaceSDict;
+class NamespaceDef;
class FTextStream;
class NamespaceDef;
class NamespaceDefMutable;
@@ -40,6 +40,14 @@ class NamespaceDefMutable;
using NamespaceDefSet = std::set<const NamespaceDef*>;
+class NamespaceLinkedRefMap : public LinkedRefMap<const NamespaceDef>
+{
+ public:
+ void writeDeclaration(OutputList &ol,const char *title,
+ bool isConstantGroup=false, bool localName=FALSE);
+ bool declVisible() const;
+};
+
/** An abstract interface of a namespace symbol. */
class NamespaceDef : public Definition
@@ -85,7 +93,7 @@ class NamespaceDef : public Definition
virtual ClassLinkedRefMap getExceptions() const = 0;
/*! Returns the namespaces contained in this namespace */
- virtual const NamespaceSDict *getNamespaceSDict() const = 0;
+ virtual NamespaceLinkedRefMap getNamespaces() const = 0;
virtual QCString title() const = 0;
virtual QCString compoundTypeString() const = 0;
@@ -140,7 +148,7 @@ NamespaceDefMutable *toNamespaceDefMutable(const Definition *d);
//------------------------------------------------------------------------
-
+#if 0
/** A list of NamespaceDef objects. */
class NamespaceList : public QList<NamespaceDef>
@@ -161,6 +169,7 @@ class NamespaceListIterator : public QListIterator<NamespaceDef>
QListIterator<NamespaceDef>(l) {}
};
+
/** An unsorted dictionary of NamespaceDef objects. */
class NamespaceDict : public QDict<NamespaceDef>
{
@@ -168,6 +177,7 @@ class NamespaceDict : public QDict<NamespaceDef>
NamespaceDict(uint size) : QDict<NamespaceDef>(size) {}
~NamespaceDict() {}
};
+#endif
/** A sorted dictionary of NamespaceDef objects. */
class NamespaceSDict : public SDict<NamespaceDef>
@@ -175,9 +185,6 @@ class NamespaceSDict : public SDict<NamespaceDef>
public:
NamespaceSDict(uint size=17) : SDict<NamespaceDef>(size) {}
~NamespaceSDict() {}
- void writeDeclaration(OutputList &ol,const char *title,
- bool isConstantGroup=false, bool localName=FALSE);
- bool declVisible() const;
private:
int compareValues(const NamespaceDef *item1,const NamespaceDef *item2) const
{
diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp
index 24f7482..918f39e 100644
--- a/src/perlmodgen.cpp
+++ b/src/perlmodgen.cpp
@@ -1966,6 +1966,7 @@ void PerlModGenerator::generatePerlModForNamespace(const NamespaceDef *nd)
m_output.openHash()
.addFieldQuotedString("name", nd->name());
+ if (!nd->getClasses().empty())
{
m_output.openList("classes");
for (const auto &cd : nd->getClasses())
@@ -1975,13 +1976,10 @@ void PerlModGenerator::generatePerlModForNamespace(const NamespaceDef *nd)
m_output.closeList();
}
- const NamespaceSDict *nl = nd->getNamespaceSDict();
- if (nl)
+ if (!nd->getNamespaces().empty())
{
m_output.openList("namespaces");
- NamespaceSDict::Iterator nli(*nl);
- const NamespaceDef *ind;
- for (nli.toFirst();(ind=nli.current());++nli)
+ for (const auto &ind : nd->getNamespaces())
m_output.openHash()
.addFieldQuotedString("name", ind->name())
.closeHash();
@@ -2108,6 +2106,7 @@ void PerlModGenerator::generatePerlModForGroup(const GroupDef *gd)
m_output.closeList();
}
+ if (!gd->getClasses().empty())
{
m_output.openList("classes");
for (const auto &cd : gd->getClasses())
@@ -2117,13 +2116,10 @@ void PerlModGenerator::generatePerlModForGroup(const GroupDef *gd)
m_output.closeList();
}
- NamespaceSDict *nl = gd->getNamespaces();
- if (nl)
+ if (!gd->getNamespaces().empty())
{
m_output.openList("namespaces");
- NamespaceSDict::Iterator nli(*nl);
- const NamespaceDef *nd;
- for (nli.toFirst();(nd=nli.current());++nli)
+ for (const auto &nd : gd->getNamespaces())
m_output.openHash()
.addFieldQuotedString("name", nd->name())
.closeHash();
diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp
index f06d6ee..e272ed0 100644
--- a/src/sqlite3gen.cpp
+++ b/src/sqlite3gen.cpp
@@ -1344,22 +1344,17 @@ static void writeInnerDirs(const DirList &dl, struct Refid outer_refid)
}
}
-static void writeInnerNamespaces(const NamespaceSDict *nl, struct Refid outer_refid)
+static void writeInnerNamespaces(const NamespaceLinkedRefMap &nl, struct Refid outer_refid)
{
- if (nl)
+ for (const auto &nd : nl)
{
- NamespaceSDict::Iterator nli(*nl);
- const NamespaceDef *nd;
- for (nli.toFirst();(nd=nli.current());++nli)
+ if (!nd->isHidden() && !nd->isAnonymous())
{
- if (!nd->isHidden() && !nd->isAnonymous())
- {
- struct Refid inner_refid = insertRefid(nd->getOutputFileBase());
+ struct Refid inner_refid = insertRefid(nd->getOutputFileBase());
- bindIntParameter(contains_insert,":inner_rowid",inner_refid.rowid);
- bindIntParameter(contains_insert,":outer_rowid",outer_refid.rowid);
- step(contains_insert);
- }
+ bindIntParameter(contains_insert,":inner_rowid",inner_refid.rowid);
+ bindIntParameter(contains_insert,":outer_rowid",outer_refid.rowid);
+ step(contains_insert);
}
}
}
@@ -2081,7 +2076,7 @@ static void generateSqlite3ForNamespace(const NamespaceDef *nd)
writeInnerClasses(nd->getClasses(),refid);
// + contained namespace definitions
- writeInnerNamespaces(nd->getNamespaceSDict(),refid);
+ writeInnerNamespaces(nd->getNamespaces(),refid);
// + member groups
if (nd->getMemberGroupSDict())
@@ -2243,10 +2238,7 @@ static void generateSqlite3ForFile(const FileDef *fd)
writeInnerClasses(fd->getClasses(),refid);
// + contained namespace definitions
- if (fd->getNamespaceSDict())
- {
- writeInnerNamespaces(fd->getNamespaceSDict(),refid);
- }
+ writeInnerNamespaces(fd->getNamespaces(),refid);
// + member groups
if (fd->getMemberGroupSDict())
diff --git a/src/util.cpp b/src/util.cpp
index 6ba4d4d..0ae2c86 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -6957,9 +6957,7 @@ uint getUtf8CodeToUpper( const QCString& s, int idx )
//
bool namespaceHasNestedNamespace(const NamespaceDef *nd)
{
- NamespaceSDict::Iterator cnli(*nd->getNamespaceSDict());
- const NamespaceDef *cnd;
- for (cnli.toFirst();(cnd=cnli.current());++cnli)
+ for (const auto &cnd : nd->getNamespaces())
{
if (cnd->isLinkableInProject() && !cnd->isAnonymous())
{
@@ -6972,17 +6970,12 @@ bool namespaceHasNestedNamespace(const NamespaceDef *nd)
bool namespaceHasNestedClass(const NamespaceDef *nd,bool filterClasses,ClassDef::CompoundType ct)
{
//printf(">namespaceHasVisibleChild(%s,includeClasses=%d)\n",nd->name().data(),includeClasses);
- if (nd->getNamespaceSDict())
+ for (const auto &cnd : nd->getNamespaces())
{
- NamespaceSDict::Iterator cnli(*nd->getNamespaceSDict());
- const NamespaceDef *cnd;
- for (cnli.toFirst();(cnd=cnli.current());++cnli)
+ if (namespaceHasNestedClass(cnd,filterClasses,ct))
{
- if (namespaceHasNestedClass(cnd,filterClasses,ct))
- {
- //printf("<namespaceHasVisibleChild(%s,includeClasses=%d): case2\n",nd->name().data(),includeClasses);
- return TRUE;
- }
+ //printf("<namespaceHasVisibleChild(%s,includeClasses=%d): case2\n",nd->name().data(),includeClasses);
+ return TRUE;
}
}
diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp
index 68ecdf0..7b52d67 100644
--- a/src/xmlgen.cpp
+++ b/src/xmlgen.cpp
@@ -1144,20 +1144,15 @@ static void writeInnerClasses(const ClassLinkedRefMap &cl,FTextStream &t)
}
}
-static void writeInnerNamespaces(const NamespaceSDict *nl,FTextStream &t)
+static void writeInnerNamespaces(const NamespaceLinkedRefMap &nl,FTextStream &t)
{
- if (nl)
+ for (const auto &nd : nl)
{
- NamespaceSDict::Iterator nli(*nl);
- const NamespaceDef *nd;
- for (nli.toFirst();(nd=nli.current());++nli)
+ if (!nd->isHidden() && !nd->isAnonymous())
{
- if (!nd->isHidden() && !nd->isAnonymous())
- {
- t << " <innernamespace refid=\"" << nd->getOutputFileBase()
- << "\"" << (nd->isInline() ? " inline=\"yes\"" : "")
- << ">" << convertToXML(nd->name()) << "</innernamespace>" << endl;
- }
+ t << " <innernamespace refid=\"" << nd->getOutputFileBase()
+ << "\"" << (nd->isInline() ? " inline=\"yes\"" : "")
+ << ">" << convertToXML(nd->name()) << "</innernamespace>" << endl;
}
}
}
@@ -1463,7 +1458,7 @@ static void generateXMLForNamespace(const NamespaceDef *nd,FTextStream &ti)
t << "</compoundname>" << endl;
writeInnerClasses(nd->getClasses(),t);
- writeInnerNamespaces(nd->getNamespaceSDict(),t);
+ writeInnerNamespaces(nd->getNamespaces(),t);
if (nd->getMemberGroupSDict())
{
@@ -1594,10 +1589,7 @@ static void generateXMLForFile(FileDef *fd,FTextStream &ti)
}
writeInnerClasses(fd->getClasses(),t);
- if (fd->getNamespaceSDict())
- {
- writeInnerNamespaces(fd->getNamespaceSDict(),t);
- }
+ writeInnerNamespaces(fd->getNamespaces(),t);
if (fd->getMemberGroupSDict())
{