summaryrefslogtreecommitdiffstats
path: root/src/docbookgen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/docbookgen.cpp')
-rw-r--r--src/docbookgen.cpp231
1 files changed, 87 insertions, 144 deletions
diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp
index fff9728..05e9347 100644
--- a/src/docbookgen.cpp
+++ b/src/docbookgen.cpp
@@ -89,7 +89,7 @@ inline void writeDocbookCodeString(FTextStream &t,const char *s, int &col)
{
case '\t':
{
- static int tabSize = Config_getInt(TAB_SIZE);
+ int tabSize = Config_getInt(TAB_SIZE);
int spacesToNextTabStop = tabSize - (col%tabSize);
col+=spacesToNextTabStop;
while (spacesToNextTabStop--) t << "&#32;";
@@ -101,9 +101,21 @@ inline void writeDocbookCodeString(FTextStream &t,const char *s, int &col)
case '&': t << "&amp;"; col++; break;
case '\'': t << "&apos;"; col++; break;
case '"': t << "&quot;"; col++; break;
- case '\007': t << "^G"; col++; break; // bell
- case '\014': t << "^L"; col++; break; // form feed
- default: t << c; col++; break;
+ default:
+ {
+ uchar uc = static_cast<uchar>(c);
+ static const char *hex="0123456789ABCDEF";
+ if (uc<32)
+ {
+ t << "&#x24" << hex[uc>>4] << hex[uc&0xF] << ";";
+ }
+ else
+ {
+ t << c;
+ }
+ col++;
+ }
+ break;
}
}
}
@@ -132,17 +144,14 @@ void writeDocbookLink(FTextStream &t,const char * /*extRef*/,const char *compoun
t << "</link>";
}
-DocbookCodeGenerator::DocbookCodeGenerator(FTextStream &t) : m_lineNumber(-1), m_col(0),
- m_insideCodeLine(FALSE), m_insideSpecialHL(FALSE)
+DocbookCodeGenerator::DocbookCodeGenerator(FTextStream &t)
{
m_prettyCode=Config_getBool(DOCBOOK_PROGRAMLISTING);
setTextStream(t);
}
-DocbookCodeGenerator::DocbookCodeGenerator() : m_lineNumber(-1), m_col(0),
- m_insideCodeLine(FALSE), m_insideSpecialHL(FALSE), m_streamSet(FALSE)
+DocbookCodeGenerator::DocbookCodeGenerator()
{
- m_prettyCode=Config_getBool(DOCBOOK_PROGRAMLISTING);
}
DocbookCodeGenerator::~DocbookCodeGenerator() {}
@@ -160,9 +169,9 @@ void DocbookCodeGenerator::writeCodeLink(const char *ref,const char *file,
writeDocbookLink(m_t,ref,file,anchor,name,tooltip);
m_col+=(int)strlen(name);
}
-void DocbookCodeGenerator::writeCodeLinkLine(const char *ref,const char *file,
- const char *anchor,const char *name,
- const char *tooltip)
+void DocbookCodeGenerator::writeCodeLinkLine(const char *,const char *file,
+ const char *,const char *name,
+ const char *)
{
Docbook_DB(("(writeCodeLinkLine)\n"));
m_t << "<anchor xml:id=\"_" << stripExtensionGeneral(stripPath(file),".xml");
@@ -245,37 +254,41 @@ void DocbookCodeGenerator::finish()
{
endCodeLine();
}
-void DocbookCodeGenerator::startCodeFragment()
+void DocbookCodeGenerator::startCodeFragment(const char *)
{
- m_t << "<literallayout><computeroutput>" << endl;
+DB_GEN_C
+ m_t << "<programlisting>";
}
-void DocbookCodeGenerator::endCodeFragment()
+
+void DocbookCodeGenerator::endCodeFragment(const char *)
{
+DB_GEN_C
//endCodeLine checks is there is still an open code line, if so closes it.
endCodeLine();
- m_t << "</computeroutput></literallayout>" << endl;
+ m_t << "</programlisting>";
}
-DocbookGenerator::DocbookGenerator() : OutputGenerator()
+//-------------------------------------------------------------------------------
+
+DocbookGenerator::DocbookGenerator() : OutputGenerator(Config_getString(DOCBOOK_OUTPUT))
{
DB_GEN_C
- m_dir=Config_getString(DOCBOOK_OUTPUT);
- //insideTabbing=FALSE;
- //firstDescItem=TRUE;
- //disableLinks=FALSE;
- //m_indent=0;
- //templateMemberItem = FALSE;
- m_prettyCode=Config_getBool(DOCBOOK_PROGRAMLISTING);
- m_denseText = FALSE;
- m_inGroup = FALSE;
- m_inDetail = FALSE;
- m_levelListItem = 0;
- m_descTable = FALSE;
- m_inLevel = -1;
- m_firstMember = FALSE;
- for (int i = 0 ; i < sizeof(m_inListItem) / sizeof(*m_inListItem) ; i++) m_inListItem[i] = FALSE;
- for (int i = 0 ; i < sizeof(m_inSimpleSect) / sizeof(*m_inSimpleSect) ; i++) m_inSimpleSect[i] = FALSE;
+}
+
+DocbookGenerator::DocbookGenerator(const DocbookGenerator &og) : OutputGenerator(og)
+{
+}
+
+DocbookGenerator &DocbookGenerator::operator=(const DocbookGenerator &og)
+{
+ OutputGenerator::operator=(og);
+ return *this;
+}
+
+std::unique_ptr<OutputGenerator> DocbookGenerator::clone() const
+{
+ return std::make_unique<DocbookGenerator>(*this);
}
DocbookGenerator::~DocbookGenerator()
@@ -295,7 +308,7 @@ void DocbookGenerator::init()
createSubDirs(d);
}
-void DocbookGenerator::startFile(const char *name,const char *,const char *)
+void DocbookGenerator::startFile(const char *name,const char *,const char *,int)
{
DB_GEN_C
QCString fileName=name;
@@ -322,6 +335,7 @@ DB_GEN_C
t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>" << endl;;
t << "<" << fileType << " xmlns=\"http://docbook.org/ns/docbook\" version=\"5.0\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"";
if (!pageName.isEmpty()) t << " xml:id=\"_" << stripPath(pageName) << "\"";
+ t << " xml:lang=\"" << theTranslator->trISOLang() << "\"";
t << ">" << endl;
}
@@ -429,7 +443,7 @@ DB_GEN_C2("IndexSections " << is)
void DocbookGenerator::endIndexSection(IndexSections is)
{
DB_GEN_C2("IndexSections " << is)
- static bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
+ bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
switch (is)
{
case isTitlePageStart:
@@ -470,18 +484,7 @@ DB_GEN_C2("IndexSections " << is)
case isModuleDocumentation:
{
t << "</title>" << endl;
- GroupSDict::Iterator gli(*Doxygen::groupSDict);
- GroupDef *gd;
- bool found=FALSE;
- for (gli.toFirst();(gd=gli.current()) && !found;++gli)
- {
- if (!gd->isReference())
- {
- t << " <xi:include href=\"" << gd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl;
- found=TRUE;
- }
- }
- for (;(gd=gli.current());++gli)
+ for (const auto &gd : *Doxygen::groupLinkedMap)
{
if (!gd->isReference())
{
@@ -494,22 +497,11 @@ DB_GEN_C2("IndexSections " << is)
case isDirDocumentation:
{
t << "</title>" << endl;
- SDict<DirDef>::Iterator dli(*Doxygen::directories);
- DirDef *dd;
- bool found=FALSE;
- for (dli.toFirst();(dd=dli.current()) && !found;++dli)
+ for (const auto &dd : *Doxygen::dirLinkedMap)
{
if (dd->isLinkableInProject())
{
t << "< xi:include href=\"" << dd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl;
- found=TRUE;
- }
- }
- for (;(dd=dli.current());++dli)
- {
- if (dd->isLinkableInProject())
- {
- t << " <xi:include href=\"" << dd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl;
}
}
}
@@ -518,24 +510,12 @@ DB_GEN_C2("IndexSections " << is)
case isNamespaceDocumentation:
{
t << "</title>" << endl;
- NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
- NamespaceDef *nd;
- bool found=FALSE;
- for (nli.toFirst();(nd=nli.current()) && !found;++nli)
- {
- if (nd->isLinkableInProject())
- {
- t << "<xi:include href=\"" << nd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl;
- found=TRUE;
- }
- }
- while ((nd=nli.current()))
+ for (const auto &nd : *Doxygen::namespaceLinkedMap)
{
- if (nd->isLinkableInProject())
+ if (nd->isLinkableInProject() && !nd->isAlias())
{
t << "<xi:include href=\"" << nd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl;
}
- ++nli;
}
}
t << "</chapter>\n";
@@ -543,25 +523,12 @@ DB_GEN_C2("IndexSections " << is)
case isClassDocumentation:
{
t << "</title>" << endl;
- ClassSDict::Iterator cli(*Doxygen::classSDict);
- const ClassDef *cd=0;
- bool found=FALSE;
- for (cli.toFirst();(cd=cli.current()) && !found;++cli)
- {
- if (cd->isLinkableInProject() &&
- cd->templateMaster()==0 &&
- !cd->isEmbeddedInOuterScope()
- )
- {
- t << " <xi:include href=\"" << cd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl;
- found=TRUE;
- }
- }
- for (;(cd=cli.current());++cli)
+ for (const auto &cd : *Doxygen::classLinkedMap)
{
if (cd->isLinkableInProject() &&
cd->templateMaster()==0 &&
- !cd->isEmbeddedInOuterScope()
+ !cd->isEmbeddedInOuterScope() &&
+ !cd->isAlias()
)
{
t << " <xi:include href=\"" << cd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl;
@@ -574,13 +541,9 @@ DB_GEN_C2("IndexSections " << is)
{
t << "</title>" << endl;
bool isFirst=TRUE;
- FileNameListIterator fnli(*Doxygen::inputNameList);
- FileName *fn;
- for (fnli.toFirst();(fn=fnli.current());++fnli)
+ for (const auto &fn : *Doxygen::inputNameLinkedMap)
{
- FileNameIterator fni(*fn);
- const FileDef *fd;
- for (;(fd=fni.current());++fni)
+ for (const auto &fd : *fn)
{
if (fd->isLinkableInProject())
{
@@ -610,13 +573,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;
}
@@ -635,9 +592,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))
{
@@ -655,7 +610,8 @@ DB_GEN_C
}
}
}
-void DocbookGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *)
+
+void DocbookGenerator::writeDoc(DocNode *n,const Definition *,const MemberDef *,int)
{
DB_GEN_C
DocbookDocVisitor *visitor =
@@ -680,7 +636,7 @@ void DocbookGenerator::writeString(const char *text)
DB_GEN_C
t << text;
}
-void DocbookGenerator::startMemberHeader(const char *name,int)
+void DocbookGenerator::startMemberHeader(const char *,int)
{
DB_GEN_C
t << "<simplesect>" << endl;
@@ -698,7 +654,7 @@ void DocbookGenerator::docify(const char *str)
DB_GEN_C
t << convertToDocBook(str);
}
-void DocbookGenerator::writeObjectLink(const char *ref, const char *f,
+void DocbookGenerator::writeObjectLink(const char *, const char *f,
const char *anchor, const char *text)
{
DB_GEN_C
@@ -738,12 +694,12 @@ void DocbookGenerator::endMemberItem()
DB_GEN_C
t << "</para>" << endl;
}
-void DocbookGenerator::startBold(void)
+void DocbookGenerator::startBold()
{
DB_GEN_C
t << "<emphasis role=\"strong\">";
}
-void DocbookGenerator::endBold(void)
+void DocbookGenerator::endBold()
{
DB_GEN_C
t << "</emphasis>";
@@ -761,7 +717,7 @@ DB_GEN_C2("extraIndentLevel " << extraIndentLevel)
t << "<section>" << endl;
t << "<title>";
}
-void DocbookGenerator::writeRuler(void)
+void DocbookGenerator::writeRuler()
{
DB_GEN_C2("m_inLevel " << m_inLevel)
DB_GEN_C2("m_inGroup " << m_inGroup)
@@ -813,7 +769,7 @@ DB_GEN_C
t << "<programlisting>";
}
}
-void DocbookGenerator::endTextBlock(bool dense)
+void DocbookGenerator::endTextBlock(bool)
{
DB_GEN_C
if (m_denseText)
@@ -822,8 +778,8 @@ DB_GEN_C
t << "</programlisting>";
}
}
-void DocbookGenerator::startMemberDoc(const char *clname, const char *memname, const char *anchor, const char *title,
- int memCount, int memTotal, bool showInline)
+void DocbookGenerator::startMemberDoc(const char *clname, const char *memname, const char *, const char *title,
+ int memCount, int memTotal, bool)
{
DB_GEN_C2("m_inLevel " << m_inLevel)
t << " <section>" << endl;
@@ -849,15 +805,15 @@ void DocbookGenerator::startTitleHead(const char *)
DB_GEN_C
t << "<title>";
}
-void DocbookGenerator::endTitleHead(const char *fileName,const char *name)
+void DocbookGenerator::endTitleHead(const char *,const char *name)
{
DB_GEN_C
t << "</title>" << endl;
if (name) addIndexTerm(t, name);
}
-void DocbookGenerator::startDoxyAnchor(const char *fName,const char *manName,
- const char *anchor,const char *name,
- const char *args)
+void DocbookGenerator::startDoxyAnchor(const char *fName,const char *,
+ const char *anchor,const char *,
+ const char *)
{
DB_GEN_C
if (!m_inListItem[m_levelListItem] && !m_descTable)
@@ -870,7 +826,7 @@ DB_GEN_C
t << "<anchor xml:id=\"_" << stripPath(fName) << "_1" << anchor << "\"/>";
}
}
-void DocbookGenerator::endDoxyAnchor(const char *fileName,const char *anchor)
+void DocbookGenerator::endDoxyAnchor(const char *,const char *)
{
DB_GEN_C
}
@@ -883,7 +839,7 @@ void DocbookGenerator::endMemberDocName()
{
DB_GEN_C
}
-void DocbookGenerator::startMemberGroupHeader(bool hasHeader)
+void DocbookGenerator::startMemberGroupHeader(bool)
{
DB_GEN_C
t << "<simplesect><title>";
@@ -914,10 +870,10 @@ DB_GEN_C
t << " <informalfigure>" << endl;
t << " <mediaobject>" << endl;
t << " <imageobject>" << endl;
- t << " <imagedata width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\""
+ t << " <imagedata width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\""
<< relPath << fileName << ".png\">" << "</imagedata>" << endl;
t << " </imageobject>" << endl;
- d.writeImage(t,m_dir,relPath,fileName,FALSE);
+ d.writeImage(t,dir(),relPath,fileName,FALSE);
t << " </mediaobject>" << endl;
t << " </informalfigure>" << endl;
t << "</para>" << endl;
@@ -951,12 +907,12 @@ void DocbookGenerator::endExamples()
DB_GEN_C
t << "</simplesect>" << endl;
}
-void DocbookGenerator::startSubsubsection(void)
+void DocbookGenerator::startSubsubsection()
{
DB_GEN_C
t << "<simplesect><title>";
}
-void DocbookGenerator::endSubsubsection(void)
+void DocbookGenerator::endSubsubsection()
{
DB_GEN_C
t << "</title></simplesect>" << endl;
@@ -1001,19 +957,6 @@ DB_GEN_C
if (closeBracket) t << ")";
}
}
-void DocbookGenerator::startCodeFragment()
-{
-DB_GEN_C
- t << "<programlisting>";
-}
-void DocbookGenerator::endCodeFragment()
-{
-DB_GEN_C
- //endCodeLine checks is there is still an open code line, if so closes it.
- endCodeLine();
-
- t << "</programlisting>";
-}
void DocbookGenerator::startMemberTemplateParams()
{
DB_GEN_C
@@ -1025,13 +968,13 @@ DB_GEN_C
t << "</para>";
t << "<para>";
}
-void DocbookGenerator::startSection(const char *lab,const char *,SectionInfo::SectionType type)
+void DocbookGenerator::startSection(const char *lab,const char *,SectionType)
{
DB_GEN_C
t << " <section xml:id=\"_" << stripPath(lab) << "\">";
t << "<title>";
}
-void DocbookGenerator::endSection(const char *lab,SectionInfo::SectionType)
+void DocbookGenerator::endSection(const char *,SectionType)
{
DB_GEN_C
t << "</title>";
@@ -1108,7 +1051,7 @@ DB_GEN_C
void DocbookGenerator::endGroupCollaboration(DotGroupCollaboration &g)
{
DB_GEN_C
- g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),m_fileName,relPath,FALSE);
+ g.writeGraph(t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,FALSE);
}
void DocbookGenerator::startDotGraph()
{
@@ -1117,7 +1060,7 @@ DB_GEN_C
void DocbookGenerator::endDotGraph(DotClassGraph &g)
{
DB_GEN_C
- g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),m_fileName,relPath,TRUE,FALSE);
+ g.writeGraph(t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,TRUE,FALSE);
}
void DocbookGenerator::startInclDepGraph()
{
@@ -1126,7 +1069,7 @@ DB_GEN_C
void DocbookGenerator::endInclDepGraph(DotInclDepGraph &g)
{
DB_GEN_C
- QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT), m_fileName,relPath,FALSE);
+ QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,FALSE);
}
void DocbookGenerator::startCallGraph()
{
@@ -1135,7 +1078,7 @@ DB_GEN_C
void DocbookGenerator::endCallGraph(DotCallGraph &g)
{
DB_GEN_C
- QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT), m_fileName,relPath,FALSE);
+ QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,FALSE);
}
void DocbookGenerator::startDirDepGraph()
{
@@ -1144,7 +1087,7 @@ DB_GEN_C
void DocbookGenerator::endDirDepGraph(DotDirDeps &g)
{
DB_GEN_C
- QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT), m_fileName,relPath,FALSE);
+ QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,FALSE);
}
void DocbookGenerator::startMemberDocList()
{