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_DIGIT_CHARS_HPP
11 : #define BOOST_URL_GRAMMAR_DIGIT_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 digit_chars_t
21 : {
22 : constexpr
23 : bool
24 14664 : operator()(char c) const noexcept
25 : {
26 14664 : return c >= '0' && c <= '9';
27 : }
28 :
29 : #ifdef BOOST_URL_USE_SSE2
30 : char const*
31 256 : find_if(
32 : char const* first,
33 : char const* last) const noexcept
34 : {
35 256 : return detail::find_if_pred(
36 256 : *this, first, last);
37 : }
38 :
39 : char const*
40 287 : find_if_not(
41 : char const* first,
42 : char const* last) const noexcept
43 : {
44 287 : return detail::find_if_not_pred(
45 287 : *this, first, last);
46 : }
47 : #endif
48 : };
49 : }
50 :
51 : /** The set of decimal digits
52 :
53 : @par Example
54 : Character sets are used with rules and the
55 : functions @ref find_if and @ref find_if_not.
56 : @code
57 : system::result< core::string_view > rv = parse( "2022", token_rule( digit_chars ) );
58 : @endcode
59 :
60 : @par BNF
61 : @code
62 : DIGIT = %x30-39
63 : ; 0-9
64 : @endcode
65 :
66 : @par Specification
67 : @li <a href="https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1"
68 : >B.1. Core Rules (rfc5234)</a>
69 :
70 : @see
71 : @ref find_if,
72 : @ref find_if_not,
73 : @ref parse,
74 : @ref token_rule.
75 : */
76 : constexpr implementation_defined::digit_chars_t digit_chars{};
77 :
78 : } // grammar
79 : } // urls
80 : } // boost
81 :
82 : #endif
|