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
 

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::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 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
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(), DocbookDocVisitor::visitPreStart(), writeDocbookString(), DocbookGenerator::writeInheritedSectionTitle(), and DocbookGenerator::writeLocalToc().