bool WriteChar()

in lib/yamlcpp/src/emitterutils.cpp [382:407]


bool WriteChar(ostream_wrapper& out, char ch, StringEscaping::value stringEscapingStyle) {
  if (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')) {
    out << ch;
  } else if (ch == '\"') {
    out << R"("\"")";
  } else if (ch == '\t') {
    out << R"("\t")";
  } else if (ch == '\n') {
    out << R"("\n")";
  } else if (ch == '\b') {
    out << R"("\b")";
  } else if (ch == '\r') {
    out << R"("\r")";
  } else if (ch == '\f') {
    out << R"("\f")";
  } else if (ch == '\\') {
    out << R"("\\")";
  } else if (0x20 <= ch && ch <= 0x7e) {
    out << "\"" << ch << "\"";
  } else {
    out << "\"";
    WriteDoubleQuoteEscapeSequence(out, ch, stringEscapingStyle);
    out << "\"";
  }
  return true;
}