| Line | Branch | Exec | Source |
|---|---|---|---|
| 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 | namespace implementation_defined { | ||
| 20 | struct alpha_chars_t | ||
| 21 | { | ||
| 22 | constexpr | ||
| 23 | alpha_chars_t() noexcept = default; | ||
| 24 | |||
| 25 | constexpr | ||
| 26 | bool | ||
| 27 | 36041 | operator()(char c) const noexcept | |
| 28 | { | ||
| 29 | return | ||
| 30 |
6/6✓ Branch 0 taken 11603 times.
✓ Branch 1 taken 24438 times.
✓ Branch 2 taken 7873 times.
✓ Branch 3 taken 3730 times.
✓ Branch 4 taken 7193 times.
✓ Branch 5 taken 25118 times.
|
43234 | (c >= 'A' && c <= 'Z') || |
| 31 |
2/2✓ Branch 0 taken 6423 times.
✓ Branch 1 taken 770 times.
|
43234 | (c >= 'a' && c <= 'z'); |
| 32 | } | ||
| 33 | |||
| 34 | #ifdef BOOST_URL_USE_SSE2 | ||
| 35 | char const* | ||
| 36 | 256 | find_if( | |
| 37 | char const* first, | ||
| 38 | char const* last) const noexcept | ||
| 39 | { | ||
| 40 | 256 | return detail::find_if_pred( | |
| 41 | 256 | *this, first, last); | |
| 42 | } | ||
| 43 | |||
| 44 | char const* | ||
| 45 | 327 | find_if_not( | |
| 46 | char const* first, | ||
| 47 | char const* last) const noexcept | ||
| 48 | { | ||
| 49 | 327 | return detail::find_if_not_pred( | |
| 50 | 327 | *this, first, last); | |
| 51 | } | ||
| 52 | #endif | ||
| 53 | }; | ||
| 54 | } // implementation_defined | ||
| 55 | |||
| 56 | /** The set of all letters | ||
| 57 | |||
| 58 | @par Example | ||
| 59 | Character sets are used with rules and the | ||
| 60 | functions @ref find_if and @ref find_if_not. | ||
| 61 | @code | ||
| 62 | system::result< core::string_view > rv = parse( "JohnDoe", token_rule( alpha_chars ) ); | ||
| 63 | @endcode | ||
| 64 | |||
| 65 | @par BNF | ||
| 66 | @code | ||
| 67 | ALPHA = %x41-5A / %x61-7A | ||
| 68 | ; A-Z / a-z | ||
| 69 | @endcode | ||
| 70 | |||
| 71 | @par Specification | ||
| 72 | @li <a href="https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1" | ||
| 73 | >B.1. Core Rules (rfc5234)</a> | ||
| 74 | |||
| 75 | @see | ||
| 76 | @ref find_if, | ||
| 77 | @ref find_if_not, | ||
| 78 | @ref parse, | ||
| 79 | @ref token_rule. | ||
| 80 | */ | ||
| 81 | constexpr implementation_defined::alpha_chars_t alpha_chars{}; | ||
| 82 | |||
| 83 | } // grammar | ||
| 84 | } // urls | ||
| 85 | } // boost | ||
| 86 | |||
| 87 | #endif | ||
| 88 |