Serializes the segmentation-only view of an inspection result as a JSON object with "input" and "segments" fields. Used with --segmentation mode.
| 299 | // Serializes the segmentation-only view of an inspection result as a JSON |
| 300 | // object with "input" and "segments" fields. Used with --segmentation mode. |
| 301 | std::string SerializeSegmentationResultJson( |
| 302 | const ConversionInspectionResult& result) { |
| 303 | rapidjson::StringBuffer buffer; |
| 304 | rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); |
| 305 | writer.StartObject(); |
| 306 | writer.Key("input"); |
| 307 | writer.String(result.input.c_str(), result.input.size()); |
| 308 | writer.Key("segments"); |
| 309 | writer.StartArray(); |
| 310 | for (const auto& seg : result.segments) { |
| 311 | writer.String(seg.c_str(), seg.size()); |
| 312 | } |
| 313 | writer.EndArray(); |
| 314 | writer.EndObject(); |
| 315 | return buffer.GetString(); |
| 316 | } |
| 317 | |
| 318 | // Writes a ConversionInspectionResult as a JSON object into writer. |
| 319 | // Handles both SingleStageConverter results (segments + stages) and |
no test coverage detected