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

◆ putEscaped()

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

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

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