| 250 | } |
| 251 | |
| 252 | std::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 | |
| 266 | void stream_callback(const char* token, uint32_t token_id, void* user_data) { |
| 267 | auto* data = static_cast<StreamingData*>(user_data); |
nothing calls this directly
no outgoing calls
no test coverage detected