19
19
20
20
#include " json-writer.hh"
21
21
22
+ #include " shared-string-ptree.hh"
23
+
22
24
#include < queue>
23
25
24
26
#include < boost/foreach.hpp>
25
27
#include < boost/iostreams/filtering_stream.hpp>
26
28
#include < boost/iostreams/filter/regex.hpp>
27
29
#include < boost/property_tree/json_parser.hpp>
28
30
31
+ typedef SharedStringPTree PTree;
32
+
29
33
struct JsonWriter ::Private {
30
34
std::ostream &str;
31
35
std::queue<Defect> defQueue;
@@ -54,13 +58,13 @@ void JsonWriter::setScanProps(const TScanProps &scanProps) {
54
58
d->scanProps = scanProps;
55
59
}
56
60
57
- void appendDefectNode (boost::property_tree::ptree &dst, const Defect &def) {
61
+ void appendDefectNode (PTree &dst, const Defect &def) {
58
62
using std::string;
59
63
60
64
// go through events
61
- boost::property_tree::ptree evtList;
65
+ PTree evtList;
62
66
BOOST_FOREACH (const DefEvent &evt, def.events ) {
63
- boost::property_tree::ptree evtNode;
67
+ PTree evtNode;
64
68
65
69
// describe the location
66
70
evtNode.put <string>(" file_name" , evt.fileName );
@@ -78,7 +82,7 @@ void appendDefectNode(boost::property_tree::ptree &dst, const Defect &def) {
78
82
}
79
83
80
84
// create a node for a single defect
81
- boost::property_tree::ptree defNode;
85
+ PTree defNode;
82
86
defNode.put <string>(" checker" , def.checker );
83
87
if (!def.annotation .empty ())
84
88
defNode.put <string>(" annotation" , def.annotation );
@@ -123,18 +127,18 @@ void JsonWriter::flush() {
123
127
str.push (d->str );
124
128
125
129
// encode scan properties if we have some
126
- boost::property_tree::ptree root;
130
+ PTree root;
127
131
if (!d->scanProps .empty ()) {
128
- boost::property_tree::ptree scan;
132
+ PTree scan;
129
133
BOOST_FOREACH (TScanProps::const_reference prop, d->scanProps )
130
134
scan.put <std::string>(prop.first , prop.second );
131
135
132
136
root.put_child (" scan" , scan);
133
137
}
134
138
135
139
// node representing the list of defects
136
- root.put_child (" defects" , boost::property_tree::ptree ());
137
- boost::property_tree::ptree &defects = root.get_child (" defects" );
140
+ root.put_child (" defects" , PTree ());
141
+ PTree &defects = root.get_child (" defects" );
138
142
139
143
// go through the queue and move defects one by one to the property tree
140
144
for (; !d->defQueue .empty (); d->defQueue .pop ())
0 commit comments