Doxygen
Loading...
Searching...
No Matches
docbookgen.h File Reference
#include <memory>
#include <array>
#include "config.h"
#include "outputgen.h"
Include dependency graph for docbookgen.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  DocbookCodeGenerator
class  DocbookGenerator
struct  DocbookGenerator::TocState

Macros

#define DB_GEN_EMPTY
#define DB_GEN_H
#define DB_GEN_H1(x)
#define DB_GEN_H2(y)
#define DB_GEN_H2a(x, y)
#define DB_GEN_NEW

Functions

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

Macro Definition Documentation

◆ DB_GEN_EMPTY

#define DB_GEN_EMPTY

Definition at line 26 of file docbookgen.h.

Referenced by DocbookGenerator::endAnonTypeScope(), DocbookGenerator::endContents(), DocbookGenerator::endDescForItem(), DocbookGenerator::endHeaderSection(), DocbookGenerator::endIndent(), DocbookGenerator::endItemList(), DocbookGenerator::endItemListItem(), DocbookGenerator::endMemberDeclaration(), DocbookGenerator::endMemberDescription(), DocbookGenerator::endMemberGroupDocs(), DocbookGenerator::endMemberSections(), DocbookGenerator::endMemberSubtitle(), DocbookGenerator::endPageDoc(), DocbookGenerator::endParameterType(), DocbookGenerator::endQuickIndices(), DocbookGenerator::insertMemberAlign(), DocbookGenerator::insertMemberAlignLeft(), DocbookGenerator::lastIndexPage(), DocbookGenerator::startAnonTypeScope(), DocbookGenerator::startContents(), DocbookGenerator::startDescForItem(), DocbookGenerator::startHeaderSection(), DocbookGenerator::startIndent(), DocbookGenerator::startItemList(), DocbookGenerator::startItemListItem(), DocbookGenerator::startMemberDeclaration(), DocbookGenerator::startMemberDescription(), DocbookGenerator::startMemberGroupDocs(), DocbookGenerator::startMemberSections(), DocbookGenerator::startMemberSubtitle(), DocbookGenerator::startPageDoc(), DocbookGenerator::startParameterType(), DocbookGenerator::startQuickIndices(), DocbookGenerator::writeAnchor(), DocbookGenerator::writeLatexSpacing(), DocbookGenerator::writePageOutline(), DocbookGenerator::writeQuickLinks(), DocbookGenerator::writeSearchInfo(), DocbookGenerator::writeSplitBar(), DocbookGenerator::writeStyleInfo(), DocbookGenerator::writeSummaryLink(), and DocbookGenerator::writeSynopsis().

◆ DB_GEN_H

#define DB_GEN_H

Definition at line 38 of file docbookgen.h.

◆ DB_GEN_H1

#define DB_GEN_H1 ( x)

Definition at line 39 of file docbookgen.h.

◆ DB_GEN_H2

#define DB_GEN_H2 ( y)

Definition at line 40 of file docbookgen.h.

◆ DB_GEN_H2a

#define DB_GEN_H2a ( x,
y )

Definition at line 41 of file docbookgen.h.

◆ DB_GEN_NEW

Function Documentation

◆ convertToDocBook()

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

Converts a string to an DocBook-encoded string

Definition at line 1482 of file docbookgen.cpp.

1483{
1484 if (s.isEmpty()) return s;
1485 GrowBuf growBuf;
1486 const char *p = s.data();
1487 const char *q = nullptr;
1488 int cnt = 0;
1489 char c = 0;
1490 while ((c=*p++))
1491 {
1492 switch (c)
1493 {
1494 case '\n': if (retainNewline) growBuf.addStr("<literallayout>&#160;&#xa;</literallayout>"); growBuf.addChar(c); break;
1495 case '<': growBuf.addStr("&lt;"); break;
1496 case '>': growBuf.addStr("&gt;"); break;
1497 case '&': // possibility to have a special symbol
1498 q = p;
1499 cnt = 2; // we have to count & and ; as well
1500 while ((*q >= 'a' && *q <= 'z') || (*q >= 'A' && *q <= 'Z') || (*q >= '0' && *q <= '9'))
1501 {
1502 cnt++;
1503 q++;
1504 }
1505 if (*q == ';')
1506 {
1507 --p; // we need & as well
1510 {
1511 p++;
1512 growBuf.addStr("&amp;");
1513 }
1514 else
1515 {
1516 growBuf.addStr(HtmlEntityMapper::instance().docbook(res));
1517 q++;
1518 p = q;
1519 }
1520 }
1521 else
1522 {
1523 growBuf.addStr("&amp;");
1524 }
1525 break;
1526 case '\'': growBuf.addStr("&apos;"); break;
1527 case '"': growBuf.addStr("&quot;"); break;
1528 case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
1529 case 11: case 12: case 14: case 15: case 16: case 17: case 18:
1530 case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26:
1531 case 27: case 28: case 29: case 30: case 31:
1532 growBuf.addStr("&#x24");
1533 growBuf.addChar(hex[static_cast<uint8_t>(c)>>4]);
1534 growBuf.addChar(hex[static_cast<uint8_t>(c)&0xF]);
1535 growBuf.addChar(';');
1536 break;
1537 default:
1538 growBuf.addChar(c);
1539 break;
1540 }
1541 }
1542 growBuf.addChar(0);
1543 return growBuf.get();
1544}
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
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
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(), DocbookGenerator::startTocEntry(), DocbookDocVisitor::visitPreStart(), writeDocbookString(), and DocbookGenerator::writeInheritedSectionTitle().