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

Function JSON_Encode

Source/MediaInfo/OutputHelpers.cpp:200–218  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

198
199//---------------------------------------------------------------------------
200string JSON_Encode (const string& Data)
201{
202 string Result;
203 for (string::size_type Pos=0; Pos<Data.size(); Pos++)
204 {
205 switch (Data[Pos])
206 {
207 case '\b': Result+="\\b"; break;
208 case '\f': Result+="\\f"; break;
209 case '\n': Result+="\\n"; break;
210 case '\r': Result+="\\r"; break;
211 case '\t': Result+="\\t"; break;
212 case '"': Result+="\\\""; break;
213 case '\\': Result+="\\\\"; break;
214 default: Result+=Data[Pos];
215 }
216 }
217 return Result;
218}
219
220//---------------------------------------------------------------------------
221string To_JSON_Attributes(Node& Cur_Node, const int& Level, bool Indent, bool Carriage_Returns)

Callers 3

To_JSON_AttributesFunction · 0.85
To_JSON_ElementsFunction · 0.85
To_JSONFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected