6std::string GstreamerJsonFactory::jsonEscape(
const std::string& s) {
8 out.reserve(s.size() + 8);
10 for (
unsigned char c : s) {
12 case '\\': out +=
"\\\\";
14 case '"': out +=
"\\\"";
16 case '\b': out +=
"\\b";
18 case '\f': out +=
"\\f";
20 case '\n': out +=
"\\n";
22 case '\r': out +=
"\\r";
24 case '\t': out +=
"\\t";
30 static const char* hex =
"0123456789abcdef";
32 out += hex[(c >> 4) & 0xF];
36 out.push_back(
static_cast<char>(c));