23 #include "../encoding/buffer.hpp"    24 #include "../encoding/buffer-stream.hpp"    25 #include "../security/transform/buffer-source.hpp"    26 #include "../security/transform/hex-decode.hpp"    27 #include "../security/transform/hex-encode.hpp"    28 #include "../security/transform/stream-sink.hpp"    37   printHex(os, hex.m_value, os.flags() & std::ostream::uppercase);
    42 printHex(std::ostream& os, uint64_t num, 
bool wantUpperCase)
    44   auto osFlags = os.flags();
    46   os << 
"0x" << std::noshowbase << std::noshowpos
    47      << (wantUpperCase ? std::uppercase : std::nouppercase)
    53 printHex(std::ostream& os, 
const uint8_t* buffer, 
size_t length, 
bool wantUpperCase)
    55   namespace tr = security::transform;
    56   BOOST_ASSERT(buffer != 
nullptr || length == 0);
    63   return printHex(os, buffer.data(), buffer.size(), wantUpperCase);
    67 toHex(
const uint8_t* buffer, 
size_t length, 
bool wantUpperCase)
    69   std::ostringstream result;
    70   printHex(result, buffer, length, wantUpperCase);
    77   return toHex(buffer.data(), buffer.size(), wantUpperCase);
    83   if (c >= 
'0' && c <= 
'9')
    85   else if (c >= 
'A' && c <= 
'F')
    87   else if (c >= 
'a' && c <= 
'f')
    96   namespace tr = security::transform;
   102   catch (
const tr::Error& e) {
   103     BOOST_THROW_EXCEPTION(
StringHelperError(std::string(
"Conversion from hex failed: ") + e.what()));
   112   std::ostringstream result;
   114   for (
size_t i = 0; i < str.size(); ++i) {
   115     if (str[i] == 
'%' && i + 2 < str.size()) {
   119       if (hi < 0 || lo < 0)
   121         result << str[i] << str[i + 1] << str[i + 2];
   123         result << static_cast<char>((hi << 4) | lo);
 
Copyright (c) 2011-2015 Regents of the University of California. 
 
std::string toHex(const uint8_t *buffer, size_t length, bool wantUpperCase)
Return a string containing the hex representation of the bytes in buffer. 
 
std::ostream & operator<<(std::ostream &os, const Data &data)
 
Helper class to convert a number to hexadecimal format, for use with stream insertion operators...
 
shared_ptr< Buffer > fromHex(const std::string &hexString)
Convert the hex string to buffer. 
 
std::string unescape(const std::string &str)
Decode a percent-encoded string. 
 
int fromHexChar(char c)
Convert the hex character to an integer from 0 to 15, or -1 if not a hex character. 
 
shared_ptr< Buffer > buf()
Flush written data to the stream and return shared pointer to the underlying buffer. 
 
void printHex(std::ostream &os, uint64_t num, bool wantUpperCase)
Output the hex representation of num to the output stream os. 
 
implements an output stream that constructs ndn::Buffer 
 
General-purpose automatically managed/resized buffer.