Vcsn
2.3
Be Rational
Main Page
Namespaces
Classes
Files
File List
File Members
escape.hh
Go to the documentation of this file.
1
#pragma once
2
3
#include <iosfwd>
4
#include <iostream>
5
#include <sstream>
6
#include <string>
7
#include <vector>
8
9
#include <
vcsn/misc/export.hh
>
10
11
namespace
vcsn
LIBVCSN_API
12
{
14
std::ostream&
str_escape
(std::ostream&
os
,
const
std::string& str,
15
const
char
* special =
nullptr
);
16
18
template
<
typename
T>
19
std::ostream&
str_escape
(std::ostream&
os
,
20
const
std::vector<T>& s,
21
const
char
* special =
nullptr
)
22
{
23
for
(
auto
c: s)
24
str_escape
(os, c, special);
25
return
os
;
26
}
27
30
std::ostream&
str_escape
(std::ostream&
os
,
int
c,
31
const
char
* special =
nullptr
);
32
34
std::ostream&
str_escape
(std::ostream&
os
,
char
c,
35
const
char
* special =
nullptr
);
36
37
template
<
typename
T>
38
std::string
str_escape
(T&& s,
39
const
char
* special =
nullptr
)
40
{
41
std::ostringstream o;
42
str_escape
(o, std::forward<T>(s), special);
43
return
o.str();
44
}
45
}
export.hh
vcsn::str_escape
std::ostream & str_escape(std::ostream &os, const std::string &str, const char *special=nullptr)
Output a string, escaping special characters.
Definition:
escape.cc:51
vcsn
Definition:
a-star.hh:8
LIBVCSN_API
#define LIBVCSN_API
Definition:
export.hh:8
os
std::ostringstream os
The output stream: the corresponding C++ snippet to compile.
Definition:
translate.cc:375
vcsn
misc
escape.hh
Generated by
1.8.10