22 #ifndef NDN_STRING_HELPER_HPP
23 #define NDN_STRING_HELPER_HPP
25 #include "../common.hpp"
26 #include "../encoding/buffer.hpp"
35 :
std::invalid_argument(what)
58 printHex(std::ostream& os,
const uint8_t* buffer,
size_t length,
bool isUpperCase =
true);
68 printHex(std::ostream& os,
const Buffer& buffer,
bool isUpperCase =
true);
87 toHex(
const uint8_t* buffer,
size_t length,
bool isUpperCase =
true);
96 toHex(
const Buffer& buffer,
bool isUpperCase =
true);
104 shared_ptr<const Buffer>
105 fromHex(
const std::string& hexString);
123 trim(std::string& str);
147 #endif // NDN_STRING_HELPER_HPP
Copyright (c) 2013-2016 Regents of the University of California.
void printHex(std::ostream &os, const uint8_t *buffer, size_t length, bool isUpperCase)
Output the hex representation of the bytes in array to the output stream os.
StringHelperError(const std::string &what)
std::string toHex(const uint8_t *buffer, size_t length, bool isUpperCase)
Return the hex representation of the bytes in array.
std::string unescape(const std::string &str)
Decode a percent-encoded string.
void trimRight(std::string &str)
Modify str in place to erase whitespace on the right.
void trim(std::string &str)
Modify str in place to erase whitespace on the left and right.
void trimLeft(std::string &str)
Modify str in place to erase whitespace on the left.
int fromHexChar(uint8_t c)
Convert the hex character to an integer from 0 to 15, or -1 if not a hex character.
shared_ptr< const Buffer > fromHex(const std::string &hexString)
Convert the hex string to buffer.