LCOV - code coverage report
Current view: top level - boost/url/grammar - alpha_chars.hpp (source / functions) Hit Total Coverage
Test: coverage_filtered.info Lines: 9 9 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_ALPHA_CHARS_HPP
      11             : #define BOOST_URL_GRAMMAR_ALPHA_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 all letters
      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 > rv = parse( "JohnDoe", token_rule( alpha_chars ) );
      27             :     @endcode
      28             : 
      29             :     @par BNF
      30             :     @code
      31             :     ALPHA       = %x41-5A / %x61-7A
      32             :                 ; A-Z / a-z
      33             :     @endcode
      34             : 
      35             :     @par Specification
      36             :     @li <a href="https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1"
      37             :         >B.1. Core Rules (rfc5234)</a>
      38             : 
      39             :     @see
      40             :         @ref find_if,
      41             :         @ref find_if_not,
      42             :         @ref parse,
      43             :         @ref token_rule.
      44             : */
      45             : #ifdef BOOST_URL_DOCS
      46             : constexpr __implementation_defined__ alpha_chars;
      47             : #else
      48             : struct alpha_chars_t
      49             : {
      50             :     constexpr
      51             :     alpha_chars_t() noexcept = default;
      52             : 
      53             :     constexpr
      54             :     bool
      55       36010 :     operator()(char c) const noexcept
      56             :     {
      57             :         return
      58       43177 :             (c >= 'A' && c <= 'Z') ||
      59       43177 :             (c >= 'a' && c <= 'z');
      60             :     }
      61             : 
      62             : #ifdef BOOST_URL_USE_SSE2
      63             :     char const*
      64         256 :     find_if(
      65             :         char const* first,
      66             :         char const* last) const noexcept
      67             :     {
      68         256 :         return detail::find_if_pred(
      69         256 :             *this, first, last);
      70             :     }
      71             : 
      72             :     char const*
      73         325 :     find_if_not(
      74             :         char const* first,
      75             :         char const* last) const noexcept
      76             :     {
      77         325 :         return detail::find_if_not_pred(
      78         325 :             *this, first, last);
      79             :     }
      80             : #endif
      81             : };
      82             : 
      83             : /** A character set containing the alphabetical characters.
      84             : 
      85             :     @see
      86             :         @ref alpha_chars_t
      87             : */
      88             : constexpr alpha_chars_t alpha_chars{};
      89             : #endif
      90             : 
      91             : } // grammar
      92             : } // urls
      93             : } // boost
      94             : 
      95             : #endif

Generated by: LCOV version 1.15