28 #ifndef WEBSOCKETPP_UTILITIES_HPP 29 #define WEBSOCKETPP_UTILITIES_HPP 48 template<
typename charT>
54 my_equal(std::locale
const & loc ) : m_loc(loc) {}
64 return std::toupper(ch1, m_loc) == std::toupper(ch2, m_loc);
67 std::locale
const & m_loc;
75 struct ci_less : std::binary_function<std::string, std::string, bool> {
78 :
public std::binary_function<unsigned char,unsigned char,bool>
81 return tolower (c1) < tolower (c2);
84 bool operator() (std::string
const & s1, std::string
const & s2)
const {
85 return std::lexicographical_compare
86 (s1.begin (), s1.end (),
87 s2.begin (), s2.end (),
104 std::locale
const & loc = std::locale())
106 return std::search( haystack.begin(), haystack.end(),
126 typename T::value_type
const * needle,
typename T::size_type size,
127 std::locale
const & loc = std::locale())
129 return std::search( haystack.begin(), haystack.end(),
138 std::string
to_lower(std::string
const & in);
149 std::string
const & replace);
157 std::string
to_hex(std::string
const & input);
166 std::string
to_hex(uint8_t
const * input,
size_t length);
175 std::string
to_hex(
char const * input,
size_t length);
182 #endif // WEBSOCKETPP_UTILITIES_HPP std::string string_replace_all(std::string subject, std::string const &search, std::string const &replace)
Replace all occurrances of a substring with another.
std::string to_hex(std::string const &input)
Convert std::string to ascii printed string of hex digits.
bool operator()(charT ch1, charT ch2)
Perform a case insensitive comparison.
Namespace for the WebSocket++ project.
std::string to_lower(std::string const &in)
Convert a string to lowercase.
my_equal(std::locale const &loc)
Construct the functor with the given locale.
Helper functor for case insensitive find.
Helper less than functor for case insensitive find.
T::const_iterator ci_find_substr(T const &haystack, T const &needle, std::locale const &loc=std::locale())
Find substring (case insensitive)