59 #include <boost/algorithm/hex.hpp>
60 #include <boost/algorithm/string.hpp>
71 std::string hex_string;
72 hex_string.reserve(binary_data.size() * 2);
73 boost::algorithm::hex(binary_data.begin(), binary_data.end(), std::back_inserter(hex_string));
84 std::stringstream out;
85 for(
int n = 0; n <
length; n++)
87 int val = (int)(binary_data[n] & 0xFF);
88 if ((val == 0x20) || (val >= 48 && val <= 57) || (val >= 65 && val <= 90) || (val >= 97 && val <= 122))
90 out << std::string(1,(
char)(val & 0xFF));
97 out <<
"\\x" << std::setfill(
'0') << std::setw(2) << std::hex << val;
108 boost::replace_all(
s,
"\n",
", ");
109 boost::replace_all(
s,
": , ",
": ");
110 while(
s.find(
" ") != std::string::npos)
111 boost::replace_all(
s,
" ",
" ");