string.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/beast
  8. //
  9. #ifndef BOOST_BEAST_STRING_HPP
  10. #define BOOST_BEAST_STRING_HPP
  11. #include <boost/beast/core/detail/config.hpp>
  12. #include <boost/beast/core/string_type.hpp>
  13. namespace boost {
  14. namespace beast {
  15. /** Returns `true` if two strings are equal, using a case-insensitive comparison.
  16. The case-comparison operation is defined only for low-ASCII characters.
  17. @param lhs The string on the left side of the equality
  18. @param rhs The string on the right side of the equality
  19. */
  20. BOOST_BEAST_DECL
  21. bool
  22. iequals(
  23. beast::string_view lhs,
  24. beast::string_view rhs);
  25. /** A case-insensitive less predicate for strings.
  26. The case-comparison operation is defined only for low-ASCII characters.
  27. */
  28. struct iless
  29. {
  30. BOOST_BEAST_DECL
  31. bool
  32. operator()(
  33. string_view lhs,
  34. string_view rhs) const;
  35. };
  36. /** A case-insensitive equality predicate for strings.
  37. The case-comparison operation is defined only for low-ASCII characters.
  38. */
  39. struct iequal
  40. {
  41. bool
  42. operator()(
  43. string_view lhs,
  44. string_view rhs) const
  45. {
  46. return iequals(lhs, rhs);
  47. }
  48. };
  49. } // beast
  50. } // boost
  51. #ifdef BOOST_BEAST_HEADER_ONLY
  52. #include <boost/beast/core/impl/string.ipp>
  53. #endif
  54. #endif