MCPcopy Create free account
hub / github.com/apache/trafficserver / WriteDoubleQuotedString

Function WriteDoubleQuotedString

lib/yamlcpp/src/emitterutils.cpp:319–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
320 StringEscaping::value stringEscaping) {
321 out << "\"";
322 int codePoint;
323 for (std::string::const_iterator i = str.begin();
324 GetNextCodePointAndAdvance(codePoint, i, str.end());) {
325 switch (codePoint) {
326 case '\"':
327 out << "\\\"";
328 break;
329 case '\\':
330 out << "\\\\";
331 break;
332 case '\n':
333 out << "\\n";
334 break;
335 case '\t':
336 out << "\\t";
337 break;
338 case '\r':
339 out << "\\r";
340 break;
341 case '\b':
342 out << "\\b";
343 break;
344 case '\f':
345 out << "\\f";
346 break;
347 default:
348 if (codePoint < 0x20 ||
349 (codePoint >= 0x80 &&
350 codePoint <= 0xA0)) { // Control characters and non-breaking space
351 WriteDoubleQuoteEscapeSequence(out, codePoint, stringEscaping);
352 } else if (codePoint == 0xFEFF) { // Byte order marks (ZWNS) should be
353 // escaped (YAML 1.2, sec. 5.2)
354 WriteDoubleQuoteEscapeSequence(out, codePoint, stringEscaping);
355 } else if (stringEscaping == StringEscaping::NonAscii && codePoint > 0x7E) {
356 WriteDoubleQuoteEscapeSequence(out, codePoint, stringEscaping);
357 } else {
358 WriteCodePoint(out, codePoint);
359 }
360 }
361 }
362 out << "\"";
363 return true;
364}
365
366bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
367 std::size_t indent) {

Callers 2

emitter.cppFile · 0.85
WriteBinaryFunction · 0.85

Calls 5

WriteCodePointFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected