MCPcopy Create free account
hub / github.com/cactus-compute/cactus / escape_json

Function escape_json

tests/test_utils.cpp:252–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252std::string escape_json(const std::string& s) {
253 std::ostringstream o;
254 for (auto c : s) {
255 switch (c) {
256 case '"': o << "\\\""; break;
257 case '\\': o << "\\\\"; break;
258 case '\n': o << "\\n"; break;
259 case '\r': o << "\\r"; break;
260 default: o << c; break;
261 }
262 }
263 return o.str();
264}
265
266void stream_callback(const char* token, uint32_t token_id, void* user_data) {
267 auto* data = static_cast<StreamingData*>(user_data);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected