FastLED 3.10.8
Loading...
Searching...
No Matches

◆ unescape_string()

fl::string fl::anonymous_namespace{json.cpp.hpp}::unescape_string ( const fl::span< const char > & span)

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

643 {
645 result.reserve(span.size());
646
647 for (size_t i = 0; i < span.size(); i++) {
648 if (span[i] == '\\' && i + 1 < span.size()) {
649 char next = span[i + 1];
650 switch (next) {
651 case '"': result += '"'; i++; break;
652 case '\\': result += '\\'; i++; break;
653 case '/': result += '/'; i++; break;
654 case 'b': result += '\b'; i++; break;
655 case 'f': result += '\f'; i++; break;
656 case 'n': result += '\n'; i++; break;
657 case 'r': result += '\r'; i++; break;
658 case 't': result += '\t'; i++; break;
659 default: result += span[i]; break; // Pass through unknown escapes
660 }
661 } else {
662 result += span[i];
663 }
664 }
665
666 return result;
667}
constexpr fl::size size() const FL_NO_EXCEPT
Definition span.h:483
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31

References fl::FL_NO_EXCEPT, fl::span< T, Extent >::size(), and unescape_string().

Referenced by fl::anonymous_namespace{json.cpp.hpp}::JsonBuilder::on_token(), and unescape_string().

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