14 std::ios_base::fmtflags flags = os.flags(std::ios_base::hex);
15 char fill = os.fill(
'0');
18 case -1: os <<
"<end-of-file>";
break;
19 case '\\': os <<
"\\\\";
break;
20 case '"': os <<
"\\\"";
break;
21 case '\n': os <<
"\\n";
break;
23 if (0 <= c && c <= 0177 && std::isprint(c))
26 os <<
"\\x" << std::setw(2) << c;
std::ostream & str_escape(std::ostream &os, const std::string &str)
Output a string, escaping special characters.
std::ostringstream os
The output stream: the corresponding C++ snippet to compile.