Vcsn
2.2
Be Rational
Main Page
Namespaces
Classes
Files
File List
File Members
iostream.hh
Go to the documentation of this file.
1
#pragma once
2
3
#include <iostream>
4
5
#include <boost/iostreams/filtering_stream.hpp>
6
#include <boost/iostreams/char_traits.hpp>
// EOF, WOULD_BLOCK
7
#include <boost/iostreams/concepts.hpp>
// multichar_output_filter
8
#include <boost/iostreams/operations.hpp>
// get
9
10
namespace
vcsn
11
{
12
namespace
detail
13
{
14
namespace
io = boost::iostreams;
15
17
class
backslashify_output_filter
18
:
public
io::multichar_output_filter
19
{
20
public
:
21
explicit
backslashify_output_filter
()
22
{}
23
24
void
enable
()
25
{
26
enabled_
=
true
;
27
}
28
29
void
disable
()
30
{
31
enabled_
=
false
;
32
}
33
34
template
<
typename
Sink>
35
std::streamsize
36
write
(Sink& dest,
const
char
* s, std::streamsize n)
37
{
38
std::streamsize
z
;
39
for
(z = 0; z < n; ++
z
)
40
{
41
char
c = s[
z
];
42
if
(
enabled_
43
&& (c ==
'\\'
|| c ==
'"'
))
44
if
(!io::put(dest,
'\\'
))
45
// FIXME: probably lost a char here.
46
break
;
47
if
(!io::put(dest, c))
48
break
;
49
}
50
return
z
;
51
}
52
53
bool
enabled_
=
false
;
54
};
55
}
56
}
vcsn::detail::backslashify_output_filter
Backslash backslashes.
Definition:
iostream.hh:17
vcsn::detail::backslashify_output_filter::enabled_
bool enabled_
Definition:
iostream.hh:53
vcsn
Definition:
a-star.hh:8
vcsn::z
weightset_mixin< detail::z_impl > z
Definition:
fwd.hh:56
vcsn::detail::backslashify_output_filter::write
std::streamsize write(Sink &dest, const char *s, std::streamsize n)
Definition:
iostream.hh:36
vcsn::detail::backslashify_output_filter::enable
void enable()
Definition:
iostream.hh:24
vcsn::detail::backslashify_output_filter::backslashify_output_filter
backslashify_output_filter()
Definition:
iostream.hh:21
vcsn::detail::backslashify_output_filter::disable
void disable()
Definition:
iostream.hh:29
vcsn
misc
iostream.hh
Generated by
1.8.10