File tree 2 files changed +21
-3
lines changed
2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 3
3
namespace JSON
4
4
{
5
5
BeautifiedStreamWrapper::BeautifiedStreamWrapper ()
6
- : indentation_(0 )
6
+ : indentation_(0 )
7
+ , escape_(false )
8
+ , disabled_(false )
7
9
, nestingStack_()
8
10
{
9
11
nestingStack_.push (NestingState::IN_CLASS);
Original file line number Diff line number Diff line change @@ -32,7 +32,21 @@ namespace JSON
32
32
template <typename Sink>
33
33
bool put (Sink& snk, char c)
34
34
{
35
- namespace io = boost::iostreams;
35
+ namespace io = boost::iostreams;
36
+
37
+ escape_ = false ;
38
+ if (disabled_)
39
+ if (c == ' \\ ' )
40
+ escape_ = true ;
41
+
42
+ if (c == ' "' && !escape_)
43
+ disabled_ = !disabled_;
44
+
45
+ if (disabled_)
46
+ {
47
+ io::put (snk, c);
48
+ return true ;
49
+ }
36
50
37
51
if (c == ' {' )
38
52
{
@@ -83,7 +97,9 @@ namespace JSON
83
97
}
84
98
85
99
private:
86
- int indentation_;
100
+ int indentation_;
101
+ bool escape_;
102
+ bool disabled_;
87
103
std::stack <NestingState> nestingStack_;
88
104
};
89
105
}
You can’t perform that action at this time.
0 commit comments