mirror of
https://github.com/boostorg/beast.git
synced 2025-08-01 05:44:38 +02:00
Remove Spirit dependency
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
Version 61:
|
||||||
|
|
||||||
|
* Remove Spirit dependency
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
Version 60:
|
Version 60:
|
||||||
|
|
||||||
* String comparisons are public interfaces
|
* String comparisons are public interfaces
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
#ifndef BEAST_STRING_HPP
|
#ifndef BEAST_STRING_HPP
|
||||||
#define BEAST_STRING_HPP
|
#define BEAST_STRING_HPP
|
||||||
|
|
||||||
#include <boost/spirit/home/support/char_encoding/ascii.hpp>
|
|
||||||
#include <boost/utility/string_ref.hpp>
|
#include <boost/utility/string_ref.hpp>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
@@ -23,6 +23,15 @@ using basic_string_view =
|
|||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
|
inline
|
||||||
|
char
|
||||||
|
ascii_tolower(char c)
|
||||||
|
{
|
||||||
|
if(c >= 'A' && c <= 'Z')
|
||||||
|
c += 'a' - 'A';
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
template<class = void>
|
template<class = void>
|
||||||
bool
|
bool
|
||||||
iequals(
|
iequals(
|
||||||
@@ -34,9 +43,8 @@ iequals(
|
|||||||
return false;
|
return false;
|
||||||
auto p1 = lhs.data();
|
auto p1 = lhs.data();
|
||||||
auto p2 = rhs.data();
|
auto p2 = rhs.data();
|
||||||
using namespace boost::spirit::char_encoding;
|
|
||||||
while(n--)
|
while(n--)
|
||||||
if(ascii::tolower(*p1) != ascii::tolower(*p2))
|
if(ascii_tolower(*p1) != ascii_tolower(*p2))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -73,12 +81,11 @@ struct iless
|
|||||||
{
|
{
|
||||||
using std::begin;
|
using std::begin;
|
||||||
using std::end;
|
using std::end;
|
||||||
using namespace boost::spirit::char_encoding;
|
|
||||||
return std::lexicographical_compare(
|
return std::lexicographical_compare(
|
||||||
begin(lhs), end(lhs), begin(rhs), end(rhs),
|
begin(lhs), end(lhs), begin(rhs), end(rhs),
|
||||||
[](char lhs, char rhs)
|
[](char lhs, char rhs)
|
||||||
{
|
{
|
||||||
return ascii::tolower(lhs) < ascii::tolower(rhs);
|
return detail::ascii_tolower(lhs) < detail::ascii_tolower(rhs);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user