Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:51:36

0001 //
0002 // Copyright (c) 2016-2019 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_DEC_OCTET_RULE_HPP
0011 #define BOOST_URL_GRAMMAR_DEC_OCTET_RULE_HPP
0012 
0013 #include <boost/url/detail/config.hpp>
0014 #include <boost/url/error_types.hpp>
0015 
0016 namespace boost {
0017 namespace urls {
0018 namespace grammar {
0019 
0020 /** Match a decimal octet
0021 
0022     A decimal octet is precise way of
0023     saying a number from 0 to 255. These
0024     are commonly used in IPv4 addresses.
0025 
0026     @par Value Type
0027     @code
0028     using value_type = unsigned char;
0029     @endcode
0030 
0031     @par Example
0032     Rules are used with the function @ref parse.
0033     @code
0034     system::result< unsigned char > rv = parse( "255", dec_octet_rule );
0035     @endcode
0036 
0037     @par BNF
0038     @code
0039     dec-octet   = DIGIT                 ; 0-9
0040                 / %x31-39 DIGIT         ; 10-99
0041                 / "1" 2DIGIT            ; 100-199
0042                 / "2" %x30-34 DIGIT     ; 200-249
0043                 / "25" %x30-35          ; 250-255
0044     @endcode
0045 
0046     @par Specification
0047     @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
0048         >3.2.2.  Host (rfc3986)</a>
0049 
0050     @see
0051         @ref parse.
0052 */
0053 #ifdef BOOST_URL_DOCS
0054 constexpr __implementation_defined__ dec_octet_rule;
0055 #else
0056 namespace implementation_defined {
0057 struct dec_octet_rule_t
0058 {
0059     using value_type = unsigned char;
0060 
0061     BOOST_URL_DECL
0062     auto
0063     parse(
0064         char const*& it,
0065         char const* end
0066             ) const noexcept ->
0067         system::result<value_type>;
0068 };
0069 }
0070 
0071 /** Match a decimal octet
0072 
0073     A decimal octet is precise way of
0074     saying a number from 0 to 255. These
0075     are commonly used in IPv4 addresses.
0076 
0077     @par Value Type
0078     @code
0079     using value_type = unsigned char;
0080     @endcode
0081 
0082     @par Example
0083     Rules are used with the function @ref parse.
0084     @code
0085     system::result< unsigned char > rv = parse( "255", dec_octet_rule );
0086     @endcode
0087 
0088     @par BNF
0089     @code
0090     dec-octet   = DIGIT                 ; 0-9
0091                 / %x31-39 DIGIT         ; 10-99
0092                 / "1" 2DIGIT            ; 100-199
0093                 / "2" %x30-34 DIGIT     ; 200-249
0094                 / "25" %x30-35          ; 250-255
0095     @endcode
0096 
0097     @par Specification
0098     @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
0099         >3.2.2.  Host (rfc3986)</a>
0100 
0101     @see
0102         @ref parse.
0103 */
0104 constexpr implementation_defined::dec_octet_rule_t dec_octet_rule{};
0105 #endif
0106 
0107 } // grammar
0108 } // urls
0109 } // boost
0110 
0111 #endif