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