22 #ifndef NDN_UTIL_STRING_HELPER_HPP    23 #define NDN_UTIL_STRING_HELPER_HPP    34   using std::invalid_argument::invalid_argument;
    76 printHex(std::ostream& os, uint64_t num, 
bool wantUpperCase = 
false);
    98 printHex(std::ostream& os, 
const uint8_t* buffer, 
size_t length, 
bool wantUpperCase = 
true);
   108 printHex(std::ostream& os, 
const Buffer& buffer, 
bool wantUpperCase = 
true);
   129 toHex(
const uint8_t* buffer, 
size_t length, 
bool wantUpperCase = 
true);
   138 toHex(
const Buffer& buffer, 
bool wantUpperCase = 
true);
   147 fromHex(
const std::string& hexString);
   153 toHexChar(
unsigned int n, 
bool wantUpperCase = 
true) noexcept
   155   return wantUpperCase ?
   156          "0123456789ABCDEF"[n & 0xf] :
   157          "0123456789abcdef"[n & 0xf];
   166   return (c >= 
'0' && c <= 
'9') ? int(c - 
'0') :
   167          (c >= 
'A' && c <= 
'F') ? 
int(c - 
'A' + 10) :
   168          (c >= 
'a' && c <= 
'f') ? 
int(c - 
'a' + 10) :
   189 escape(
const std::string& str);
   192 escape(std::ostream& os, 
const char* str, 
size_t len);
   211 unescape(std::ostream& os, 
const char* str, 
size_t len);
   215 #endif // NDN_UTIL_STRING_HELPER_HPP 
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. 
#define NDN_CXX_NODISCARD
Common includes and macros used throughout the library. 
std::string unescape(const std::string &str)
Decode a percent-encoded string. 
constexpr char toHexChar(unsigned int n, bool wantUpperCase=true) noexcept
Convert (the least significant nibble of) n to the corresponding hex character. 
std::string escape(const std::string &str)
Percent-encode a string. 
constexpr int fromHexChar(char c) noexcept
Convert the hex character c to an integer in [0, 15], or -1 if it's not a hex character. 
void printHex(std::ostream &os, uint64_t num, bool wantUpperCase)
Output the hex representation of num to the output stream os. 
General-purpose automatically managed/resized buffer. 
constexpr AsHex(uint64_t val) noexcept