Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
textdocvisitor.cpp
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
*
4
*
5
*
6
* Copyright (C) 1997-2015 by Dimitri van Heesch.
7
*
8
* Permission to use, copy, modify, and distribute this software and its
9
* documentation under the terms of the GNU General Public License is hereby
10
* granted. No representations are made about the suitability of this software
11
* for any purpose. It is provided "as is" without express or implied warranty.
12
* See the GNU General Public License for more details.
13
*
14
* Documents produced by Doxygen are derivative works derived from the
15
* input used in their production; they are not affected by this license.
16
*
17
*/
18
19
#include "
textdocvisitor.h
"
20
#include "
message.h
"
21
#include "
util.h
"
22
#include "
htmlentity.h
"
23
#include "
cite.h
"
24
#include "
emoji.h
"
25
26
//-------------------------------------------------------------------------
27
28
void
TextDocVisitor::operator()
(
const
DocSymbol
&s)
29
{
30
const
char
*res =
HtmlEntityMapper::instance
().
html
(s.
symbol
());
31
if
(res)
32
{
33
m_t
<< res;
34
}
35
else
36
{
37
err
(
"text: non supported HTML-entity found: {}\n"
,
HtmlEntityMapper::instance
().html(s.
symbol
(),
TRUE
));
38
}
39
}
40
41
void
TextDocVisitor::operator()
(
const
DocEmoji
&s)
42
{
43
// the TextDocVisitor is only invoked for the JS part of the HTML output
44
const
char
*res =
EmojiEntityMapper::instance
().
unicode
(s.
index
());
45
if
(res)
46
{
47
const
char
*p = res;
48
while
(*p)
49
{
50
switch
(*p)
51
{
52
case
'&'
:
case
'#'
:
53
break
;
54
case
'x'
:
55
m_t
<<
"\\u{"
;
56
break
;
57
case
';'
:
58
m_t
<<
"}"
;
59
break
;
60
default
:
61
m_t
<< *p;
62
break
;
63
}
64
p++;
65
}
66
}
67
else
68
{
69
filter
(s.
name
());
70
}
71
}
72
73
void
TextDocVisitor::operator()
(
const
DocCite
&cite)
74
{
75
if
(!cite.
file
().
isEmpty
())
76
{
77
QCString
anchor = cite.
anchor
();
78
QCString
anchorPrefix =
CitationManager::instance
().
anchorPrefix
();
79
anchor = anchor.
mid
(anchorPrefix.
length
());
// strip prefix
80
m_t
<< anchor;
81
}
82
else
83
{
84
filter
(cite.
target
());
85
}
86
}
87
88
void
TextDocVisitor::filter
(
const
QCString
&str)
89
{
90
if
(str.
isEmpty
())
return
;
91
//printf("TextDocVisitor::filter(%s)\n",str);
92
const
char
*p=str.
data
();
93
while
(*p)
94
{
95
char
c = *p++;
96
if
(c==
'\n'
) c=
' '
;
97
else
m_t
<< c;
98
}
99
}
100
cite.h
CitationManager::anchorPrefix
QCString anchorPrefix() const
Definition
cite.cpp:126
CitationManager::instance
static CitationManager & instance()
Definition
cite.cpp:85
DocCite
Node representing a citation of some bibliographic reference.
Definition
docnode.h:245
DocCite::target
QCString target() const
Definition
docnode.h:252
DocCite::anchor
QCString anchor() const
Definition
docnode.h:251
DocCite::file
QCString file() const
Definition
docnode.h:248
DocEmoji
Node representing an emoji.
Definition
docnode.h:341
DocEmoji::index
int index() const
Definition
docnode.h:345
DocEmoji::name
QCString name() const
Definition
docnode.h:344
DocSymbol
Node representing a special symbol.
Definition
docnode.h:328
DocSymbol::symbol
HtmlEntityMapper::SymType symbol() const
Definition
docnode.h:332
EmojiEntityMapper::unicode
const char * unicode(int index) const
Access routine to the unicode sequence for the Emoji entity.
Definition
emoji.cpp:2016
EmojiEntityMapper::instance
static EmojiEntityMapper & instance()
Returns the one and only instance of the Emoji entity mapper.
Definition
emoji.cpp:1978
HtmlEntityMapper::instance
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
Definition
htmlentity.cpp:339
HtmlEntityMapper::html
const char * html(SymType symb, bool useInPrintf=FALSE) const
Access routine to the html code of the HTML entity.
Definition
htmlentity.cpp:373
QCString
This is an alternative implementation of QCString.
Definition
qcstring.h:101
QCString::length
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition
qcstring.h:166
QCString::mid
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition
qcstring.h:241
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition
qcstring.h:163
QCString::data
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:172
TextDocVisitor::filter
void filter(const QCString &str)
Definition
textdocvisitor.cpp:88
TextDocVisitor::m_t
TextStream & m_t
Definition
textdocvisitor.h:113
TextDocVisitor::operator()
void operator()(const DocWord &w)
Definition
textdocvisitor.h:37
emoji.h
htmlentity.h
message.h
err
#define err(fmt,...)
Definition
message.h:127
TRUE
#define TRUE
Definition
qcstring.h:37
textdocvisitor.h
util.h
A bunch of utility functions.
src
textdocvisitor.cpp
Generated by
1.17.0