MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / json_escape

Method json_escape

include/chaiscript/utility/json.hpp:427–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

425
426 private:
427 static std::string json_escape( const std::string &str ) {
428 std::string output;
429 for(char i : str) {
430 switch( i ) {
431 case '\"': output += "\\\""; break;
432 case '\\': output += "\\\\"; break;
433 case '\b': output += "\\b"; break;
434 case '\f': output += "\\f"; break;
435 case '\n': output += "\\n"; break;
436 case '\r': output += "\\r"; break;
437 case '\t': output += "\\t"; break;
438 default : output += i; break;
439 }
440}
441 return output;
442 }
443
444
445 private:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected