LCOV - code coverage report
Current view: top level - boost/url/ignore_case.hpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 100.0 % 6 6
Test Date: 2024-07-10 02:48:26 Functions: 100.0 % 3 3

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.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/url
       8              : //
       9              : 
      10              : #ifndef BOOST_URL_IGNORE_CASE_HPP
      11              : #define BOOST_URL_IGNORE_CASE_HPP
      12              : 
      13              : #include <boost/url/detail/config.hpp>
      14              : 
      15              : namespace boost {
      16              : namespace urls {
      17              : 
      18              : #ifndef BOOST_URL_DOCS
      19              : struct ignore_case_t
      20              : {
      21              : };
      22              : #endif
      23              : 
      24              : /** Ignore case when comparing
      25              : 
      26              :     This value may be optionally passed to
      27              :     functions accepting a parameter of type
      28              :     @ref ignore_case_param to indicate that
      29              :     comparisons should be case-insensitive.
      30              : */
      31              : constexpr
      32              : #ifdef BOOST_URL_DOCS
      33              : __implementation_defined__
      34              : #else
      35              : ignore_case_t
      36              : #endif
      37              : ignore_case{};
      38              : 
      39              : /** An optional parameter to determine case-sensitivity
      40              : 
      41              :     Functions may use parameters of this type
      42              :     to allow the user to optionally indicate
      43              :     that comparisons should be case-insensitive
      44              :     when the value @ref ignore_case is passed.
      45              : */
      46              : class ignore_case_param
      47              : {
      48              :     /** True if an algorithm should ignore case
      49              : 
      50              :         Functions accepting a parameter of type
      51              :         `ignore_case_param` can check `value`
      52              :         to determine if the caller has indicated
      53              :         that comparisons should ignore case.
      54              :     */
      55              :     bool value_ = false;
      56              : 
      57              : public:
      58              :     /** Constructor
      59              : 
      60              :         By default, comparisons are
      61              :         case-sensitive.
      62              : 
      63              :         @par Example
      64              :         This function performs case-sensitive
      65              :         comparisons when called with no
      66              :         arguments:
      67              :         @code
      68              :         void f( ignore_case_param = {} );
      69              :         @endcode
      70              :     */
      71              :     constexpr
      72          101 :     ignore_case_param() noexcept = default;
      73              : 
      74              :     /** Constructor
      75              : 
      76              :         Construction from @ref ignore_case
      77              :         indicates that comparisons should
      78              :         be case-insensitive.
      79              : 
      80              :         @par Example
      81              :         When @ref ignore_case is passed as
      82              :         an argument, this function ignores
      83              :         case when performing comparisons:
      84              :         @code
      85              :         void f( ignore_case_param = {} );
      86              :         @endcode
      87              :     */
      88              :     constexpr
      89           54 :     ignore_case_param(
      90              :     #ifdef BOOST_URL_DOCS
      91              :         __implementation_defined__
      92              :     #else
      93              :         ignore_case_t
      94              :     #endif
      95              :         ) noexcept
      96           54 :         : value_(true)
      97              :     {
      98           54 :     }
      99              : 
     100              :     /** True if an algorithm should ignore case
     101              : 
     102              :         Values of type `ignore_case_param`
     103              :         evaluate to true when constructed
     104              :         with the constant @ref ignore_case.
     105              :         Otherwise, they are default-constructed
     106              :         and evaluate to `false`.
     107              :     */
     108          224 :     operator
     109              :     bool() const noexcept
     110              :     {
     111          224 :         return value_;
     112              :     }
     113              : };
     114              : 
     115              : } // urls
     116              : } // boost
     117              : 
     118              : #endif
        

Generated by: LCOV version 2.1