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 
10 #ifndef BOOST_BEAST_STRING_HPP
11 #define BOOST_BEAST_STRING_HPP
12 
13 #include <boost/beast/core/detail/config.hpp>
14 #include <boost/beast/core/string_type.hpp>
15 
16 namespace boost {
17 namespace beast {
18 
19 /** Returns `true` if two strings are equal, using a case-insensitive comparison.
20 
21     The case-comparison operation is defined only for low-ASCII characters.
22 
23     @param lhs The string on the left side of the equality
24 
25     @param rhs The string on the right side of the equality
26 */
27 BOOST_BEAST_DECL
28 bool
29 iequals(
30     beast::string_view lhs,
31     beast::string_view rhs);
32 
33 /** A case-insensitive less predicate for strings.
34 
35     The case-comparison operation is defined only for low-ASCII characters.
36 
37     As of C++14, containers using this class as the `Compare` type will take part
38     in heterogeneous lookup if the search term is implicitly convertible to
39     @ref string_view.
40 */
41 struct iless
42 {
43     BOOST_BEAST_DECL
44     bool
45     operator()(
46         string_view lhs,
47         string_view rhs) const;
48 
49     using is_transparent = void;
50 };
51 
52 /** A case-insensitive equality predicate for strings.
53 
54     The case-comparison operation is defined only for low-ASCII characters.
55 
56     As of C++14, containers using this class as the `Compare` type will take part
57     in heterogeneous lookup if the search term is implicitly convertible to
58     @ref string_view.
59 */
60 struct iequal
61 {
62     bool
operator ()boost::beast::iequal63     operator()(
64         string_view lhs,
65         string_view rhs) const
66     {
67         return iequals(lhs, rhs);
68     }
69 
70     using is_transparent = void;
71 };
72 
73 } // beast
74 } // boost
75 
76 #ifdef BOOST_BEAST_HEADER_ONLY
77 #include <boost/beast/core/impl/string.ipp>
78 #endif
79 
80 #endif
81