diff --git a/CHANGELOG.md b/CHANGELOG.md index c83deea0..e6a2adf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Version 61: + +* Remove Spirit dependency + +-------------------------------------------------------------------------------- + Version 60: * String comparisons are public interfaces diff --git a/include/beast/core/string.hpp b/include/beast/core/string.hpp index ca265de1..dc8915b5 100644 --- a/include/beast/core/string.hpp +++ b/include/beast/core/string.hpp @@ -8,8 +8,8 @@ #ifndef BEAST_STRING_HPP #define BEAST_STRING_HPP -#include #include +#include namespace beast { @@ -23,6 +23,15 @@ using basic_string_view = namespace detail { +inline +char +ascii_tolower(char c) +{ + if(c >= 'A' && c <= 'Z') + c += 'a' - 'A'; + return c; +} + template bool iequals( @@ -34,9 +43,8 @@ iequals( return false; auto p1 = lhs.data(); auto p2 = rhs.data(); - using namespace boost::spirit::char_encoding; while(n--) - if(ascii::tolower(*p1) != ascii::tolower(*p2)) + if(ascii_tolower(*p1) != ascii_tolower(*p2)) return false; return true; } @@ -73,12 +81,11 @@ struct iless { using std::begin; using std::end; - using namespace boost::spirit::char_encoding; return std::lexicographical_compare( begin(lhs), end(lhs), begin(rhs), end(rhs), [](char lhs, char rhs) { - return ascii::tolower(lhs) < ascii::tolower(rhs); + return detail::ascii_tolower(lhs) < detail::ascii_tolower(rhs); } ); }