string.hpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. As of C++14, containers using this class as the `Compare` type will take part
  28. in heterogeneous lookup if the search term is implicitly convertible to
  29. @ref string_view.
  30. */
  31. struct iless
  32. {
  33. BOOST_BEAST_DECL
  34. bool
  35. operator()(
  36. string_view lhs,
  37. string_view rhs) const;
  38. using is_transparent = void;
  39. };
  40. /** A case-insensitive equality predicate for strings.
  41. The case-comparison operation is defined only for low-ASCII characters.
  42. As of C++14, containers using this class as the `Compare` type will take part
  43. in heterogeneous lookup if the search term is implicitly convertible to
  44. @ref string_view.
  45. */
  46. struct iequal
  47. {
  48. bool
  49. operator()(
  50. string_view lhs,
  51. string_view rhs) const
  52. {
  53. return iequals(lhs, rhs);
  54. }
  55. using is_transparent = void;
  56. };
  57. } // beast
  58. } // boost
  59. #ifdef BOOST_BEAST_HEADER_ONLY
  60. #include <boost/beast/core/impl/string.ipp>
  61. #endif
  62. #endif