Doxygen
Loading...
Searching...
No Matches
docbookgen.cpp File Reference
#include <stdlib.h>
#include "docbookgen.h"
#include "doxygen.h"
#include "message.h"
#include "config.h"
#include "classlist.h"
#include "classdef.h"
#include "diagram.h"
#include "util.h"
#include "defargs.h"
#include "outputgen.h"
#include "dot.h"
#include "dotcallgraph.h"
#include "dotclassgraph.h"
#include "dotdirdeps.h"
#include "dotgroupcollaboration.h"
#include "dotincldepgraph.h"
#include "pagedef.h"
#include "filename.h"
#include "version.h"
#include "docbookvisitor.h"
#include "docparser.h"
#include "language.h"
#include "parserintf.h"
#include "arguments.h"
#include "memberlist.h"
#include "groupdef.h"
#include "memberdef.h"
#include "namespacedef.h"
#include "membername.h"
#include "membergroup.h"
#include "dirdef.h"
#include "section.h"
#include "dir.h"
#include "growbuf.h"
#include "outputlist.h"
#include "moduledef.h"
+ Include dependency graph for docbookgen.cpp:

Go to the source code of this file.

Macros

#define Docbook_DB(x)
 
#define DB_GEN_C
 
#define DB_GEN_C1(x)
 
#define DB_GEN_C2(y)
 
#define DB_GEN_C2a(x, y)
 

Functions

void writeDocbookString (TextStream &t, const QCString &s)
 
void writeDocbookCodeString (bool hide, TextStream &t, const QCString &str, size_t &col, size_t stripIndentAmount)
 
static void addIndexTerm (TextStream &t, QCString prim, QCString sec="")
 
void writeDocbookLink (TextStream &t, const QCString &, const QCString &compoundId, const QCString &anchorId, const QCString &text, const QCString &)
 
static QCString objectLinkToString (const QCString &, const QCString &f, const QCString &anchor, const QCString &text)
 
QCString convertToDocBook (const QCString &s, const bool retainNewline)
 

Variables

static constexpr auto hex ="0123456789ABCDEF"
 

Macro Definition Documentation

◆ DB_GEN_C

#define DB_GEN_C

Definition at line 70 of file docbookgen.cpp.

