MCPcopy Create free account
hub / github.com/MediaArea/MediaInfoLib / To_JSON_Attributes

Function To_JSON_Attributes

Source/MediaInfo/OutputHelpers.cpp:221–238  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

219
220//---------------------------------------------------------------------------
221string To_JSON_Attributes(Node& Cur_Node, const int& Level, bool Indent, bool Carriage_Returns)
222{
223 string Result;
224 for (size_t Pos=0; Pos<Cur_Node.Attrs.size(); Pos++)
225 {
226 if (Cur_Node.Attrs[Pos].first.empty() || Cur_Node.Attrs[Pos].first.substr(0, 5)=="xmlns" || Cur_Node.Attrs[Pos].first.substr(0, 3)=="xsi")
227 continue;
228
229 Result+=(Carriage_Returns?("\n"+(Indent?string(Level, '\t'):string())):string())+"\"@"+Cur_Node.Attrs[Pos].first+(Carriage_Returns?"\": \"":"\":\"")
230 +JSON_Encode(Cur_Node.Attrs[Pos].second)+"\"";
231
232 if (Pos<Cur_Node.Attrs.size()-1 || Cur_Node.Value.size() || Cur_Node.Childs.size())
233 Result+=",";
234 }
235 Cur_Node.Attrs.clear(); //Free memory
236
237 return Result;
238}
239
240//---------------------------------------------------------------------------
241string To_JSON_Elements(Node& Cur_Node, const int& Level, bool Indent, bool Carriage_Returns)

Callers 2

To_JSON_ElementsFunction · 0.85
To_JSONFunction · 0.85

Calls 4

JSON_EncodeFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected