GCC Code Coverage Report


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