Referenced by DocbookGenerator::addIndexItem(), DocbookGenerator::addLabel(), DocbookGenerator::DocbookGenerator(), DocbookGenerator::docify(), DocbookGenerator::endBold(), DocbookGenerator::endCallGraph(), DocbookGenerator::endClassDiagram(), DocbookGenerator::endCompoundTemplateParams(), DocbookGenerator::endConstraintDocs(), DocbookGenerator::endConstraintList(), DocbookGenerator::endConstraintParam(), DocbookGenerator::endConstraintType(), DocbookGenerator::endDescTable(), DocbookGenerator::endDescTableData(), DocbookGenerator::endDescTableInit(), DocbookGenerator::endDescTableRow(), DocbookGenerator::endDescTableTitle(), DocbookGenerator::endDirDepGraph(), DocbookGenerator::endDotGraph(), DocbookGenerator::endDoxyAnchor(), DocbookGenerator::endExamples(), DocbookGenerator::endFile(), DocbookGenerator::endGroupCollaboration(), DocbookGenerator::endGroupHeader(), DocbookGenerator::endInclDepGraph(), DocbookGenerator::endInlineMemberDoc(), DocbookGenerator::endInlineMemberName(), DocbookGenerator::endInlineMemberType(), DocbookGenerator::endLabels(), DocbookGenerator::endMemberDoc(), DocbookGenerator::endMemberDocList(), DocbookGenerator::endMemberDocName(), DocbookGenerator::endMemberDocPrefixItem(), DocbookGenerator::endMemberDocSimple(), DocbookGenerator::endMemberGroup(), DocbookGenerator::endMemberGroupHeader(), DocbookGenerator::endMemberHeader(), DocbookGenerator::endMemberItem(), DocbookGenerator::endMemberList(), DocbookGenerator::endMemberTemplateParams(), DocbookGenerator::endParagraph(), DocbookGenerator::endParameterDefVal(), DocbookGenerator::endParameterExtra(), DocbookGenerator::endParameterList(), DocbookGenerator::endParameterName(), DocbookGenerator::endSection(), DocbookGenerator::endTextBlock(), DocbookGenerator::endTitleHead(), DocbookGenerator::endTypewriter(), DocbookGenerator::exceptionEntry(), DocbookGenerator::lineBreak(), objectLinkToString(), DocbookGenerator::startBold(), DocbookGenerator::startCallGraph(), DocbookGenerator::startClassDiagram(), DocbookGenerator::startCompoundTemplateParams(), DocbookGenerator::startConstraintDocs(), DocbookGenerator::startConstraintList(), DocbookGenerator::startConstraintParam(), DocbookGenerator::startConstraintType(), DocbookGenerator::startDescTable(), DocbookGenerator::startDescTableData(), DocbookGenerator::startDescTableInit(), DocbookGenerator::startDescTableRow(), DocbookGenerator::startDescTableTitle(), DocbookGenerator::startDirDepGraph(), DocbookGenerator::startDotGraph(), DocbookGenerator::startDoxyAnchor(), DocbookGenerator::startExamples(), DocbookGenerator::startFile(), DocbookGenerator::startGroupCollaboration(), DocbookGenerator::startInclDepGraph(), DocbookGenerator::startInlineMemberDoc(), DocbookGenerator::startInlineMemberName(), DocbookGenerator::startInlineMemberType(), DocbookGenerator::startLabels(), DocbookGenerator::startMemberDocList(), DocbookGenerator::startMemberDocName(), DocbookGenerator::startMemberDocPrefixItem(), DocbookGenerator::startMemberDocSimple(), DocbookGenerator::startMemberGroup(), DocbookGenerator::startMemberGroupHeader(), DocbookGenerator::startMemberHeader(), DocbookGenerator::startMemberItem(), DocbookGenerator::startMemberList(), DocbookGenerator::startMemberTemplateParams(), DocbookGenerator::startParagraph(), DocbookGenerator::startParameterDefVal(), DocbookGenerator::startParameterExtra(), DocbookGenerator::startParameterList(), DocbookGenerator::startParameterName(), DocbookGenerator::startSection(), DocbookGenerator::startTextBlock(), DocbookGenerator::startTitleHead(), DocbookGenerator::startTypewriter(), DocbookGenerator::writeChar(), DocbookGenerator::writeDoc(), DocbookGenerator::writeInheritedSectionTitle(), DocbookGenerator::writeLabel(), DocbookGenerator::writeNonBreakableSpace(), DocbookGenerator::writeObjectLink(), DocbookGenerator::writePageLink(), and DocbookGenerator::writeString().

◆ DB_GEN_C1

#define DB_GEN_C1 ( x)

◆ DB_GEN_C2

◆ DB_GEN_C2a

#define DB_GEN_C2a ( x,
y )

Definition at line 73 of file docbookgen.cpp.

◆ Docbook_DB

Function Documentation

◆ addIndexTerm()

static void addIndexTerm ( TextStream & t,
QCString prim,
QCString sec = "" )
static

Definition at line 138 of file docbookgen.cpp.

139{
140 t << "<indexterm><primary>";
141 t << convertToDocBook(prim);
142 t << "</primary>";
143 if (!sec.isEmpty())
144 {
145 t << "<secondary>";
146 t << convertToDocBook(sec);
147 t << "</secondary>";
148 }
149 t << "</indexterm>\n";
150}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
QCString convertToDocBook(const QCString &s, const bool retainNewline)

References convertToDocBook().

Referenced by DocbookGenerator::addIndexItem(), DocbookGenerator::endTitleHead(), and DocbookGenerator::startMemberDoc().

