summaryrefslogtreecommitdiffstats
path: root/src/pagedef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pagedef.cpp')
-rw-r--r--src/pagedef.cpp170
1 files changed, 98 insertions, 72 deletions
diff --git a/src/pagedef.cpp b/src/pagedef.cpp
index 8b6228f..d3cf823 100644
--- a/src/pagedef.cpp
+++ b/src/pagedef.cpp
@@ -3,8 +3,8 @@
* Copyright (C) 1997-2015 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -29,7 +29,7 @@
//------------------------------------------------------------------------------------------
-class PageDefImpl : public DefinitionImpl, public PageDef
+class PageDefImpl : public DefinitionMixin<PageDef>
{
public:
PageDefImpl(const char *f,int l,const char *n,const char *d,const char *t);
@@ -45,9 +45,9 @@ class PageDefImpl : public DefinitionImpl, public PageDef
virtual QCString anchor() const { return QCString(); }
virtual void findSectionsInDocumentation();
virtual QCString title() const { return m_title; }
- virtual GroupDef * getGroupDef() const;
- virtual PageSDict * getSubPages() const { return m_subPageDict; }
- virtual void addInnerCompound(Definition *d);
+ virtual const GroupDef * getGroupDef() const;
+ virtual const PageLinkedRefMap &getSubPages() const { return m_subPages; }
+ virtual void addInnerCompound(const Definition *d);
virtual bool visibleInIndex() const;
virtual bool documentedPage() const;
virtual bool hasSubPages() const;
@@ -56,17 +56,17 @@ class PageDefImpl : public DefinitionImpl, public PageDef
virtual LocalToc localToc() const { return m_localToc; }
virtual void setPageScope(Definition *d){ m_pageScope = d; }
virtual Definition *getPageScope() const { return m_pageScope; }
- virtual QCString displayName(bool=TRUE) const { return hasTitle() ? m_title : DefinitionImpl::name(); }
+ virtual QCString displayName(bool=TRUE) const { return hasTitle() ? m_title : DefinitionMixin::name(); }
virtual bool showLineNo() const;
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;
@@ -82,10 +82,9 @@ PageDef *createPageDef(const char *f,int l,const char *n,const char *d,const cha
PageDefImpl::PageDefImpl(const char *f,int l,const char *n,
const char *d,const char *t)
- : DefinitionImpl(f,l,1,n), m_title(t)
+ : 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,26 +93,25 @@ PageDefImpl::PageDefImpl(const char *f,int l,const char *n,
PageDefImpl::~PageDefImpl()
{
- delete m_subPageDict;
}
void PageDefImpl::findSectionsInDocumentation()
{
+ docFindSections(briefDescription(),this,docFile());
docFindSections(documentation(),this,docFile());
}
-GroupDef *PageDefImpl::getGroupDef() const
-{
- GroupList *groups = partOfGroups();
- return groups!=0 ? groups->getFirst() : 0;
+const GroupDef *PageDefImpl::getGroupDef() const
+{
+ return !partOfGroups().empty() ? partOfGroups().front() : 0;
}
-QCString PageDefImpl::getOutputFileBase() const
-{
- if (getGroupDef())
+QCString PageDefImpl::getOutputFileBase() const
+{
+ if (getGroupDef())
return getGroupDef()->getOutputFileBase();
- else
- return m_fileName;
+ else
+ return m_fileName;
}
void PageDefImpl::setFileName(const char *name)
@@ -121,36 +119,37 @@ void PageDefImpl::setFileName(const char *name)
m_fileName = name;
}
-void PageDefImpl::addInnerCompound(Definition *def)
+void PageDefImpl::addInnerCompound(const Definition *def)
{
if (def->definitionType()==Definition::TypePage)
{
- PageDef *pd = dynamic_cast<PageDef*>(def);
- m_subPageDict->append(pd->name(),pd);
- def->setOuterScope(this);
- if (this==Doxygen::mainPage)
- {
- pd->setNestingLevel(m_nestingLevel);
- }
- else
+ PageDef *pd = const_cast<PageDef*>(toPageDef(def));
+ if (pd)
{
- pd->setNestingLevel(m_nestingLevel+1);
+ m_subPages.add(pd->name(),pd);
+ pd->setOuterScope(this);
+ if (this==Doxygen::mainPage.get())
+ {
+ pd->setNestingLevel(m_nestingLevel);
+ }
+ else
+ {
+ pd->setNestingLevel(m_nestingLevel+1);
+ }
}
}
}
bool PageDefImpl::hasParentPage() const
{
- return getOuterScope() &&
+ return getOuterScope() &&
getOuterScope()->definitionType()==Definition::TypePage;
}
void PageDefImpl::writeTagFile(FTextStream &tagFile)
{
bool found = name()=="citelist";
- QDictIterator<RefList> rli(*Doxygen::xrefLists);
- RefList *rl;
- for (rli.toFirst();(rl=rli.current()) && !found;++rli)
+ for (RefListManager::Ptr &rl : RefListManager::instance())
{
if (rl->listName()==name())
{
@@ -163,7 +162,7 @@ void PageDefImpl::writeTagFile(FTextStream &tagFile)
tagFile << " <compound kind=\"page\">" << endl;
tagFile << " <name>" << name() << "</name>" << endl;
tagFile << " <title>" << convertToXML(title()) << "</title>" << endl;
- tagFile << " <filename>" << convertToXML(getOutputFileBase()) << "</filename>" << endl;
+ tagFile << " <filename>" << convertToXML(getOutputFileBase())<< Doxygen::htmlFileExtension << "</filename>" << endl;
writeDocAnchorsToTagFile(tagFile);
tagFile << " </compound>" << endl;
}
@@ -181,9 +180,9 @@ void PageDefImpl::writeDocumentation(OutputList &ol)
//printf("PageDefImpl::writeDocumentation: %s\n",getOutputFileBase().data());
ol.pushGeneratorState();
- //1.{
+ //1.{
- if (m_nestingLevel>0
+ if (m_nestingLevel>0
//&& // a sub page
//(Doxygen::mainPage==0 || getOuterScope()!=Doxygen::mainPage) // and not a subpage of the mainpage
)
@@ -196,24 +195,28 @@ void PageDefImpl::writeDocumentation(OutputList &ol)
}
ol.pushGeneratorState();
- //2.{
+ //2.{
ol.disableAllBut(OutputGenerator::Man);
startFile(ol,getOutputFileBase(),manPageName,title(),HLI_Pages,!generateTreeView);
ol.enableAll();
ol.disable(OutputGenerator::Man);
startFile(ol,getOutputFileBase(),pageName,title(),HLI_Pages,!generateTreeView);
ol.popGeneratorState();
- //2.}
+ //2.}
if (!generateTreeView)
{
if (getOuterScope()!=Doxygen::globalScope && !Config_getBool(DISABLE_INDEX))
{
- getOuterScope()->writeNavigationPath(ol);
+ DefinitionMutable *outerScope = toDefinitionMutable(getOuterScope());
+ if (outerScope)
+ {
+ outerScope->writeNavigationPath(ol);
+ }
}
ol.endQuickIndices();
}
- SectionInfo *si=Doxygen::sectionDict->find(name());
+ const SectionInfo *si=SectionManager::instance().find(name());
// save old generator state and write title only to Man generator
ol.pushGeneratorState();
@@ -228,10 +231,11 @@ void PageDefImpl::writeDocumentation(OutputList &ol)
ol.writeString(" - ");
ol.popGeneratorState();
- if (si->title != manPageName)
+ if (si->title() != manPageName)
{
- ol.generateDoc(docFile(),docLine(),this,0,si->title,TRUE,FALSE,0,TRUE,FALSE);
- ol.endSection(si->label,si->type);
+ ol.generateDoc(docFile(),getStartBodyLine(),this,0,si->title(),TRUE,FALSE,
+ 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
+ ol.endSection(si->label(),si->type());
}
}
ol.popGeneratorState();
@@ -246,10 +250,11 @@ void PageDefImpl::writeDocumentation(OutputList &ol)
ol.disable(OutputGenerator::Man);
if (hasTitle() && !name().isEmpty() && si!=0)
{
- ol.startPageDoc(si->title);
+ ol.startPageDoc(si->title());
//ol.startSection(si->label,si->title,si->type);
startTitle(ol,getOutputFileBase(),this);
- ol.generateDoc(docFile(),docLine(),this,0,si->title,TRUE,FALSE,0,TRUE,FALSE);
+ ol.generateDoc(docFile(),getStartBodyLine(),this,0,si->title(),TRUE,FALSE,
+ 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
//stringToSearchIndex(getOutputFileBase(),
// theTranslator->trPage(TRUE,TRUE)+" "+si->title,
// si->title);
@@ -286,18 +291,11 @@ void PageDefImpl::writeDocumentation(OutputList &ol)
Doxygen::indexList->addIndexItem(this,0,0,filterTitle(title()));
}
-void PageDefImpl::writePageDocumentation(OutputList &ol)
+void PageDefImpl::writePageDocumentation(OutputList &ol) const
{
-
- bool markdownEnabled = Doxygen::markdownSupport;
- if (getLanguage()==SrcLangExt_Markdown)
- {
- Doxygen::markdownSupport = TRUE;
- }
-
ol.startTextBlock();
QCString docStr = documentation()+inbodyDocumentation();
- if (hasBriefDescription() && !Doxygen::sectionDict->find(name()))
+ if (hasBriefDescription() && !SectionManager::instance().find(name()))
{
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Man);
@@ -311,12 +309,14 @@ void PageDefImpl::writePageDocumentation(OutputList &ol)
0, // memberdef
docStr, // docStr
TRUE, // index words
- FALSE // not an example
+ FALSE, // not an example
+ 0, // exampleName
+ FALSE, // singleLine
+ FALSE, // linkFromIndex
+ TRUE // markdown support
);
ol.endTextBlock();
- Doxygen::markdownSupport = markdownEnabled;
-
if (hasSubPages())
{
// for printed documentation we write subpages as section's of the
@@ -327,18 +327,16 @@ 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)
{
- SectionInfo::SectionType sectionType = SectionInfo::Paragraph;
+ SectionType sectionType = SectionType::Paragraph;
switch (m_nestingLevel)
{
- case 0: sectionType = SectionInfo::Page; break;
- case 1: sectionType = SectionInfo::Section; break;
- case 2: sectionType = SectionInfo::Subsection; break;
- case 3: sectionType = SectionInfo::Subsubsection; break;
- default: sectionType = SectionInfo::Paragraph; break;
+ case 0: sectionType = SectionType::Page; break;
+ case 1: sectionType = SectionType::Section; break;
+ case 2: sectionType = SectionType::Subsection; break;
+ case 3: sectionType = SectionType::Subsubsection; break;
+ default: sectionType = SectionType::Paragraph; break;
}
QCString title = subPage->title();
if (title.isEmpty()) title = subPage->name();
@@ -358,23 +356,23 @@ bool PageDefImpl::visibleInIndex() const
{
static bool externalPages = Config_getBool(EXTERNAL_PAGES);
return // not part of a group
- !getGroupDef() &&
+ !getGroupDef() &&
// not an externally defined page
- (!isReference() || externalPages)
+ (!isReference() || externalPages)
;
}
bool PageDefImpl::documentedPage() const
{
return // not part of a group
- !getGroupDef() &&
+ !getGroupDef() &&
// not an externally defined page
!isReference();
}
bool PageDefImpl::hasSubPages() const
{
- return m_subPageDict->count()>0;
+ return !m_subPages.empty();
}
void PageDefImpl::setNestingLevel(int l)
@@ -402,3 +400,31 @@ bool PageDefImpl::hasTitle() const
return !m_title.isEmpty() && m_title.lower()!="notitle";
}
+// --- Cast functions
+
+PageDef *toPageDef(Definition *d)
+{
+ if (d==0) return 0;
+ if (d && typeid(*d)==typeid(PageDefImpl))
+ {
+ return static_cast<PageDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+const PageDef *toPageDef(const Definition *d)
+{
+ if (d==0) return 0;
+ if (d && typeid(*d)==typeid(PageDefImpl))
+ {
+ return static_cast<const PageDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+