31 std::stringstream result;
32 std::stringstream lineEnd;
34 result <<
"size: " << size <<
"(0x" <<
std::hex << size <<
")";
40 result << std::endl << std::setfill(
'0') << std::setw(4) << (pos & 0xFFFF);
49 const char c = buf[pos];
50 result <<
" " << std::setw(2) << (c & 0xFF);
51 lineEnd << ((c >
' ' && c < 0x7f) ? c :
'.');
55 result <<
" " << lineEnd.str();
64 template <
typename T>
inline std::ostream &
ToHexDump(std::ostream & os,
const std::vector<T> & buf, std::size_t size)
66 std::stringstream lineEnd;
67 size = std::min(size, buf.size());
69 os <<
"size: " << size <<
"(0x" <<
std::hex << size <<
")";
75 os << std::endl << std::setfill(
'0') << std::setw(4) << (pos & 0xFFFF);
84 const char c = buf[pos];
85 os <<
" " << std::setw(2) << (c & 0xFF);
86 lineEnd << ((c >
' ' && c < 0x7f) ? c :
'.');
90 os <<
" " << lineEnd.str();
99 template <
typename T>
inline std::ostream &
ToHexDump(std::ostream & os,
const std::vector<T> & buf)
106 std::stringstream result;
IntFormatSpec< int, TypeSpec<'x'> > hex(int value)
OStream< ChannelType > & flush(OStream< ChannelType > &os)
OPC UA Address space part. GNU LGPL.
std::string ToHexDump(const char *buf, std::size_t size)