◆ convertToDocBook()

QCString convertToDocBook ( const QCString & s,
const bool retainNewline )

Converts a string to an DocBook-encoded string

Definition at line 1473 of file docbookgen.cpp.

1474{
1475 if (s.isEmpty()) return s;
1476 GrowBuf growBuf;
1477 const char *p = s.data();
1478 const char *q = nullptr;
1479 int cnt = 0;
1480 char c = 0;
1481 while ((c=*p++))
1482 {
1483 switch (c)
1484 {
1485 case '\n': if (retainNewline) growBuf.addStr("<literallayout>&#160;&#xa;</literallayout>"); growBuf.addChar(c); break;
1486 case '<': growBuf.addStr("&lt;"); break;
1487 case '>': growBuf.addStr("&gt;"); break;
1488 case '&': // possibility to have a special symbol
1489 q = p;
1490 cnt = 2; // we have to count & and ; as well
1491 while ((*q >= 'a' && *q <= 'z') || (*q >= 'A' && *q <= 'Z') || (*q >= '0' && *q <= '9'))
1492 {
1493 cnt++;
1494 q++;
1495 }
1496 if (*q == ';')
1497 {
1498 --p; // we need & as well
1501 {
1502 p++;
1503 growBuf.addStr("&amp;");
1504 }
1505 else
1506 {
1507 growBuf.addStr(HtmlEntityMapper::instance().docbook(res));
1508 q++;
1509 p = q;
1510 }
1511 }
1512 else
1513 {
1514 growBuf.addStr("&amp;");
1515 }
1516 break;
1517 case '\'': growBuf.addStr("&apos;"); break;
1518 case '"': growBuf.addStr("&quot;"); break;
1519 case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
1520 case 11: case 12: case 14: case 15: case 16: case 17: case 18:
1521 case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26:
1522 case 27: case 28: case 29: case 30: case 31:
1523 growBuf.addStr("&#x24");
1524 growBuf.addChar(hex[static_cast<uint8_t>(c)>>4]);
1525 growBuf.addChar(hex[static_cast<uint8_t>(c)&0xF]);
1526 growBuf.addChar(';');
1527 break;
1528 default:
1529 growBuf.addChar(c);
1530 break;
1531 }
1532 }
1533 growBuf.addChar(0);
1534 return growBuf.get();
1535}
Class representing a string buffer optimized for growing.
Definition growbuf.h:28
void addChar(char c)
Definition growbuf.h:69
void addStr(const QCString &s)
Definition growbuf.h:72
char * get()
Definition growbuf.h:114
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
SymType name2sym(const QCString &symName) const
Give code of the requested HTML entity name.
This is an alternative implementation of QCString.
Definition qcstring.h:101
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159
static constexpr auto hex

References GrowBuf::addChar(), GrowBuf::addStr(), QCString::data(), GrowBuf::get(), hex, HtmlEntityMapper::instance(), QCString::isEmpty(), HtmlEntityMapper::name2sym(), and HtmlEntityMapper::Sym_Unknown.

Referenced by addIndexTerm(), DocbookGenerator::docify(), DocbookDocVisitor::filter(), objectLinkToString(), DocbookDocVisitor::operator()(), DocbookDocVisitor::operator()(), DocbookDocVisitor::operator()(), DocbookDocVisitor::operator()(), DocbookGenerator::startDescTable(), DocbookGenerator::startIndexSection(), DocbookGenerator::startMemberDoc(), DocbookGenerator::startMemberDocSimple(), DocbookDocVisitor::visitPreStart(), writeDocbookString(), DocbookGenerator::writeInheritedSectionTitle(), and DocbookGenerator::writeLocalToc().

◆ objectLinkToString()

static QCString objectLinkToString ( const QCString & ,
const QCString & f,
const QCString & anchor,
const QCString & text )
static

Definition at line 771 of file docbookgen.cpp.

