LCOV - code coverage report
Current view: top level - boost/url/grammar - alnum_chars.hpp (source / functions) Hit Total Coverage
Test: coverage_filtered.info Lines: 10 10 100.0 %
Date: 2024-03-13 19:32:03 Functions: 3 3 100.0 %

          Line data    Source code
       1             : //
       2             : // Copyright (c) 2021 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/url
       8             : //
       9             : 
      10             : #ifndef BOOST_URL_GRAMMAR_ALNUM_CHARS_HPP
      11             : #define BOOST_URL_GRAMMAR_ALNUM_CHARS_HPP
      12             : 
      13             : #include <boost/url/detail/config.hpp>
      14             : #include <boost/url/grammar/detail/charset.hpp>
      15             : 
      16             : namespace boost {
      17             : namespace urls {
      18             : namespace grammar {
      19             : 
      20             : /** The set of letters and digits
      21             : 
      22             :     @par Example
      23             :     Character sets are used with rules and the
      24             :     functions @ref find_if and @ref find_if_not.
      25             :     @code
      26             :     system::result< core::string_view > = parse( "Johnny42", token_rule( alnumchars ) );
      27             :     @endcode
      28             : 
      29             :     @par BNF
      30             :     @code
      31             :     ALNUM       = ALPHA / DIGIT
      32             : 
      33             :     ALPHA       = %x41-5A / %x61-7A
      34             :                 ; A-Z / a-z
      35             : 
      36             :     DIGIT       = %x30-39
      37             :                 ; 0-9
      38             :     @endcode
      39             : 
      40             :     @par Specification
      41             :     @li <a href="https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1"
      42             :         >B.1. Core Rules (rfc5234)</a>
      43             : 
      44             :     @see
      45             :         @ref find_if,
      46             :         @ref find_if_not,
      47             :         @ref parse,
      48             :         @ref token_rule.
      49             : */
      50             : #ifdef BOOST_URL_DOCS
      51             : constexpr __implementation_defined__ alnum_chars;
      52             : #else
      53             : struct alnum_chars_t
      54             : {
      55             :     constexpr
      56             :     bool
      57        5496 :     operator()(char c) const noexcept
      58             :     {
      59             :         return
      60        5496 :             (c >= '0' && c <= '9') ||
      61       12028 :             (c >= 'A' && c <= 'Z') ||
      62        6532 :             (c >= 'a' && c <= 'z');
      63             :     }
      64             : 
      65             : #ifdef BOOST_URL_USE_SSE2
      66             :     char const*
      67         256 :     find_if(
      68             :         char const* first,
      69             :         char const* last) const noexcept
      70             :     {
      71         256 :         return detail::find_if_pred(
      72         256 :             *this, first, last);
      73             :     }
      74             : 
      75             :     char const*
      76         269 :     find_if_not(
      77             :         char const* first,
      78             :         char const* last) const noexcept
      79             :     {
      80         269 :         return detail::find_if_not_pred(
      81         269 :             *this, first, last);
      82             :     }
      83             : #endif
      84             : };
      85             : 
      86             : constexpr alnum_chars_t alnum_chars{};
      87             : #endif
      88             : 
      89             : } // grammar
      90             : } // urls
      91             : } // boost
      92             : 
      93             : #endif

Generated by: LCOV version 1.15