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

◆ streamJsonRpcId()

void fl::streamJsonRpcId ( fl::JsonStreamWriter & writer,
const fl::json & id )
inline

Definition at line 15 of file response_stream.h.

16 {
17 if (!id.has_value() || id.is_null()) {
18 writer.valueNull();
19 return;
20 }
21 if (id.is_string()) {
22 fl::string s = id.as_string().value_or("");
23 writer.value(s.c_str());
24 return;
25 }
26 if (id.is_bool()) {
27 writer.value(id.as_bool().value_or(false));
28 return;
29 }
30 if (id.is_int()) {
31 writer.value(id.as_int().value_or(0));
32 return;
33 }
34 if (id.is_number()) {
35 writer.value(static_cast<fl::i64>(id.as_float().value_or(0.0f)));
36 return;
37 }
38 writer.valueNull();
39}
void value(const char *s) FL_NO_EXCEPT
const char * c_str() const FL_NO_EXCEPT

References fl::basic_string::c_str(), and FL_NO_EXCEPT.

Referenced by streamJsonRpcResultEnvelope().

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