GCC Code Coverage Report


Directory: libs/url/
File: boost/url/grammar/alnum_chars.hpp
Date: 2024-09-08 09:46:49
Exec Total Coverage
Lines: 10 10 100.0%
Functions: 3 3 100.0%
Branches: 12 12 100.0%

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_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 namespace implementation_defined {
54 struct alnum_chars_t
55 {
56 constexpr
57 bool
58 5496 operator()(char c) const noexcept
59 {
60 return
61
4/4
✓ Branch 0 taken 2018 times.
✓ Branch 1 taken 352 times.
✓ Branch 2 taken 1977 times.
✓ Branch 3 taken 3167 times.
5496 (c >= '0' && c <= '9') ||
62
6/6
✓ Branch 0 taken 2370 times.
✓ Branch 1 taken 3126 times.
✓ Branch 2 taken 1066 times.
✓ Branch 3 taken 911 times.
✓ Branch 4 taken 1036 times.
✓ Branch 5 taken 3197 times.
12028 (c >= 'A' && c <= 'Z') ||
63
2/2
✓ Branch 0 taken 1011 times.
✓ Branch 1 taken 25 times.
6532 (c >= 'a' && c <= 'z');
64 }
65
66 #ifdef BOOST_URL_USE_SSE2
67 char const*
68 256 find_if(
69 char const* first,
70 char const* last) const noexcept
71 {
72 256 return detail::find_if_pred(
73 256 *this, first, last);
74 }
75
76 char const*
77 269 find_if_not(
78 char const* first,
79 char const* last) const noexcept
80 {
81 269 return detail::find_if_not_pred(
82 269 *this, first, last);
83 }
84 #endif
85 };
86 } // implementation_defined
87
88 /** The set of letters and digits
89
90 @par Example
91 Character sets are used with rules and the
92 functions @ref find_if and @ref find_if_not.
93 @code
94 system::result< core::string_view > = parse( "Johnny42", token_rule( alnumchars ) );
95 @endcode
96
97 @par BNF
98 @code
99 ALNUM = ALPHA / DIGIT
100
101 ALPHA = %x41-5A / %x61-7A
102 ; A-Z / a-z
103
104 DIGIT = %x30-39
105 ; 0-9
106 @endcode
107
108 @par Specification
109 @li <a href="https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1"
110 >B.1. Core Rules (rfc5234)</a>
111
112 @see
113 @ref find_if,
114 @ref find_if_not,
115 @ref parse,
116 @ref token_rule.
117 */
118 constexpr implementation_defined::alnum_chars_t alnum_chars{};
119 #endif
120
121 } // grammar
122 } // urls
123 } // boost
124
125 #endif
126