WebSocket++
0.8.3-dev
C++ websocket client/server library
|
28 #ifndef WEBSOCKETPP_UTILITIES_HPP
29 #define WEBSOCKETPP_UTILITIES_HPP
31 #include <websocketpp/common/stdint.hpp>
48 template<
typename charT>
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 (),
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,
127 return std::search( haystack.begin(), haystack.end(),
128 needle, needle+size, my_equal<
typename T::value_type>(loc) );
178 #include <websocketpp/impl/utilities_impl.hpp>
std::string to_hex(uint8_t const *input, size_t length)
Convert byte array (uint8_t) to ascii printed string of hex digits.
Generic non-websocket specific utility functions and data structures.
Helper functor for case insensitive find.
my_equal(std::locale const &loc)
Construct the functor with the given locale.
std::string to_lower(std::string const &in)
Convert a string to lowercase.
T::const_iterator ci_find_substr(T const &haystack, typename T::value_type const *needle, typename T::size_type size, std::locale const &loc=std::locale())
Find substring (case insensitive)
static std::vector< int > const versions_supported(helper, helper+4)
Container that stores the list of protocol versions supported.
Helper less than functor for case insensitive find.
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.
T::const_iterator ci_find_substr(T const &haystack, T const &needle, std::locale const &loc=std::locale())
Find substring (case insensitive)
std::string to_hex(const char *input, size_t length)
Convert char array to ascii printed string of hex digits.