773{
775 QCString result;
776 if (!anchor.isEmpty())
777 {
778 if (!f.isEmpty()) result += "<link linkend=\"_" + stripPath(f) + "_1" + anchor + "\">";
779 else result += "<link linkend=\"_" + anchor + "\">";
780 }
781 else
782 {
783 result += "<link linkend=\"_" + stripPath(f) + "\">";
784 }
785 result += convertToDocBook(text);
786 result += "</link>";
787 return result;
788}
#define DB_GEN_C
QCString stripPath(const QCString &s)
Definition util.cpp:5292

References convertToDocBook(), DB_GEN_C, QCString::isEmpty(), and stripPath().

Referenced by DocbookGenerator::writeInheritedSectionTitle(), LatexGenerator::writeInheritedSectionTitle(), ManGenerator::writeInheritedSectionTitle(), RTFGenerator::writeInheritedSectionTitle(), DocbookGenerator::writeObjectLink(), LatexGenerator::writeObjectLink(), and RTFGenerator::writeObjectLink().

◆ writeDocbookCodeString()

void writeDocbookCodeString ( bool hide,
TextStream & t,
const QCString & str,
size_t & col,
size_t stripIndentAmount )
inline

Definition at line 83 of file docbookgen.cpp.

84{
85 if (str.isEmpty()) return;
86 const int tabSize = Config_getInt(TAB_SIZE);
87 const char *s = str.data();
88 char c=0;
89 if (hide)
90 {
91 col = updateColumnCount(s,col);
92 }
93 else
94 {
95 while ((c=*s++))
96 {
97 switch(c)
98 {
99 case '\t':
100 {
101 int spacesToNextTabStop = tabSize - (col%tabSize);
102 while (spacesToNextTabStop--)
103 {
104 if (col>=stripIndentAmount) t << "&#32;";
105 col++;
106 }
107 break;
108 }
109 case ' ':
110 if (col>=stripIndentAmount) t << "&#32;";
111 col++;
112 break;
113 case '<': t << "&lt;"; col++; break;
114 case '>': t << "&gt;"; col++; break;
115 case '&': t << "&amp;"; col++; break;
116 case '\'': t << "&apos;"; col++; break;
117 case '"': t << "&quot;"; col++; break;
118 default:
119 {
120 uint8_t uc = static_cast<uint8_t>(c);
121 static const char *hex="0123456789ABCDEF";
122 if (uc<32)
123 {
124 t << "&#x24" << hex[uc>>4] << hex[uc&0xF] << ";";
125 }
126 else
127 {
128 t << c;
129 }
130 col++;
131 }
132 break;
133 }
134 }
135 }
136}
#define Config_getInt(name)
Definition config.h:34
size_t updateColumnCount(const char *s, size_t col)
Definition util.cpp:7207

References Config_getInt, QCString::data(), hex, QCString::isEmpty(), and updateColumnCount().

Referenced by DocbookCodeGenerator::codify().

◆ writeDocbookLink()

void writeDocbookLink ( TextStream & t,
const QCString & ,
const QCString & compoundId,
const QCString & anchorId,
const QCString & text,
const QCString &  )

Definition at line 151 of file docbookgen.cpp.

153{
154 t << "<link linkend=\"_" << stripPath(compoundId);
155 if (!anchorId.isEmpty()) t << "_1" << anchorId;
156 t << "\"";
157 t << ">";
158 writeDocbookString(t,text);
159 t << "</link>";
160}
void writeDocbookString(TextStream &t, const QCString &s)

References QCString::isEmpty(), stripPath(), and writeDocbookString().

Referenced by DocbookCodeGenerator::writeCodeLink().

◆ writeDocbookString()

void writeDocbookString ( TextStream & t,
const QCString & s )
inline

Definition at line 78 of file docbookgen.cpp.

79{
80 t << convertToDocBook(s);
81}

References convertToDocBook().

Referenced by DocbookCodeGenerator::writeCodeLinkLine(), and writeDocbookLink().

Variable Documentation

◆ hex