Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/url/ignore_case.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/url
0008 //
0009 
0010 #ifndef BOOST_URL_IGNORE_CASE_HPP
0011 #define BOOST_URL_IGNORE_CASE_HPP
0012 
0013 #include <boost/url/detail/config.hpp>
0014 
0015 namespace boost {
0016 namespace urls {
0017 
0018 namespace implementation_defined {
0019 struct ignore_case_t {};
0020 }
0021 
0022 /** Ignore case when comparing
0023 
0024     This value may be optionally passed to
0025     functions accepting a parameter of type
0026     @ref ignore_case_param to indicate that
0027     comparisons should be case-insensitive.
0028 */
0029 BOOST_INLINE_CONSTEXPR
0030 implementation_defined::ignore_case_t
0031 ignore_case{};
0032 
0033 /** An optional parameter to determine case-sensitivity
0034 
0035     Functions may use parameters of this type
0036     to allow the user to optionally indicate
0037     that comparisons should be case-insensitive
0038     when the value @ref ignore_case is passed.
0039 
0040     @see
0041         @ref params_ref
0042 */
0043 class ignore_case_param
0044 {
0045     /** True if an algorithm should ignore case
0046 
0047         Functions accepting a parameter of type
0048         `ignore_case_param` can check `value`
0049         to determine if the caller has indicated
0050         that comparisons should ignore case.
0051     */
0052     bool value_ = false;
0053 
0054 public:
0055     /** Constructor
0056 
0057         By default, comparisons are
0058         case-sensitive.
0059 
0060         @par Example
0061         This function performs case-sensitive
0062         comparisons when called with no
0063         arguments:
0064         @code
0065         void f( ignore_case_param = {} );
0066         @endcode
0067     */
0068     constexpr
0069     ignore_case_param() noexcept = default;
0070 
0071     /** Constructor
0072 
0073         Construction from @ref ignore_case
0074         indicates that comparisons should
0075         be case-insensitive.
0076 
0077         The first parameter to this function
0078         should be the variable
0079         @ref ignore_case.
0080 
0081         @par Example
0082         When @ref ignore_case is passed as
0083         an argument, this function ignores
0084         case when performing comparisons:
0085         @code
0086         void f( ignore_case_param(ignore_case) );
0087         @endcode
0088     */
0089     constexpr
0090     ignore_case_param(
0091         implementation_defined::ignore_case_t) noexcept
0092         : value_(true)
0093     {
0094     }
0095 
0096     /** True if an algorithm should ignore case
0097 
0098         Values of type `ignore_case_param`
0099         evaluate to true when constructed
0100         with the constant @ref ignore_case.
0101         Otherwise, they are default-constructed
0102         and evaluate to `false`.
0103 
0104         @return `true` if case should be ignored
0105     */
0106     operator
0107     bool() const noexcept
0108     {
0109         return value_;
0110     }
0111 };
0112 
0113 } // urls
0114 } // boost
0115 
0116 #endif