summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/context.cpp107
-rw-r--r--src/context.h18
-rw-r--r--src/docbookgen.cpp12
-rw-r--r--src/docparser.cpp4
-rw-r--r--src/dotgroupcollaboration.cpp11
-rw-r--r--src/doxygen.cpp79
-rw-r--r--src/doxygen.h9
-rw-r--r--src/groupdef.cpp61
-rw-r--r--src/groupdef.h12
-rw-r--r--src/htmlgen.cpp2
-rw-r--r--src/index.cpp68
-rw-r--r--src/latexgen.cpp14
-rw-r--r--src/pagedef.cpp20
-rw-r--r--src/pagedef.h20
-rw-r--r--src/perlmodgen.cpp15
-rw-r--r--src/rtfgen.cpp22
-rw-r--r--src/searchindex.cpp12
-rw-r--r--src/sqlite3gen.cpp25
-rw-r--r--src/util.cpp13
-rw-r--r--src/xmlgen.cpp33
20 files changed, 225 insertions, 332 deletions
diff --git a/src/context.cpp b/src/context.cpp
index 58a297a..8e28077 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -5388,14 +5388,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private>
if (!cache.examples)
{
TemplateList *exampleList = TemplateList::alloc();
- if (m_groupDef->getExamples())
+ for (const auto &ex : m_groupDef->getExamples())
{
- PageSDict::Iterator eli(*m_groupDef->getExamples());
- const PageDef *ex;
- for (eli.toFirst();(ex=eli.current());++eli)
- {
- exampleList->append(PageContext::alloc(ex,FALSE,TRUE));
- }
+ exampleList->append(PageContext::alloc(ex,FALSE,TRUE));
}
cache.examples.reset(exampleList);
}
@@ -5407,14 +5402,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private>
if (!cache.pages)
{
TemplateList *pageList = TemplateList::alloc();
- if (m_groupDef->getExamples())
+ for (const auto &ex : m_groupDef->getPages())
{
- PageSDict::Iterator eli(*m_groupDef->getPages());
- const PageDef *ex;
- for (eli.toFirst();(ex=eli.current());++eli)
- {
- pageList->append(PageContext::alloc(ex,FALSE,TRUE));
- }
+ pageList->append(PageContext::alloc(ex,FALSE,TRUE));
}
cache.pages.reset(pageList);
}
@@ -6397,9 +6387,9 @@ class NestingNodeContext::Private
void addPages(ClassDefSet &visitedClasses)
{
const PageDef *pd = toPageDef(m_def);
- if (pd && pd->getSubPages())
+ if (pd && !pd->getSubPages().empty())
{
- m_children->addPages(*pd->getSubPages(),FALSE,visitedClasses);
+ m_children->addPages(pd->getSubPages(),FALSE,visitedClasses);
}
}
void addModules(ClassDefSet &visitedClasses)
@@ -6577,19 +6567,28 @@ class NestingContext::Private : public GenericNodeListContext
m_index++;
}
}
- void addPages(const PageSDict &pages,bool rootOnly,ClassDefSet &visitedClasses)
+ void addPage(const PageDef *pd,bool rootOnly,ClassDefSet &visitedClasses)
{
- SDict<PageDef>::Iterator pli(pages);
- const PageDef *pd;
- for (pli.toFirst();(pd=pli.current());++pli)
+ if (!rootOnly ||
+ pd->getOuterScope()==0 ||
+ pd->getOuterScope()->definitionType()!=Definition::TypePage)
{
- if (!rootOnly ||
- pd->getOuterScope()==0 ||
- pd->getOuterScope()->definitionType()!=Definition::TypePage)
- {
- append(NestingNodeContext::alloc(m_parent,pd,m_index,m_level,FALSE,FALSE,FALSE,visitedClasses));
- m_index++;
- }
+ append(NestingNodeContext::alloc(m_parent,pd,m_index,m_level,FALSE,FALSE,FALSE,visitedClasses));
+ m_index++;
+ }
+ }
+ void addPages(const PageLinkedMap &pages,bool rootOnly,ClassDefSet &visitedClasses)
+ {
+ for (const auto &pd : pages)
+ {
+ addPage(pd.get(),rootOnly,visitedClasses);
+ }
+ }
+ void addPages(const PageLinkedRefMap &pages,bool rootOnly,ClassDefSet &visitedClasses)
+ {
+ for (const auto &pd : pages)
+ {
+ addPage(pd,rootOnly,visitedClasses);
}
}
void addModules(const GroupSDict &groups,ClassDefSet &visitedClasses)
@@ -6751,7 +6750,12 @@ void NestingContext::addFiles(const FileList &files,ClassDefSet &visitedClasses)
p->addFiles(files,visitedClasses);
}
-void NestingContext::addPages(const PageSDict &pages,bool rootOnly,ClassDefSet &visitedClasses)
+void NestingContext::addPages(const PageLinkedMap &pages,bool rootOnly,ClassDefSet &visitedClasses)
+{
+ p->addPages(pages,rootOnly,visitedClasses);
+}
+
+void NestingContext::addPages(const PageLinkedRefMap &pages,bool rootOnly,ClassDefSet &visitedClasses)
{
p->addPages(pages,rootOnly,visitedClasses);
}
@@ -7331,15 +7335,12 @@ TemplateVariant FileTreeContext::get(const char *name) const
class PageTreeContext::Private
{
public:
- Private(const PageSDict *pages)
+ Private(const PageLinkedMap &pages)
{
m_pageTree.reset(NestingContext::alloc(0,0));
ClassDefSet visitedClasses;
// Add pages
- if (pages)
- {
- m_pageTree->addPages(*pages,TRUE,visitedClasses);
- }
+ m_pageTree->addPages(pages,TRUE,visitedClasses);
//%% PageNodeList tree:
static bool init=FALSE;
@@ -7420,7 +7421,7 @@ class PageTreeContext::Private
PropertyMapper<PageTreeContext::Private> PageTreeContext::Private::s_inst;
-PageTreeContext::PageTreeContext(const PageSDict *pages) : RefCountedContext("PageTreeContext")
+PageTreeContext::PageTreeContext(const PageLinkedMap &pages) : RefCountedContext("PageTreeContext")
{
p = new Private(pages);
}
@@ -7441,24 +7442,22 @@ TemplateVariant PageTreeContext::get(const char *name) const
class PageListContext::Private : public GenericNodeListContext
{
public:
- void addPages(const PageSDict &pages)
+ void addPages(const PageLinkedMap &pages)
{
- PageSDict::Iterator pdi(pages);
- const PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : pages)
{
if (!pd->getGroupDef() && !pd->isReference())
{
- append(PageContext::alloc(pd,FALSE,FALSE));
+ append(PageContext::alloc(pd.get(),FALSE,FALSE));
}
}
}
};
-PageListContext::PageListContext(const PageSDict *pages) : RefCountedContext("PageListContext")
+PageListContext::PageListContext(const PageLinkedMap &pages) : RefCountedContext("PageListContext")
{
p = new Private;
- if (pages) p->addPages(*pages);
+ p->addPages(pages);
}
PageListContext::~PageListContext()
@@ -7490,16 +7489,11 @@ class ExampleListContext::Private : public GenericNodeListContext
public:
Private()
{
- if (Doxygen::exampleSDict)
+ for (const auto &pd : *Doxygen::exampleLinkedMap)
{
- PageSDict::Iterator pdi(*Doxygen::exampleSDict);
- const PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ if (!pd->getGroupDef() && !pd->isReference())
{
- if (!pd->getGroupDef() && !pd->isReference())
- {
- append(PageContext::alloc(pd,FALSE,TRUE));
- }
+ append(PageContext::alloc(pd.get(),FALSE,TRUE));
}
}
}
@@ -7796,10 +7790,7 @@ class ExampleTreeContext::Private
m_exampleTree.reset(NestingContext::alloc(0,0));
ClassDefSet visitedClasses;
// Add pages
- if (Doxygen::exampleSDict)
- {
- m_exampleTree->addPages(*Doxygen::exampleSDict,TRUE,visitedClasses);
- }
+ m_exampleTree->addPages(*Doxygen::exampleLinkedMap,TRUE,visitedClasses);
static bool init=FALSE;
if (!init)
@@ -10141,8 +10132,8 @@ void generateOutputViaTemplate()
SharedPtr<DirListContext> dirList (DirListContext::alloc());
SharedPtr<FileListContext> fileList (FileListContext::alloc());
SharedPtr<FileTreeContext> fileTree (FileTreeContext::alloc());
- SharedPtr<PageTreeContext> pageTree (PageTreeContext::alloc(Doxygen::pageSDict));
- SharedPtr<PageListContext> pageList (PageListContext::alloc(Doxygen::pageSDict));
+ SharedPtr<PageTreeContext> pageTree (PageTreeContext::alloc(*Doxygen::pageLinkedMap));
+ SharedPtr<PageListContext> pageList (PageListContext::alloc(*Doxygen::pageLinkedMap));
SharedPtr<ExampleTreeContext> exampleTree (ExampleTreeContext::alloc());
SharedPtr<ExampleListContext> exampleList (ExampleListContext::alloc());
SharedPtr<ModuleTreeContext> moduleTree (ModuleTreeContext::alloc());
@@ -10191,15 +10182,15 @@ void generateOutputViaTemplate()
//%% Page mainPage
if (Doxygen::mainPage)
{
- SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage,TRUE,FALSE));
+ SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage.get(),TRUE,FALSE));
ctx->set("mainPage",mainPage.get());
}
else
{
// TODO: for LaTeX output index should be main... => solve in template
- Doxygen::mainPage = createPageDef("[generated]",1,"index","",theTranslator->trMainPage());
+ Doxygen::mainPage.reset(createPageDef("[generated]",1,"index","",theTranslator->trMainPage()));
Doxygen::mainPage->setFileName("index");
- SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage,TRUE,FALSE));
+ SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage.get(),TRUE,FALSE));
ctx->set("mainPage",mainPage.get());
}
//%% GlobalsIndex globalsIndex:
diff --git a/src/context.h b/src/context.h
index 9b4b0fe..885b811 100644
--- a/src/context.h
+++ b/src/context.h
@@ -27,6 +27,8 @@
class Definition;
class PageDef;
+class PageLinkedMap;
+class PageLinkedRefMap;
class GroupDef;
class NamespaceDef;
class NamespaceLinkedMap;
@@ -37,7 +39,6 @@ class FileNameLinkedMap;
class ClassLinkedMap;
class DirSDict;
class DirDef;
-class PageSDict;
class GroupSDict;
class GroupDef;
class GroupList;
@@ -543,13 +544,14 @@ class NestingContext : public RefCountedContext, public TemplateListIntf
void addNamespaces(const NamespaceLinkedMap &nsLinkedMap,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 addClasses(const ClassLinkedRefMap &clLinkedMap,bool rootOnly,ClassDefSet &visitedClasses);
void addDirs(const DirSDict &,ClassDefSet &visitedClasses);
void addDirs(const DirList &,ClassDefSet &visitedClasses);
void addFiles(const FileNameLinkedMap &,ClassDefSet &visitedClasses);
void addFiles(const FileList &,ClassDefSet &visitedClasses);
- void addPages(const PageSDict &pages,bool rootOnly,ClassDefSet &visitedClasses);
+ void addPages(const PageLinkedMap &pages,bool rootOnly,ClassDefSet &visitedClasses);
+ void addPages(const PageLinkedRefMap &pages,bool rootOnly,ClassDefSet &visitedClasses);
void addModules(const GroupSDict &modules,ClassDefSet &visitedClasses);
void addModules(const GroupList &modules,ClassDefSet &visitedClasses);
void addClassHierarchy(const ClassLinkedMap &clLinkedMap,ClassDefSet &visitedClasses);
@@ -687,7 +689,7 @@ class FileTreeContext : public RefCountedContext, public TemplateStructIntf
class PageListContext : public RefCountedContext, public TemplateListIntf
{
public:
- static PageListContext *alloc(const PageSDict *pages) { return new PageListContext(pages); }
+ static PageListContext *alloc(const PageLinkedMap &pages) { return new PageListContext(pages); }
// TemplateListIntf methods
virtual uint count() const;
@@ -696,10 +698,10 @@ class PageListContext : public RefCountedContext, public TemplateListIntf
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }
- void addPages(const PageSDict &pages);
+ void addPages(const PageLinkedMap &pages);
private:
- PageListContext(const PageSDict *pages);
+ PageListContext(const PageLinkedMap &pages);
~PageListContext();
class Private;
Private *p;
@@ -710,7 +712,7 @@ class PageListContext : public RefCountedContext, public TemplateListIntf
class PageTreeContext : public RefCountedContext, public TemplateStructIntf
{
public:
- static PageTreeContext *alloc(const PageSDict *pages) { return new PageTreeContext(pages); }
+ static PageTreeContext *alloc(const PageLinkedMap &pages) { return new PageTreeContext(pages); }
// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
@@ -718,7 +720,7 @@ class PageTreeContext : public RefCountedContext, public TemplateStructIntf
virtual int release() { return RefCountedContext::release(); }
private:
- PageTreeContext(const PageSDict *pages);
+ PageTreeContext(const PageLinkedMap &pages);
~PageTreeContext();
class Private;
Private *p;
diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp
index 2d0521b..f0749be 100644
--- a/src/docbookgen.cpp
+++ b/src/docbookgen.cpp
@@ -595,13 +595,7 @@ DB_GEN_C2("IndexSections " << is)
case isExampleDocumentation:
{
t << "</title>" << endl;
- PageSDict::Iterator pdi(*Doxygen::exampleSDict);
- PageDef *pd=pdi.toFirst();
- if (pd)
- {
- t << " <xi:include href=\"" << pd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl;
- }
- for (++pdi;(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::exampleLinkedMap)
{
t << " <xi:include href=\"" << pd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl;
}
@@ -620,9 +614,7 @@ DB_GEN_C2("IndexSections " << is)
void DocbookGenerator::writePageLink(const char *name, bool /*first*/)
{
DB_GEN_C
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd = pdi.toFirst();
- for (pd = pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
if (!pd->getGroupDef() && !pd->isReference() && pd->name() == stripPath(name))
{
diff --git a/src/docparser.cpp b/src/docparser.cpp
index af9e6a8..61326b4 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -693,7 +693,7 @@ static bool findDocsForMemberOrCompound(const char *commandName,
*pDef=gd;
return TRUE;
}
- pd = Doxygen::pageSDict->find(cmdArg);
+ pd = Doxygen::pageLinkedMap->find(cmdArg);
if (pd) // page
{
*pDoc=pd->documentation();
@@ -2427,7 +2427,7 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) :
PageDef *pd = 0;
if (sec->type()==SectionType::Page)
{
- pd = Doxygen::pageSDict->find(target);
+ pd = Doxygen::pageLinkedMap->find(target);
}
m_text = sec->title();
if (m_text.isEmpty()) m_text = sec->label();
diff --git a/src/dotgroupcollaboration.cpp b/src/dotgroupcollaboration.cpp
index 655a0e8..33ac397 100644
--- a/src/dotgroupcollaboration.cpp
+++ b/src/dotgroupcollaboration.cpp
@@ -139,15 +139,10 @@ void DotGroupCollaboration::buildGraph(const GroupDef* gd)
}
// Add pages
- if ( gd->getPages() && gd->getPages()->count() )
+ for (const auto &def : gd->getPages())
{
- PageSDict::Iterator defli(*gd->getPages());
- PageDef *def;
- for (;(def=defli.current());++defli)
- {
- tmp_url = def->getReference()+"$"+def->getOutputFileBase()+Doxygen::htmlFileExtension;
- addCollaborationMember( def, tmp_url, DotGroupCollaboration::tpages );
- }
+ tmp_url = def->getReference()+"$"+def->getOutputFileBase()+Doxygen::htmlFileExtension;
+ addCollaborationMember( def, tmp_url, DotGroupCollaboration::tpages );
}
// Add directories
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 642ea0d..b438cfa 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -124,8 +124,8 @@ MemberNameLinkedMap *Doxygen::memberNameLinkedMap = 0;
MemberNameLinkedMap *Doxygen::functionNameLinkedMap = 0;
FileNameLinkedMap *Doxygen::inputNameLinkedMap = 0;
GroupSDict *Doxygen::groupSDict = 0;
-PageSDict *Doxygen::pageSDict = 0;
-PageSDict *Doxygen::exampleSDict = 0;
+PageLinkedMap *Doxygen::pageLinkedMap = 0;
+PageLinkedMap *Doxygen::exampleLinkedMap = 0;
StringDict Doxygen::aliasDict(257); // aliases
StringSet Doxygen::inputPaths;
FileNameLinkedMap *Doxygen::includeNameLinkedMap = 0; // include names
@@ -138,7 +138,7 @@ StringUnorderedMap Doxygen::namespaceAliasMap; // all namespace al
StringDict Doxygen::tagDestinationDict(257); // all tag locations
StringUnorderedSet Doxygen::expandAsDefinedSet; // all macros that should be expanded
MemberGroupInfoMap Doxygen::memberGroupInfoMap; // dictionary of the member groups heading
-PageDef *Doxygen::mainPage = 0;
+std::unique_ptr<PageDef> Doxygen::mainPage;
bool Doxygen::insideMainPage = FALSE; // are we generating docs for the main page?
NamespaceDefMutable *Doxygen::globalScope = 0;
bool Doxygen::parseSourcesNeeded = FALSE;
@@ -183,8 +183,8 @@ void clearAll()
Doxygen::classLinkedMap->clear();
Doxygen::hiddenClassLinkedMap->clear();
Doxygen::namespaceLinkedMap->clear();
- Doxygen::pageSDict->clear();
- Doxygen::exampleSDict->clear();
+ Doxygen::pageLinkedMap->clear();
+ Doxygen::exampleLinkedMap->clear();
Doxygen::inputNameLinkedMap->clear();
Doxygen::includeNameLinkedMap->clear();
Doxygen::exampleNameLinkedMap->clear();
@@ -195,7 +195,7 @@ void clearAll()
Doxygen::tagDestinationDict.clear();
SectionManager::instance().clear();
CitationManager::instance().clear();
- delete Doxygen::mainPage; Doxygen::mainPage=0;
+ Doxygen::mainPage.reset();
FormulaManager::instance().clear();
}
@@ -4949,9 +4949,7 @@ static void addListReferences()
gd->addListReferences();
}
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
QCString name = pd->getOutputFileBase();
if (pd->getGroupDef())
@@ -8335,9 +8333,7 @@ static void findSectionsInDocumentation()
gd->findSectionsInDocumentation();
}
// for each page
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
pd->findSectionsInDocumentation();
}
@@ -8677,14 +8673,14 @@ static void findMainPage(Entry *root)
QCString title=root->args.stripWhiteSpace();
//QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index";
QCString indexName="index";
- Doxygen::mainPage = createPageDef(root->docFile,root->docLine,
- indexName, root->brief+root->doc+root->inbodyDocs,title);
+ Doxygen::mainPage.reset(createPageDef(root->docFile,root->docLine,
+ indexName, root->brief+root->doc+root->inbodyDocs,title));
//setFileNameForSections(root->anchors,"index",Doxygen::mainPage);
Doxygen::mainPage->setBriefDescription(root->brief,root->briefFile,root->briefLine);
Doxygen::mainPage->setBodySegment(root->startLine,root->startLine,-1);
Doxygen::mainPage->setFileName(indexName);
Doxygen::mainPage->setLocalToc(root->localToc);
- addPageToContext(Doxygen::mainPage,root);
+ addPageToContext(Doxygen::mainPage.get(),root);
const SectionInfo *si = SectionManager::instance().find(Doxygen::mainPage->name());
if (si)
@@ -8745,13 +8741,13 @@ static void computePageRelations(Entry *root)
)
{
PageDef *pd = root->section==Entry::PAGEDOC_SEC ?
- Doxygen::pageSDict->find(root->name) :
- Doxygen::mainPage;
+ Doxygen::pageLinkedMap->find(root->name) :
+ Doxygen::mainPage.get();
if (pd)
{
for (const BaseInfo &bi : root->extends)
{
- PageDef *subPd = Doxygen::pageSDict->find(bi.name);
+ PageDef *subPd = Doxygen::pageLinkedMap->find(bi.name);
if (pd==subPd)
{
term("page defined at line %d of file %s with label %s is a direct "
@@ -8772,14 +8768,12 @@ static void computePageRelations(Entry *root)
static void checkPageRelations()
{
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
Definition *ppd = pd->getOuterScope();
while (ppd)
{
- if (ppd==pd)
+ if (ppd==pd.get())
{
term("page defined at line %d of file %s with label %s is a subpage "
"of itself! Please remove this cyclic dependency.\n",
@@ -8823,7 +8817,7 @@ static void resolveUserReferences()
// if this section is in a page and the page is in a group, then we
// have to adjust the link file name to point to the group.
if (!si->fileName().isEmpty() &&
- (pd=Doxygen::pageSDict->find(si->fileName())) &&
+ (pd=Doxygen::pageLinkedMap->find(si->fileName())) &&
pd->getGroupDef())
{
si->setFileName(pd->getGroupDef()->getOutputFileBase());
@@ -8862,11 +8856,9 @@ static void resolveUserReferences()
static void generatePageDocs()
{
- //printf("documentedPages=%d real=%d\n",documentedPages,Doxygen::pageSDict->count());
+ //printf("documentedPages=%d real=%d\n",documentedPages,Doxygen::pageLinkedMap->count());
if (documentedPages==0) return;
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
if (!pd->getGroupDef() && !pd->isReference())
{
@@ -8885,7 +8877,7 @@ static void buildExampleList(Entry *root)
{
if ((root->section==Entry::EXAMPLE_SEC || root->section==Entry::EXAMPLE_LINENO_SEC) && !root->name.isEmpty())
{
- if (Doxygen::exampleSDict->find(root->name))
+ if (Doxygen::exampleLinkedMap->find(root->name))
{
warn(root->fileName,root->startLine,
"Example %s was already documented. Ignoring "
@@ -8895,15 +8887,16 @@ static void buildExampleList(Entry *root)
}
else
{
- PageDef *pd=createPageDef(root->fileName,root->startLine,
- root->name,root->brief+root->doc+root->inbodyDocs,root->args);
+ PageDef *pd = Doxygen::exampleLinkedMap->add(root->name,
+ std::unique_ptr<PageDef>(
+ createPageDef(root->fileName,root->startLine,
+ root->name,root->brief+root->doc+root->inbodyDocs,root->args)));
pd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
pd->setFileName(convertNameToFile(pd->name()+"-example",FALSE,TRUE));
pd->addSectionsToDefinition(root->anchors);
pd->setLanguage(root->lang);
pd->setShowLineNo(root->section==Entry::EXAMPLE_LINENO_SEC);
- Doxygen::exampleSDict->inSort(root->name,pd);
//we don't add example to groups
//addExampleToGroups(root,pd);
}
@@ -8935,9 +8928,7 @@ void printNavTree(Entry *root,int indent)
static void generateExampleDocs()
{
g_outputList->disable(OutputGenerator::Man);
- PageSDict::Iterator pdi(*Doxygen::exampleSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::exampleLinkedMap)
{
msg("Generating docs for example %s...\n",pd->name().data());
auto intf = Doxygen::parserManager->getCodeParser(".c"); // TODO: do this on code type
@@ -8953,9 +8944,9 @@ static void generateExampleDocs()
{
lineNoOptStr="{lineno}";
}
- g_outputList->generateDoc(pd->docFile(), // file
+ g_outputList->generateDoc(pd->docFile(), // file
pd->docLine(), // startLine
- pd, // context
+ pd.get(), // context
0, // memberDef
pd->documentation()+"\n\n\\include"+lineNoOptStr+" "+pd->name(), // docs
TRUE, // index words
@@ -10186,10 +10177,8 @@ void initDoxygen()
Doxygen::hiddenClassLinkedMap = new ClassLinkedMap;
Doxygen::directories = new DirSDict(17);
Doxygen::directories->setAutoDelete(TRUE);
- Doxygen::pageSDict = new PageSDict(1009); // all doc pages
- Doxygen::pageSDict->setAutoDelete(TRUE);
- Doxygen::exampleSDict = new PageSDict(1009); // all examples
- Doxygen::exampleSDict->setAutoDelete(TRUE);
+ Doxygen::pageLinkedMap = new PageLinkedMap; // all doc pages
+ Doxygen::exampleLinkedMap = new PageLinkedMap; // all examples
Doxygen::tagDestinationDict.setAutoDelete(TRUE);
Doxygen::dirRelations.setAutoDelete(TRUE);
Doxygen::indexList = new IndexList;
@@ -10231,9 +10220,9 @@ void cleanUpDoxygen()
delete Doxygen::dotFileNameLinkedMap;
delete Doxygen::mscFileNameLinkedMap;
delete Doxygen::diaFileNameLinkedMap;
- delete Doxygen::mainPage;
- delete Doxygen::pageSDict;
- delete Doxygen::exampleSDict;
+ Doxygen::mainPage.reset();
+ delete Doxygen::pageLinkedMap;
+ delete Doxygen::exampleLinkedMap;
delete Doxygen::globalScope;
delete Doxygen::parserManager;
delete theTranslator;
@@ -10811,9 +10800,7 @@ static void writeTagFile()
if (gd->isLinkableInProject()) gd->writeTagFile(tagFile);
}
// for each page
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
if (pd->isLinkableInProject()) pd->writeTagFile(tagFile);
}
diff --git a/src/doxygen.h b/src/doxygen.h
index 7f03f04..7fd5180 100644
--- a/src/doxygen.h
+++ b/src/doxygen.h
@@ -36,8 +36,7 @@
#define AtomicBool std::atomic_bool
class RefList;
-class PageSList;
-class PageSDict;
+class PageLinkedMap;
class PageDef;
class SearchIndexIntf;
class ParserManager;
@@ -99,9 +98,9 @@ class Doxygen
public:
static ClassLinkedMap *classLinkedMap;
static ClassLinkedMap *hiddenClassLinkedMap;
- static PageSDict *exampleSDict;
- static PageSDict *pageSDict;
- static PageDef *mainPage;
+ static PageLinkedMap *exampleLinkedMap;
+ static PageLinkedMap *pageLinkedMap;
+ static std::unique_ptr<PageDef> mainPage;
static bool insideMainPage;
static FileNameLinkedMap *includeNameLinkedMap;
static FileNameLinkedMap *exampleNameLinkedMap;
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index 84f02e9..df9b6eb 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -66,7 +66,7 @@ class GroupDefImpl : public DefinitionMixin<GroupDef>
virtual bool addClass(const ClassDef *def);
virtual bool addNamespace(const NamespaceDef *def);
virtual void addGroup(const GroupDef *def);
- virtual void addPage(PageDef *def);
+ virtual void addPage(const PageDef *def);
virtual void addExample(const PageDef *def);
virtual void addDir(DirDef *dd);
virtual bool insertMember(MemberDef *def,bool docOnly=FALSE);
@@ -101,12 +101,12 @@ class GroupDefImpl : public DefinitionMixin<GroupDef>
virtual const MemberGroupList &getMemberGroups() const { return m_memberGroups; }
virtual FileList * getFiles() const { return m_fileList; }
- virtual ClassLinkedRefMap getClasses() const { return m_classes; }
- 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; }
- virtual PageSDict * getExamples() const { return m_exampleDict; }
+ virtual const ClassLinkedRefMap &getClasses() const { return m_classes; }
+ virtual const NamespaceLinkedRefMap &getNamespaces() const { return m_namespaces; }
+ virtual GroupList * getSubGroups() const { return m_groupList; }
+ virtual const PageLinkedRefMap &getPages() const { return m_pages; }
+ virtual const DirList & getDirs() const { return m_dirList; }
+ virtual const PageLinkedRefMap &getExamples() const { return m_examples; }
virtual bool hasDetailedDescription() const;
virtual void sortSubGroups();
@@ -143,8 +143,8 @@ class GroupDefImpl : public DefinitionMixin<GroupDef>
ClassLinkedRefMap m_classes; // list of classes 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
+ PageLinkedRefMap m_pages; // list of pages in the group
+ PageLinkedRefMap m_examples; // list of examples in the group
DirList m_dirList; // list of directories in the group
MemberList * m_allMemberList;
MemberNameInfoLinkedMap m_allMemberNameInfoLinkedMap;
@@ -169,8 +169,6 @@ GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t,
{
m_fileList = new FileList;
m_groupList = new GroupList;
- m_pageDict = new PageSDict(17);
- m_exampleDict = new PageSDict(17);
if (refFileName)
{
m_fileName=stripExtension(refFileName);
@@ -192,8 +190,6 @@ GroupDefImpl::~GroupDefImpl()
{
delete m_fileList;
delete m_groupList;
- delete m_pageDict;
- delete m_exampleDict;
delete m_allMemberList;
}
@@ -284,18 +280,18 @@ void GroupDefImpl::addDir(DirDef *def)
m_dirList.push_back(def);
}
-void GroupDefImpl::addPage(PageDef *def)
+void GroupDefImpl::addPage(const PageDef *def)
{
if (def->isHidden()) return;
//printf("Making page %s part of a group\n",def->name.data());
- m_pageDict->append(def->name(),def);
- def->makePartOfGroup(this);
+ m_pages.add(def->name(),def);
+ const_cast<PageDef*>(def)->makePartOfGroup(this);
}
void GroupDefImpl::addExample(const PageDef *def)
{
if (def->isHidden()) return;
- m_exampleDict->append(def->name(),def);
+ m_examples.add(def->name(),def);
}
@@ -605,8 +601,8 @@ size_t GroupDefImpl::numDocMembers() const
m_namespaces.size()+
m_groupList->count()+
m_allMemberList->count()+
- m_pageDict->count()+
- m_exampleDict->count();
+ m_pages.size()+
+ m_examples.size();
}
/*! Compute the HTML anchor names for all members in the group */
@@ -671,24 +667,19 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile)
break;
case LayoutDocEntry::GroupPageDocs:
{
- if (m_pageDict)
+ for (const auto &pd : m_pages)
{
- PageSDict::Iterator pdi(*m_pageDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ QCString pageName = pd->getOutputFileBase();
+ if (pd->isLinkableInProject())
{
- QCString pageName = pd->getOutputFileBase();
- if (pd->isLinkableInProject())
- {
- tagFile << " <page>" << convertToXML(pageName) << "</page>" << endl;
- }
+ tagFile << " <page>" << convertToXML(pageName) << "</page>" << endl;
}
}
}
break;
case LayoutDocEntry::GroupDirs:
{
- for(const auto dd : m_dirList)
+ for(const auto &dd : m_dirList)
{
if (dd->isLinkableInProject())
{
@@ -746,7 +737,7 @@ void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title
)
{
ol.pushGeneratorState();
- if (m_pageDict->count()!=numDocMembers()) // not only pages -> classical layout
+ if (m_pages.size()!=numDocMembers()) // not only pages -> classical layout
{
ol.pushGeneratorState();
ol.disable(OutputGenerator::Html);
@@ -993,9 +984,7 @@ void GroupDefImpl::writeInlineClasses(OutputList &ol)
void GroupDefImpl::writePageDocumentation(OutputList &ol)
{
- PageDef *pd=0;
- PageSDict::Iterator pdi(*m_pageDict);
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto *pd : m_pages)
{
if (!pd->isReference())
{
@@ -1786,8 +1775,10 @@ void GroupDefImpl::updateLanguage(const Definition *d)
bool GroupDefImpl::hasDetailedDescription() const
{
static bool repeatBrief = Config_getBool(REPEAT_BRIEF);
- return ((!briefDescription().isEmpty() && repeatBrief) || !documentation().isEmpty() || !inbodyDocumentation().isEmpty()) &&
- (m_pageDict->count()!=numDocMembers());
+ return ((!briefDescription().isEmpty() && repeatBrief) ||
+ !documentation().isEmpty() ||
+ !inbodyDocumentation().isEmpty()) &&
+ (m_pages.size()!=numDocMembers());
}
// --- Cast functions
diff --git a/src/groupdef.h b/src/groupdef.h
index f8d17b9..98a40f1 100644
--- a/src/groupdef.h
+++ b/src/groupdef.h
@@ -36,7 +36,7 @@ class NamespaceDef;
class GroupList;
class OutputList;
class NamespaceSDict;
-class PageSDict;
+class PageLinkedRefMap;
class PageDef;
class DirDef;
class FTVHelp;
@@ -61,7 +61,7 @@ class GroupDef : public DefinitionMutable, public Definition
virtual bool addClass(const ClassDef *def) = 0;
virtual bool addNamespace(const NamespaceDef *def) = 0;
virtual void addGroup(const GroupDef *def) = 0;
- virtual void addPage(PageDef *def) = 0;
+ virtual void addPage(const PageDef *def) = 0;
virtual void addExample(const PageDef *def) = 0;
virtual void addDir(DirDef *dd) = 0;
virtual bool insertMember(MemberDef *def,bool docOnly=FALSE) = 0;
@@ -96,12 +96,12 @@ class GroupDef : public DefinitionMutable, public Definition
virtual const MemberGroupList &getMemberGroups() const = 0;
virtual FileList * getFiles() const = 0;
- virtual ClassLinkedRefMap getClasses() const = 0;
- virtual NamespaceLinkedRefMap getNamespaces() const = 0;
+ virtual const ClassLinkedRefMap &getClasses() const = 0;
+ virtual const NamespaceLinkedRefMap &getNamespaces() const = 0;
virtual GroupList * getSubGroups() const = 0;
- virtual PageSDict * getPages() const = 0;
+ virtual const PageLinkedRefMap &getPages() const = 0;
virtual const DirList & getDirs() const = 0;
- virtual PageSDict * getExamples() const = 0;
+ virtual const PageLinkedRefMap &getExamples() const = 0;
virtual bool hasDetailedDescription() const = 0;
virtual void sortSubGroups() = 0;
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index cd615e4..e186c37 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -2350,7 +2350,7 @@ static bool quickLinkVisible(LayoutNavEntry::Kind kind)
case LayoutNavEntry::Files: return documentedHtmlFiles>0 && showFiles;
case LayoutNavEntry::FileList: return documentedHtmlFiles>0 && showFiles;
case LayoutNavEntry::FileGlobals: return documentedFileMembers[FMHL_All]>0;
- case LayoutNavEntry::Examples: return Doxygen::exampleSDict->count()>0;
+ case LayoutNavEntry::Examples: return !Doxygen::exampleLinkedMap->empty();
case LayoutNavEntry::Interfaces: return annotatedInterfaces>0;
case LayoutNavEntry::InterfaceList: return annotatedInterfaces>0;
case LayoutNavEntry::InterfaceIndex: return annotatedInterfaces>0;
diff --git a/src/index.cpp b/src/index.cpp
index dff2515..3d3448d 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -3455,7 +3455,7 @@ static void writeNamespaceMemberIndex(OutputList &ol)
static void writeExampleIndex(OutputList &ol)
{
- if (Doxygen::exampleSDict->count()==0) return;
+ if (Doxygen::exampleLinkedMap->empty()) return;
ol.pushGeneratorState();
ol.disable(OutputGenerator::Man);
ol.disable(OutputGenerator::Docbook);
@@ -3482,9 +3482,7 @@ static void writeExampleIndex(OutputList &ol)
ol.endTextBlock();
ol.startItemList();
- PageSDict::Iterator pdi(*Doxygen::exampleSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::exampleLinkedMap)
{
ol.startItemListItem();
QCString n=pd->getOutputFileBase();
@@ -3523,15 +3521,13 @@ static void writeExampleIndex(OutputList &ol)
static void countRelatedPages(int &docPages,int &indexPages)
{
docPages=indexPages=0;
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
- if ( pd->visibleInIndex())
+ if (pd->visibleInIndex())
{
indexPages++;
}
- if ( pd->documentedPage())
+ if (pd->documentedPage())
{
docPages++;
}
@@ -3551,7 +3547,7 @@ static bool mainPageHasOwnTitle()
return !projectName.isEmpty() && mainPageHasTitle() && qstricmp(title,projectName)!=0;
}
-static void writePages(PageDef *pd,FTVHelp *ftv)
+static void writePages(const PageDef *pd,FTVHelp *ftv)
{
//printf("writePages()=%s pd=%p mainpage=%p\n",pd->name().data(),pd,Doxygen::mainPage);
LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Pages);
@@ -3578,7 +3574,7 @@ static void writePages(PageDef *pd,FTVHelp *ftv)
pd->getReference(),pd->getOutputFileBase(),
0,hasSubPages,TRUE,pd);
}
- if (addToIndex && pd!=Doxygen::mainPage)
+ if (addToIndex && pd!=Doxygen::mainPage.get())
{
Doxygen::indexList->addContentsItem(
hasSubPages || hasSections,pageTitle,
@@ -3588,24 +3584,18 @@ static void writePages(PageDef *pd,FTVHelp *ftv)
}
if (hasSubPages && ftv) ftv->incContentsDepth();
bool doIndent = (hasSections || hasSubPages) &&
- (pd!=Doxygen::mainPage || mainPageHasOwnTitle());
+ (pd!=Doxygen::mainPage.get() || mainPageHasOwnTitle());
if (doIndent)
{
Doxygen::indexList->incContentsDepth();
}
if (hasSections)
{
- pd->addSectionsToIndex();
+ const_cast<PageDef*>(pd)->addSectionsToIndex();
}
- PageSDict *subPages = pd->getSubPages();
- if (subPages)
+ for (const auto &subPage : pd->getSubPages())
{
- PageSDict::Iterator pi(*subPages);
- PageDef *subPage;
- for (pi.toFirst();(subPage=pi.current());++pi)
- {
- writePages(subPage,ftv);
- }
+ writePages(subPage,ftv);
}
if (hasSubPages && ftv) ftv->decContentsDepth();
if (doIndent)
@@ -3635,16 +3625,14 @@ static void writePageIndex(OutputList &ol)
{
FTVHelp* ftv = new FTVHelp(FALSE);
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
if ((pd->getOuterScope()==0 ||
pd->getOuterScope()->definitionType()!=Definition::TypePage) && // not a sub page
!pd->isReference() // not an external page
)
{
- writePages(pd,ftv);
+ writePages(pd.get(),ftv);
}
}
QGString outStr;
@@ -3773,7 +3761,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp*
//printf("gd->name()=%s #members=%d\n",gd->name().data(),gd->countMembers());
// write group info
bool hasSubGroups = gd->getSubGroups()->count()>0;
- bool hasSubPages = gd->getPages()->count()>0;
+ bool hasSubPages = !gd->getPages().empty();
size_t numSubItems = 0;
if (1 /*Config_getBool(TOC_EXPAND)*/)
{
@@ -3790,7 +3778,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp*
numSubItems += gd->getClasses().size();
numSubItems += gd->getFiles()->count();
numSubItems += gd->getDirs().size();
- numSubItems += gd->getPages()->count();
+ numSubItems += gd->getPages().size();
}
bool isDir = hasSubGroups || hasSubPages || numSubItems>0;
@@ -3930,9 +3918,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp*
}
else if (lde->kind()==LayoutDocEntry::GroupPageDocs && addToIndex)
{
- SDict<PageDef>::Iterator it(*gd->getPages());
- PageDef *pd;
- for (;(pd=it.current());++it)
+ for (const auto &pd : gd->getPages())
{
const SectionInfo *si=0;
if (!pd->name().isEmpty()) si=SectionManager::instance().find(pd->name());
@@ -3952,7 +3938,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp*
}
if (hasSections)
{
- pd->addSectionsToIndex();
+ const_cast<PageDef*>(pd)->addSectionsToIndex();
}
writePages(pd,0);
if (hasSections || hasSubPages)
@@ -4170,7 +4156,7 @@ static void writeIndex(OutputList &ol)
}
if (Doxygen::mainPage->hasSubPages() || Doxygen::mainPage->hasSections())
{
- writePages(Doxygen::mainPage,0);
+ writePages(Doxygen::mainPage.get(),0);
}
}
@@ -4202,7 +4188,7 @@ static void writeIndex(OutputList &ol)
ol.startHeaderSection();
ol.startTitleHead(0);
ol.generateDoc(Doxygen::mainPage->docFile(),Doxygen::mainPage->getStartBodyLine(),
- Doxygen::mainPage,0,Doxygen::mainPage->title(),TRUE,FALSE,
+ Doxygen::mainPage.get(),0,Doxygen::mainPage->title(),TRUE,FALSE,
0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
headerWritten = TRUE;
}
@@ -4238,7 +4224,7 @@ static void writeIndex(OutputList &ol)
}
ol.startTextBlock();
- ol.generateDoc(defFileName,defLine,Doxygen::mainPage,0,
+ ol.generateDoc(defFileName,defLine,Doxygen::mainPage.get(),0,
Doxygen::mainPage->documentation(),TRUE,FALSE,
0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
ol.endTextBlock();
@@ -4277,7 +4263,7 @@ static void writeIndex(OutputList &ol)
if (!Config_getString(PROJECT_NUMBER).isEmpty())
{
ol.startProjectNumber();
- ol.generateDoc(defFileName,defLine,Doxygen::mainPage,0,Config_getString(PROJECT_NUMBER),FALSE,FALSE,
+ ol.generateDoc(defFileName,defLine,Doxygen::mainPage.get(),0,Config_getString(PROJECT_NUMBER),FALSE,FALSE,
0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
ol.endProjectNumber();
}
@@ -4306,14 +4292,12 @@ static void writeIndex(OutputList &ol)
{
//ol.parseText(projPrefix+theTranslator->trPageDocumentation());
//ol.endIndexSection(isPageDocumentation);
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd=pdi.toFirst();
bool first=Doxygen::mainPage==0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
if (!pd->getGroupDef() && !pd->isReference() &&
(!pd->hasParentPage() || // not inside other page
- (Doxygen::mainPage==pd->getOuterScope())) // or inside main page
+ (Doxygen::mainPage.get()==pd->getOuterScope())) // or inside main page
)
{
bool isCitationPage = pd->name()=="citelist";
@@ -4474,7 +4458,7 @@ static void writeIndex(OutputList &ol)
ol.parseText(/*projPrefix+*/theTranslator->trFileDocumentation());
ol.endIndexSection(isFileDocumentation);
}
- if (Doxygen::exampleSDict->count()>0)
+ if (!Doxygen::exampleLinkedMap->empty())
{
ol.startIndexSection(isExampleDocumentation);
ol.parseText(/*projPrefix+*/theTranslator->trExampleDocumentation());
@@ -4490,7 +4474,7 @@ static void writeIndex(OutputList &ol)
startFile(ol,Doxygen::mainPage->name(),0,Doxygen::mainPage->title());
ol.startContents();
ol.startTextBlock();
- ol.generateDoc(defFileName,defLine,Doxygen::mainPage,0,
+ ol.generateDoc(defFileName,defLine,Doxygen::mainPage.get(),0,
Doxygen::mainPage->documentation(),FALSE,FALSE,
0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)
);
@@ -4843,7 +4827,7 @@ static bool quickLinkVisible(LayoutNavEntry::Kind kind)
case LayoutNavEntry::Files: return documentedHtmlFiles>0 && showFiles;
case LayoutNavEntry::FileList: return documentedHtmlFiles>0 && showFiles;
case LayoutNavEntry::FileGlobals: return documentedFileMembers[FMHL_All]>0;
- case LayoutNavEntry::Examples: return Doxygen::exampleSDict->count()>0;
+ case LayoutNavEntry::Examples: return !Doxygen::exampleLinkedMap->empty();
case LayoutNavEntry::None: // should never happen, means not properly initialized
assert(kind != LayoutNavEntry::None);
return FALSE;
diff --git a/src/latexgen.cpp b/src/latexgen.cpp
index bfde4d1..7db49d9 100644
--- a/src/latexgen.cpp
+++ b/src/latexgen.cpp
@@ -1256,28 +1256,18 @@ void LatexGenerator::endIndexSection(IndexSections is)
case isExampleDocumentation:
{
t << "}\n";
- PageSDict::Iterator pdi(*Doxygen::exampleSDict);
- PageDef *pd=pdi.toFirst();
- if (pd)
+ for (const auto &pd : *Doxygen::exampleLinkedMap)
{
t << "\\input{" << pd->getOutputFileBase() << "}\n";
}
- for (++pdi;(pd=pdi.current());++pdi)
- {
- //if (compactLatex) t << "\\input" ; else t << "\\include";
- t << "\\input";
- t << "{" << pd->getOutputFileBase() << "}\n";
- }
}
break;
case isPageDocumentation:
{
t << "}\n";
#if 0
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd=pdi.toFirst();
bool first=TRUE;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto *pd : Doxygen::pageLinkedMap)
{
if (!pd->getGroupDef() && !pd->isReference())
{
diff --git a/src/pagedef.cpp b/src/pagedef.cpp
index b0d375e..63c0803 100644
--- a/src/pagedef.cpp
+++ b/src/pagedef.cpp
@@ -46,7 +46,7 @@ class PageDefImpl : public DefinitionMixin<PageDef>
virtual void findSectionsInDocumentation();
virtual QCString title() const { return m_title; }
virtual GroupDef * getGroupDef() const;
- virtual PageSDict * getSubPages() const { return m_subPageDict; }
+ virtual const PageLinkedRefMap &getSubPages() const { return m_subPages; }
virtual void addInnerCompound(const Definition *d);
virtual bool visibleInIndex() const;
virtual bool documentedPage() const;
@@ -61,12 +61,12 @@ class PageDefImpl : public DefinitionMixin<PageDef>
virtual void writeDocumentation(OutputList &ol);
virtual void writeTagFile(FTextStream &);
virtual void setNestingLevel(int l);
- virtual void writePageDocumentation(OutputList &ol);
+ virtual void writePageDocumentation(OutputList &ol) const;
private:
QCString m_fileName;
QCString m_title;
- PageSDict *m_subPageDict; // list of pages in the group
+ PageLinkedRefMap m_subPages; // list of pages in the group
Definition *m_pageScope;
int m_nestingLevel;
LocalToc m_localToc;
@@ -85,7 +85,6 @@ PageDefImpl::PageDefImpl(const char *f,int l,const char *n,
: DefinitionMixin(f,l,1,n), m_title(t)
{
setDocumentation(d,f,l);
- m_subPageDict = new PageSDict(7);
m_pageScope = 0;
m_nestingLevel = 0;
m_fileName = ::convertNameToFile(n,FALSE,TRUE);
@@ -94,7 +93,6 @@ PageDefImpl::PageDefImpl(const char *f,int l,const char *n,
PageDefImpl::~PageDefImpl()
{
- delete m_subPageDict;
}
void PageDefImpl::findSectionsInDocumentation()
@@ -129,9 +127,9 @@ void PageDefImpl::addInnerCompound(const Definition *def)
PageDef *pd = const_cast<PageDef*>(toPageDef(def));
if (pd)
{
- m_subPageDict->append(pd->name(),pd);
+ m_subPages.add(pd->name(),pd);
pd->setOuterScope(this);
- if (this==Doxygen::mainPage)
+ if (this==Doxygen::mainPage.get())
{
pd->setNestingLevel(m_nestingLevel);
}
@@ -294,7 +292,7 @@ void PageDefImpl::writeDocumentation(OutputList &ol)
Doxygen::indexList->addIndexItem(this,0,0,filterTitle(title()));
}
-void PageDefImpl::writePageDocumentation(OutputList &ol)
+void PageDefImpl::writePageDocumentation(OutputList &ol) const
{
ol.startTextBlock();
QCString docStr = documentation()+inbodyDocumentation();
@@ -330,9 +328,7 @@ void PageDefImpl::writePageDocumentation(OutputList &ol)
ol.enable(OutputGenerator::Docbook);
ol.enable(OutputGenerator::RTF);
- PageSDict::Iterator pdi(*m_subPageDict);
- PageDef *subPage=pdi.toFirst();
- for (pdi.toFirst();(subPage=pdi.current());++pdi)
+ for (const auto &subPage : m_subPages)
{
SectionType sectionType = SectionType::Paragraph;
switch (m_nestingLevel)
@@ -377,7 +373,7 @@ bool PageDefImpl::documentedPage() const
bool PageDefImpl::hasSubPages() const
{
- return m_subPageDict->count()>0;
+ return !m_subPages.empty();
}
void PageDefImpl::setNestingLevel(int l)
diff --git a/src/pagedef.h b/src/pagedef.h
index 03cc5a8..d651fa6 100644
--- a/src/pagedef.h
+++ b/src/pagedef.h
@@ -19,7 +19,7 @@
#include "definition.h"
#include "sortdict.h"
-class PageSDict;
+class PageLinkedRefMap;
class OutputList;
class FTextStream;
@@ -43,7 +43,7 @@ class PageDef : public DefinitionMutable, public Definition
virtual void findSectionsInDocumentation() = 0;
virtual QCString title() const = 0;
virtual GroupDef * getGroupDef() const = 0;
- virtual PageSDict * getSubPages() const = 0;
+ virtual const PageLinkedRefMap &getSubPages() const = 0;
virtual void addInnerCompound(const Definition *) = 0;
virtual bool visibleInIndex() const = 0;
virtual bool documentedPage() const = 0;
@@ -59,7 +59,7 @@ class PageDef : public DefinitionMutable, public Definition
virtual void writeDocumentation(OutputList &) = 0;
virtual void writeTagFile(FTextStream &) = 0;
virtual void setNestingLevel(int) = 0;
- virtual void writePageDocumentation(OutputList &) = 0;
+ virtual void writePageDocumentation(OutputList &) const = 0;
};
@@ -72,16 +72,12 @@ const PageDef *toPageDef(const Definition *d);
// ------------------
-class PageSDict : public SDict<PageDef>
+class PageLinkedMap : public LinkedMap<PageDef>
+{
+};
+
+class PageLinkedRefMap : public LinkedRefMap<const PageDef>
{
- public:
- PageSDict(uint size) : SDict<PageDef>(size) {}
- virtual ~PageSDict() {}
- private:
- int compareValues(const PageDef *i1,const PageDef *i2) const
- {
- return qstricmp(i1->name(),i2->name());
- }
};
#endif
diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp
index e7a41c6..da9121f 100644
--- a/src/perlmodgen.cpp
+++ b/src/perlmodgen.cpp
@@ -2121,13 +2121,10 @@ void PerlModGenerator::generatePerlModForGroup(const GroupDef *gd)
m_output.closeList();
}
- PageSDict *pl = gd->getPages();
- if (pl)
+ if (!gd->getPages().empty())
{
m_output.openList("pages");
- PageSDict::Iterator pli(*pl);
- PageDef *pd;
- for (pli.toFirst();(pd=pli.current());++pli)
+ for (const auto &pd : gd->getPages())
m_output.openHash()
.addFieldQuotedString("title", pd->title())
.closeHash();
@@ -2222,15 +2219,13 @@ bool PerlModGenerator::generatePerlModOutput()
m_output.closeList();
m_output.openList("pages");
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
- generatePerlModForPage(pd);
+ generatePerlModForPage(pd.get());
}
if (Doxygen::mainPage)
{
- generatePerlModForPage(Doxygen::mainPage);
+ generatePerlModForPage(Doxygen::mainPage.get());
}
m_output.closeList();
diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp
index a8aa898..d1c2eaf 100644
--- a/src/rtfgen.cpp
+++ b/src/rtfgen.cpp
@@ -858,20 +858,16 @@ void RTFGenerator::endIndexSection(IndexSections is)
case isExampleDocumentation:
{
//t << "}\n";
+ bool isFirst=true;
t << "{\\tc \\v " << theTranslator->trExampleDocumentation() << "}"<< endl;
- PageSDict::Iterator pdi(*Doxygen::exampleSDict);
- PageDef *pd=pdi.toFirst();
- if (pd)
+ for (const auto &pd : *Doxygen::exampleLinkedMap)
{
t << "\\par " << rtf_Style_Reset << endl;
- t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
- t << pd->getOutputFileBase();
- t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
- }
- for (++pdi;(pd=pdi.current());++pdi)
- {
- t << "\\par " << rtf_Style_Reset << endl;
- beginRTFSection();
+ if (!isFirst)
+ {
+ beginRTFSection();
+ }
+ isFirst=false;
t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"";
t << pd->getOutputFileBase();
t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
@@ -883,10 +879,8 @@ void RTFGenerator::endIndexSection(IndexSections is)
//#error "fix me in the same way as the latex index..."
//t << "{\\tc \\v " << theTranslator->trPageDocumentation() << "}"<< endl;
//t << "}"<< endl;
- //PageSDict::Iterator pdi(*Doxygen::pageSDict);
- //PageDef *pd=pdi.toFirst();
//bool first=TRUE;
- //for (pdi.toFirst();(pd=pdi.current());++pdi)
+ //for (const auto *pd : Doxygen::pageLinkedMap)
//{
// if (!pd->getGroupDef() && !pd->isReference())
// {
diff --git a/src/searchindex.cpp b/src/searchindex.cpp
index 0b2b219..7cb3afa 100644
--- a/src/searchindex.cpp
+++ b/src/searchindex.cpp
@@ -855,9 +855,7 @@ void createJavaScriptSearchIndex()
}
// index pages
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
if (pd->isLinkable())
{
@@ -866,8 +864,8 @@ void createJavaScriptSearchIndex()
{
char letter[MAX_UTF8_CHAR_SIZE];
getUtf8Char(title,letter,CaseModifier::ToLower);
- g_searchIndexInfo[SEARCH_INDEX_ALL].add(letter,pd);
- g_searchIndexInfo[SEARCH_INDEX_PAGES].add(letter,pd);
+ g_searchIndexInfo[SEARCH_INDEX_ALL].add(letter,pd.get());
+ g_searchIndexInfo[SEARCH_INDEX_PAGES].add(letter,pd.get());
}
}
}
@@ -878,8 +876,8 @@ void createJavaScriptSearchIndex()
{
char letter[MAX_UTF8_CHAR_SIZE];
getUtf8Char(title,letter,CaseModifier::ToLower);
- g_searchIndexInfo[SEARCH_INDEX_ALL].add(letter,Doxygen::mainPage);
- g_searchIndexInfo[SEARCH_INDEX_PAGES].add(letter,Doxygen::mainPage);
+ g_searchIndexInfo[SEARCH_INDEX_ALL].add(letter,Doxygen::mainPage.get());
+ g_searchIndexInfo[SEARCH_INDEX_PAGES].add(letter,Doxygen::mainPage.get());
}
}
diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp
index 821f24a..a9b701a 100644
--- a/src/sqlite3gen.cpp
+++ b/src/sqlite3gen.cpp
@@ -1279,13 +1279,9 @@ static void writeInnerClasses(const ClassLinkedRefMap &cl, struct Refid outer_re
}
}
-static void writeInnerPages(const PageSDict *pl, struct Refid outer_refid)
+static void writeInnerPages(const PageLinkedRefMap &pl, struct Refid outer_refid)
{
- if (!pl) return;
-
- PageSDict::Iterator pli(*pl);
- const PageDef *pd;
- for (pli.toFirst();(pd=pli.current());++pli)
+ for (const auto &pd : pl)
{
struct Refid inner_refid = insertRefid(
pd->getGroupDef() ? pd->getOutputFileBase()+"_"+pd->name() : pd->getOutputFileBase()
@@ -1294,7 +1290,6 @@ static void writeInnerPages(const PageSDict *pl, struct Refid outer_refid)
bindIntParameter(contains_insert,":inner_rowid", inner_refid.rowid);
bindIntParameter(contains_insert,":outer_rowid", outer_refid.rowid);
step(contains_insert);
-
}
}
@@ -2393,7 +2388,7 @@ static void generateSqlite3ForPage(const PageDef *pd,bool isExample)
bindTextParameter(compounddef_insert,":name",pd->name());
QCString title;
- if (pd==Doxygen::mainPage) // main page is special
+ if (pd==Doxygen::mainPage.get()) // main page is special
{
if (mainPageHasTitle())
{
@@ -2554,12 +2549,10 @@ void generateSqlite3()
// + page
{
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- const PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
msg("Generating Sqlite3 output for page %s\n",pd->name().data());
- generateSqlite3ForPage(pd,FALSE);
+ generateSqlite3ForPage(pd.get(),FALSE);
}
}
@@ -2576,12 +2569,10 @@ void generateSqlite3()
// + examples
{
- PageSDict::Iterator pdi(*Doxygen::exampleSDict);
- const PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::exampleLinkedMap)
{
msg("Generating Sqlite3 output for example %s\n",pd->name().data());
- generateSqlite3ForPage(pd,TRUE);
+ generateSqlite3ForPage(pd.get(),TRUE);
}
}
@@ -2589,7 +2580,7 @@ void generateSqlite3()
if (Doxygen::mainPage)
{
msg("Generating Sqlite3 output for the main page\n");
- generateSqlite3ForPage(Doxygen::mainPage,FALSE);
+ generateSqlite3ForPage(Doxygen::mainPage.get(),FALSE);
}
// TODO: copied from initializeSchema; not certain if we should say/do more
diff --git a/src/util.cpp b/src/util.cpp
index ec5d21f..0f195c2 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -3188,7 +3188,7 @@ bool resolveLink(/* in */ const char *scName,
{
return FALSE;
}
- else if ((pd=Doxygen::pageSDict->find(linkRef))) // link to a page
+ else if ((pd=Doxygen::pageLinkedMap->find(linkRef))) // link to a page
{
gd = pd->getGroupDef();
if (gd)
@@ -3209,7 +3209,7 @@ bool resolveLink(/* in */ const char *scName,
resAnchor = si->label();
return TRUE;
}
- else if ((pd=Doxygen::exampleSDict->find(linkRef))) // link to an example
+ else if ((pd=Doxygen::exampleLinkedMap->find(linkRef))) // link to an example
{
*resContext=pd;
return TRUE;
@@ -4926,7 +4926,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle,
PageDef *pd=0;
//printf("addRelatedPage(name=%s gd=%p)\n",name,gd);
QCString title=ptitle.stripWhiteSpace();
- if ((pd=Doxygen::pageSDict->find(name)) && !tagInfo)
+ if ((pd=Doxygen::pageLinkedMap->find(name)) && !tagInfo)
{
if (!xref && !title.isEmpty() && pd->title()!=title)
{
@@ -4947,7 +4947,10 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle,
else if (baseName.right(Doxygen::htmlFileExtension.length())==Doxygen::htmlFileExtension)
baseName=baseName.left(baseName.length()-Doxygen::htmlFileExtension.length());
- pd=createPageDef(fileName,docLine,baseName,doc,title);
+ //printf("Appending page '%s'\n",baseName.data());
+ pd = Doxygen::pageLinkedMap->add(baseName,
+ std::unique_ptr<PageDef>(
+ createPageDef(fileName,docLine,baseName,doc,title)));
pd->setBodySegment(startLine,startLine,-1);
pd->setRefItems(sli);
@@ -4959,8 +4962,6 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle,
pd->setFileName(tagInfo->fileName);
}
- //printf("Appending page '%s'\n",baseName.data());
- Doxygen::pageSDict->append(baseName,pd);
if (gd) gd->addPage(pd);
diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp
index 7eb09f1..c005e03 100644
--- a/src/xmlgen.cpp
+++ b/src/xmlgen.cpp
@@ -1180,21 +1180,16 @@ static void writeInnerFiles(const FileList *fl,FTextStream &t)
}
}
-static void writeInnerPages(const PageSDict *pl,FTextStream &t)
+static void writeInnerPages(const PageLinkedRefMap &pl,FTextStream &t)
{
- if (pl)
+ for (const auto &pd : pl)
{
- PageSDict::Iterator pli(*pl);
- PageDef *pd;
- for (pli.toFirst();(pd=pli.current());++pli)
+ t << " <innerpage refid=\"" << pd->getOutputFileBase();
+ if (pd->getGroupDef())
{
- t << " <innerpage refid=\"" << pd->getOutputFileBase();
- if (pd->getGroupDef())
- {
- t << "_" << pd->name();
- }
- t << "\">" << convertToXML(pd->title()) << "</innerpage>" << endl;
+ t << "_" << pd->name();
}
+ t << "\">" << convertToXML(pd->title()) << "</innerpage>" << endl;
}
}
@@ -1770,7 +1765,7 @@ static void generateXMLForPage(PageDef *pd,FTextStream &ti,bool isExample)
t << " <compoundname>" << convertToXML(pd->name())
<< "</compoundname>" << endl;
- if (pd==Doxygen::mainPage) // main page is special
+ if (pd==Doxygen::mainPage.get()) // main page is special
{
QCString title;
if (mainPageHasTitle())
@@ -1963,12 +1958,10 @@ void generateXML()
generateXMLForGroup(gd,t);
}
{
- PageSDict::Iterator pdi(*Doxygen::pageSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::pageLinkedMap)
{
msg("Generating XML output for page %s\n",pd->name().data());
- generateXMLForPage(pd,t,FALSE);
+ generateXMLForPage(pd.get(),t,FALSE);
}
}
{
@@ -1981,18 +1974,16 @@ void generateXML()
}
}
{
- PageSDict::Iterator pdi(*Doxygen::exampleSDict);
- PageDef *pd=0;
- for (pdi.toFirst();(pd=pdi.current());++pdi)
+ for (const auto &pd : *Doxygen::exampleLinkedMap)
{
msg("Generating XML output for example %s\n",pd->name().data());
- generateXMLForPage(pd,t,TRUE);
+ generateXMLForPage(pd.get(),t,TRUE);
}
}
if (Doxygen::mainPage)
{
msg("Generating XML output for the main page\n");
- generateXMLForPage(Doxygen::mainPage,t,FALSE);
+ generateXMLForPage(Doxygen::mainPage.get(),t,FALSE);
}
//t << " </compoundlist>" << endl;