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;
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(),
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);
180 #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.
span_constexpr std::size_t size(span< T, Extent > const &spn)
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)