28#ifndef WEBSOCKETPP_UTILITIES_HPP
29#define WEBSOCKETPP_UTILITIES_HPP
31#include <websocketpp/common/stdint.hpp>
48template<
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(),
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(),
136std::string
to_lower(std::string
const & in);
147 std::string
const & replace);
155std::string
to_hex(std::string
const & input);
164std::string
to_hex(uint8_t
const * input,
size_t length);
173std::string
to_hex(
char const * input,
size_t length);
178#include <websocketpp/impl/utilities_impl.hpp>
std::string to_hex(std::string const &input)
Convert std::string to ascii printed string of hex digits.
T::const_iterator ci_find_substr(T const &haystack, T const &needle, std::locale const &loc=std::locale())
Find substring (case insensitive)
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_lower(std::string const &in)
Convert a string to lowercase.
Namespace for the WebSocket++ project.
Helper less than functor for case insensitive find.
Helper functor for case insensitive find.
bool operator()(charT ch1, charT ch2)
Perform a case insensitive comparison.
my_equal(std::locale const &loc)
Construct the functor with the given locale.