10 std::ostringstream os;
13 if (c >= 0x20 && c < 0x7f) {
14 if (c ==
'\"' || c ==
'\\')
33 os <<
"\\x" << std::setw(2) << std::setfill(
'0')
34 << std::oct << (unsigned(c) & 0xff);
45 const std::uint8_t *data =
static_cast<const std::uint8_t *
>(_data);
46 std::ostringstream os;
48 os.setf(std::ios::hex, std::ios::basefield);
49 for (; len > 0; ++data, --len)
50 os << std::setw(2) << unsigned(*data);
57 Printer::bol(
const char *name)
64 buf_ << std::endl << std::string(indent_,
' ');
68 buf_ << name <<
" = ";
std::string escape_string(const std::string &s)
Use hex escapes for non-printable characters, and prefix backslashes and quotes with backslash...
Most of the xdrpp library is encapsulated in the xdr namespace.
std::string hexdump(const void *_data, size_t len)
Turn a string into a double-length sequence of hex nibbles.
Support for pretty-printing XDR data types.