18 #include <boost/lexical_cast.hpp>
19 #include <boost/shared_ptr.hpp>
55 std::string
trim(
const std::string& instring);
71 template<
typename Iterator>
74 for ( ; end != begin && *(end - 1) == trim_val; --end);
105 std::vector<std::string>
tokens(
const std::string& text,
106 const std::string& delim = std::string(
" \t\n"),
107 bool escape =
false);
120 return (
static_cast<char>(std::toupper(
static_cast<int>(chr))));
129 std::transform(text.begin(), text.end(), text.begin(),
144 return (
static_cast<char>(std::tolower(
static_cast<int>(chr))));
153 std::transform(text.begin(), text.end(), text.begin(),
168 const std::vector<std::string>& args);
180 std::string
getToken(std::istringstream& iss);
203 template <
typename NumType,
int BitSize>
208 num = boost::lexical_cast<NumType>(num_token);
209 }
catch (
const boost::bad_lexical_cast&) {
213 if (num < 0 || num >= (
static_cast<NumType
>(1) << BitSize)) {
260 const std::string& sep,
261 std::vector<uint8_t>& binary);
275 std::vector<uint8_t>& binary);
297 std::vector<uint8_t>& binary);
300 class StringSanitizerImpl;
329 const std::string& char_replacement);
344 std::string
scrub(
const std::string& original);
368 for (
const auto& ch : content) {
369 if (isprint(
static_cast<int>(ch)) == 0) {
383 for (
const auto& ch : content) {
384 if (isprint(
static_cast<int>(ch)) == 0) {
397 std::string
dumpAsHex(
const uint8_t* data,
size_t length);
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Implements a regular expression based string scrubber.
std::string scrub(const std::string &original)
Returns a scrubbed copy of a given string.
~StringSanitizer()
Destructor.
static const uint32_t MAX_DATA_SIZE
The maximum size for regex parameters.
StringSanitizer(const std::string &char_set, const std::string &char_replacement)
Constructor.
A Set of C++ Utilities for Manipulating Strings.
StringTokenError(const char *file, size_t line, const char *what)
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
void normalizeSlash(std::string &name)
Normalize Backslash.
char toUpper(char chr)
Uppercase Character.
char toLower(char chr)
Lowercase Character.
std::string format(const std::string &format, const std::vector< std::string > &args)
Apply Formatting.
std::string dumpAsHex(const uint8_t *data, size_t length)
Dumps a buffer of bytes as a string of hexadecimal digits.
void lowercase(std::string &text)
Lowercase String.
std::string getToken(std::istringstream &iss)
Returns one token from the given stringstream.
void decodeSeparatedHexString(const std::string &hex_string, const std::string &sep, std::vector< uint8_t > &binary)
Converts a string of separated hexadecimal digits into a vector.
void decodeFormattedHexString(const std::string &hex_string, std::vector< uint8_t > &binary)
Converts a formatted string of hexadecimal digits into a vector.
bool isPrintable(const std::string &content)
Check if a string is printable.
NumType tokenToNum(const std::string &num_token)
Converts a string token to an unsigned integer.
boost::shared_ptr< StringSanitizer > StringSanitizerPtr
Type representing the pointer to the StringSanitizer.
boost::shared_ptr< StringSanitizerImpl > StringSanitizerImplPtr
Type representing the pointer to the StringSanitizerImpl.
std::vector< uint8_t > quotedStringToBinary(const std::string "ed_string)
Converts a string in quotes into vector.
void decodeColonSeparatedHexString(const std::string &hex_string, std::vector< uint8_t > &binary)
Converts a string of hexadecimal digits with colons into a vector.
Iterator seekTrimmed(Iterator begin, Iterator end, uint8_t trim_val)
Finds the "trimmed" end of a buffer.
string trim(const string &instring)
Trim Leading and Trailing Spaces.
vector< string > tokens(const std::string &text, const std::string &delim, bool escape)
Split String into Tokens.
void uppercase(std::string &text)
Uppercase String.
Defines the logger used by the top-level component of kea-lfc.