1919
2020#include " json-writer.hh"
2121
22+ #include " shared-string-ptree.hh"
23+
2224#include < queue>
2325
2426#include < boost/foreach.hpp>
2527#include < boost/iostreams/filtering_stream.hpp>
2628#include < boost/iostreams/filter/regex.hpp>
2729#include < boost/property_tree/json_parser.hpp>
2830
31+ typedef SharedStringPTree PTree;
32+
2933struct JsonWriter ::Private {
3034 std::ostream &str;
3135 std::queue<Defect> defQueue;
@@ -54,13 +58,13 @@ void JsonWriter::setScanProps(const TScanProps &scanProps) {
5458 d->scanProps = scanProps;
5559}
5660
57- void appendDefectNode (boost::property_tree::ptree &dst, const Defect &def) {
61+ void appendDefectNode (PTree &dst, const Defect &def) {
5862 using std::string;
5963
6064 // go through events
61- boost::property_tree::ptree evtList;
65+ PTree evtList;
6266 BOOST_FOREACH (const DefEvent &evt, def.events ) {
63- boost::property_tree::ptree evtNode;
67+ PTree evtNode;
6468
6569 // describe the location
6670 evtNode.put <string>(" file_name" , evt.fileName );
@@ -78,7 +82,7 @@ void appendDefectNode(boost::property_tree::ptree &dst, const Defect &def) {
7882 }
7983
8084 // create a node for a single defect
81- boost::property_tree::ptree defNode;
85+ PTree defNode;
8286 defNode.put <string>(" checker" , def.checker );
8387 if (!def.annotation .empty ())
8488 defNode.put <string>(" annotation" , def.annotation );
@@ -123,18 +127,18 @@ void JsonWriter::flush() {
123127 str.push (d->str );
124128
125129 // encode scan properties if we have some
126- boost::property_tree::ptree root;
130+ PTree root;
127131 if (!d->scanProps .empty ()) {
128- boost::property_tree::ptree scan;
132+ PTree scan;
129133 BOOST_FOREACH (TScanProps::const_reference prop, d->scanProps )
130134 scan.put <std::string>(prop.first , prop.second );
131135
132136 root.put_child (" scan" , scan);
133137 }
134138
135139 // 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" );
138142
139143 // go through the queue and move defects one by one to the property tree
140144 for (; !d->defQueue .empty (); d->defQueue .pop ())
0 commit comments