30
30
class SimpleTreeDecoder : public AbstractTreeDecoder {
31
31
public:
32
32
SimpleTreeDecoder (InStream &input);
33
- virtual void readNode (Defect *def, const pt::ptree &node );
33
+ virtual bool readNode (Defect *def, pt::ptree::const_iterator defIter );
34
34
35
35
private:
36
36
enum ENodeKind {
@@ -53,7 +53,7 @@ class SimpleTreeDecoder: public AbstractTreeDecoder {
53
53
// / tree decoder of the Coverity JSON format
54
54
class CovTreeDecoder : public AbstractTreeDecoder {
55
55
public:
56
- virtual void readNode (Defect *def, const pt::ptree &node );
56
+ virtual bool readNode (Defect *def, pt::ptree::const_iterator defIter );
57
57
58
58
private:
59
59
KeyEventDigger keDigger;
@@ -150,13 +150,12 @@ const TScanProps& JsonParser::getScanProps() const
150
150
bool JsonParser::Private::readNext (Defect *def)
151
151
{
152
152
try {
153
- // get the current node and move to the next one
154
- const pt::ptree &defNode = this ->defIter ->second ;
155
- this ->defIter ++;
156
- this ->defNumber ++;
153
+ // make sure the Defect structure is properly initialized
154
+ (*def) = Defect ();
157
155
158
- // read the current node
159
- this ->decoder ->readNode (def, defNode);
156
+ // read the current node and move to the next one
157
+ this ->defNumber ++;
158
+ this ->decoder ->readNode (def, this ->defIter ++);
160
159
return true ;
161
160
}
162
161
catch (pt::ptree_error &e) {
@@ -231,12 +230,11 @@ void SimpleTreeDecoder::reportUnknownNodes(ENodeKind nk, const pt::ptree &node)
231
230
}
232
231
}
233
232
234
- void SimpleTreeDecoder::readNode (
233
+ bool SimpleTreeDecoder::readNode (
235
234
Defect *def,
236
- const pt::ptree &defNode )
235
+ pt::ptree::const_iterator defIter )
237
236
{
238
- // make sure the Defect structure is properly initialized
239
- (*def) = Defect ();
237
+ const pt::ptree &defNode = defIter->second ;
240
238
241
239
this ->reportUnknownNodes (NK_DEFECT, defNode);
242
240
@@ -293,14 +291,15 @@ void SimpleTreeDecoder::readNode(
293
291
294
292
// read annotation if available
295
293
def->annotation = valueOf<std::string>(defNode, " annotation" , " " );
294
+
295
+ return true ;
296
296
}
297
297
298
- void CovTreeDecoder::readNode (
298
+ bool CovTreeDecoder::readNode (
299
299
Defect *def,
300
- const pt::ptree &defNode )
300
+ pt::ptree::const_iterator defIter )
301
301
{
302
- // make sure the Defect structure is properly initialized
303
- (*def) = Defect ();
302
+ const pt::ptree &defNode = defIter->second ;
304
303
305
304
// read per-defect properties
306
305
def->checker = defNode.get <std::string>(" checkerName" );
@@ -337,4 +336,6 @@ void CovTreeDecoder::readNode(
337
336
338
337
// initialize verbosity level of all events
339
338
this ->keDigger .initVerbosity (def);
339
+
340
+ return true ;
340
341
}
0 commit comments