Joos1W Compiler Framework
Main Page
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
l
m
n
p
r
s
t
v
Functions
a
b
c
d
e
f
g
h
i
l
m
n
p
r
s
t
v
Typedefs
Files
File List
•
All
Classes
Functions
Typedefs
Pages
DotPrinter.cc
1
#
include
"utils/DotPrinter.h"
2
3
namespace
utils {
4
5
std::ostream& operator<<(std::ostream& os,
DotPrinter
::Sanitize s) {
6
for
(
auto
c : s.str) {
7
switch
(c) {
8
case
'<'
:
9
os <<
"<"
;
10
break
;
11
case
'>'
:
12
os <<
">"
;
13
break
;
14
case
'"'
:
15
os <<
"""
;
16
break
;
17
case
'\''
:
18
os <<
"'"
;
19
break
;
20
case
'\n'
:
21
if
(s.left_align) {
22
os <<
"<br align=\"left\"/>"
;
23
}
else
{
24
os <<
"<br/>"
;
25
}
26
break
;
27
case
'&'
:
28
os <<
"&"
;
29
break
;
30
default
:
31
// Check if c is a printable ASCII character
32
if
(c < 32 || c > 126) {
33
os <<
"&#x"
<< std::hex <<
static_cast
<
int
>(c) <<
";"
;
34
}
else
{
35
os << c;
36
}
37
break
;
38
}
39
}
40
return
os;
41
}
42
43
}
// namespace utils
lib
utils
DotPrinter.cc
Generated by
1.9.1