GCC Code Coverage Report


Directory: libs/url/
File: boost/url/grammar/vchars.hpp
Date: 2024-09-08 09:46:49
Exec Total Coverage
Lines: 5 5 100.0%
Functions: 2 2 100.0%
Branches: 2 4 50.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_VCHARS_HPP
11 #define BOOST_URL_GRAMMAR_VCHARS_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 visible characters
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( vchars ) );
27 @endcode
28
29 @par BNF
30 @code
31 VCHAR = 0x21-0x7E
32 ; visible (printing) characters
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__ vchars;
47 #else
48 namespace implementation_defined {
49 struct vchars_t
50 {
51 constexpr
52 bool
53 7 operator()(char c) const noexcept
54 {
55
2/4
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
7 return c >= 0x21 && c <= 0x7e;
56 }
57
58 #ifdef BOOST_URL_USE_SSE2
59 char const*
60 find_if(
61 char const* first,
62 char const* last) const noexcept
63 {
64 return detail::find_if_pred(
65 *this, first, last);
66 }
67
68 char const*
69 1 find_if_not(
70 char const* first,
71 char const* last) const noexcept
72 {
73 1 return detail::find_if_not_pred(
74 1 *this, first, last);
75 }
76 #endif
77 };
78 } // implementation_defined
79
80 /** The set of visible characters
81
82 @par Example
83 Character sets are used with rules and the
84 functions @ref find_if and @ref find_if_not.
85 @code
86 system::result< core::string_view > rv = parse( "JohnDoe", token_rule( vchars ) );
87 @endcode
88
89 @par BNF
90 @code
91 VCHAR = 0x21-0x7E
92 ; visible (printing) characters
93 @endcode
94
95 @par Specification
96 @li <a href="https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1"
97 >B.1. Core Rules (rfc5234)</a>
98
99 @see
100 @ref find_if,
101 @ref find_if_not,
102 @ref parse,
103 @ref token_rule.
104 */
105 constexpr implementation_defined::vchars_t vchars{};
106 #endif
107
108 } // grammar
109 } // urls
110 } // boost
111
112 #endif
113