FastLED 3.10.6
Loading...
Searching...
No Matches

◆ putEscaped()

void fl::JsonStreamWriter::putEscaped ( const char * s)
private

Definition at line 43 of file json_stream_writer.cpp.hpp.

43 {
44 writeChar('"');
45 if (s) {
46 for (; *s; ++s) {
47 const unsigned char c = static_cast<unsigned char>(*s);
48 switch (c) {
49 case '"': puts("\\\""); break;
50 case '\\': puts("\\\\"); break;
51 case '\n': puts("\\n"); break;
52 case '\r': puts("\\r"); break;
53 case '\t': puts("\\t"); break;
54 case '\b': puts("\\b"); break;
55 case '\f': puts("\\f"); break;
56 default:
57 if (c < 0x20) {
58 // Control character → \u00XX
59 static const char *kHex = "0123456789abcdef";
60 puts("\\u00");
61 writeChar(kHex[(c >> 4) & 0xF]);
62 writeChar(kHex[c & 0xF]);
63 } else {
64 writeChar(static_cast<char>(c));
65 }
66 break;
67 }
68 }
69 }
70 writeChar('"');
71}
void writeChar(char c) FL_NO_EXCEPT
void puts(const char *s) FL_NO_EXCEPT

References fl::FL_NO_EXCEPT, puts(), and writeChar().

Referenced by key(), and value().

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