FastLED 3.10.10
Loading...
Searching...
No Matches

◆ append_escaped()

template<typename Sink>
void fl::SerializerVisitor< Sink >::append_escaped ( const fl::string & str)
inline

Definition at line 1265 of file json.cpp.hpp.

1265 {
1266 out.push_back('"');
1267 for (size_t i = 0; i < str.size(); ++i) {
1268 char c = str[i];
1269 switch (c) {
1270 case '"': append("\\\""); break;
1271 case '\\': append("\\\\"); break;
1272 case '\n': append("\\n"); break;
1273 case '\r': append("\\r"); break;
1274 case '\t': append("\\t"); break;
1275 case '\b': append("\\b"); break;
1276 case '\f': append("\\f"); break;
1277 default:
1278 if (static_cast<unsigned char>(c) < 0x20) {
1279 // Remaining control characters must be \u-escaped
1280 // to produce valid JSON.
1281 static const char kHex[] = "0123456789abcdef";
1282 append("\\u00");
1283 out.push_back(kHex[(c >> 4) & 0xF]);
1284 out.push_back(kHex[c & 0xF]);
1285 } else {
1286 out.push_back(c);
1287 }
1288 break;
1289 }
1290 }
1291 out.push_back('"');
1292 }
void append(const char *str) FL_NO_EXCEPT

References append(), fl::FL_NO_EXCEPT, and out.

Referenced by accept(), and accept().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: