Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:27

0001 //
0002 // Copyright (c) 2021 Vinnie Falco (vinnie dot falco at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/url
0008 //
0009 
0010 #ifndef BOOST_URL_GRAMMAR_DIGIT_CHARS_HPP
0011 #define BOOST_URL_GRAMMAR_DIGIT_CHARS_HPP
0012 
0013 #include <boost/url/detail/config.hpp>
0014 #include <boost/url/grammar/detail/charset.hpp>
0015 
0016 namespace boost {
0017 namespace urls {
0018 namespace grammar {
0019 
0020 /** The set of decimal digits
0021 
0022     @par Example
0023     Character sets are used with rules and the
0024     functions @ref find_if and @ref find_if_not.
0025     @code
0026     system::result< core::string_view > rv = parse( "2022", token_rule( digit_chars ) );
0027     @endcode
0028 
0029     @par BNF
0030     @code
0031     DIGIT       = %x30-39
0032                 ; 0-9
0033     @endcode
0034 
0035     @par Specification
0036     @li <a href="https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1"
0037         >B.1. Core Rules (rfc5234)</a>
0038 
0039     @see
0040         @ref find_if,
0041         @ref find_if_not,
0042         @ref parse,
0043         @ref token_rule.
0044 */
0045 #ifdef BOOST_URL_DOCS
0046 constexpr __implementation_defined__ digit_chars;
0047 #else
0048 struct digit_chars_t
0049 {
0050     constexpr
0051     bool
0052     operator()(char c) const noexcept
0053     {
0054         return c >= '0' && c <= '9';
0055     }
0056 
0057 #ifdef BOOST_URL_USE_SSE2
0058     char const*
0059     find_if(
0060         char const* first,
0061         char const* last) const noexcept
0062     {
0063         return detail::find_if_pred(
0064             *this, first, last);
0065     }
0066 
0067     char const*
0068     find_if_not(
0069         char const* first,
0070         char const* last) const noexcept
0071     {
0072         return detail::find_if_not_pred(
0073             *this, first, last);
0074     }
0075 #endif
0076 };
0077 
0078 constexpr digit_chars_t digit_chars{};
0079 #endif
0080 
0081 } // grammar
0082 } // urls
0083 } // boost
0084 
0085 #endif