FastLED 3.10.9
Loading...
Searching...
No Matches

◆ append_escaped()

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

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

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