28 #ifndef WEBSOCKETPP_UTILITIES_HPP
29 #define WEBSOCKETPP_UTILITIES_HPP
31 #include <websocketpp/common/stdint.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;
78 bool operator() (
unsigned char const & c1,
unsigned char const & c2)
const {
79 return tolower (c1) < tolower (c2);
82 bool operator() (std::string
const & s1, std::string
const & s2)
const {
83 return std::lexicographical_compare
84 (s1.begin (), s1.end (),
85 s2.begin (), s2.end (),
102 std::locale
const & loc = std::locale())
104 return std::search( haystack.begin(), haystack.end(),
105 needle.begin(), needle.end(),
my_equal<
typename T::value_type>(loc) );
124 typename T::value_type
const * needle,
typename T::size_type size,
125 std::locale
const & loc = std::locale())
127 return std::search( haystack.begin(), haystack.end(),
128 needle, needle+size,
my_equal<
typename T::value_type>(loc) );
136 std::string
to_lower(std::string
const & in);
147 std::string
const & replace);
155 std::string
to_hex(std::string
const & input);
164 std::string
to_hex(uint8_t
const * input, size_t length);
173 std::string
to_hex(
char const * input, size_t length);
178 #include <websocketpp/impl/utilities_impl.hpp>