MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / escapeJSON

Function escapeJSON

samples/exifdata.cpp:79–97  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

77
78///////////////////////////////////////////////////////////////////////
79std::string escapeJSON(Exiv2::ExifData::const_iterator it, bool bValue = true) {
80 std::string result;
81
82 std::ostringstream os;
83 if (bValue)
84 os << it->value();
85 else
86 os << it->key();
87
88 std::string s = os.str();
89 for (auto&& c : s) {
90 if (c == '"')
91 result += "\\\"";
92 result += c;
93 }
94
95 std::string q = "\"";
96 return q + result + q;
97}
98
99std::string formatJSON(Exiv2::ExifData& exifData) {
100 size_t count = 0;

Callers 1

formatJSONFunction · 0.85

Calls 1

keyMethod · 0.45

Tested by

no test coverage detected