Back to home page

EIC code displayed by LXR

 
 

    


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

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_RFC_DETAIL_PORT_RULE_HPP
0011 #define BOOST_URL_RFC_DETAIL_PORT_RULE_HPP
0012 
0013 #include <boost/url/detail/config.hpp>
0014 #include <boost/url/error_types.hpp>
0015 #include <boost/core/detail/string_view.hpp>
0016 #include <cstdint>
0017 
0018 namespace boost {
0019 namespace urls {
0020 namespace detail {
0021 
0022 /** Rule for port
0023 
0024     @par BNF
0025     @code
0026     port          = *DIGIT
0027     @endcode
0028 
0029     @par Specification
0030     @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
0031         >3.2.2. Host (rfc3986)</a>
0032 
0033     @see
0034         @ref port_part_rule.
0035 */
0036 struct port_rule
0037 {
0038     struct value_type
0039     {
0040         core::string_view str;
0041         std::uint16_t number = 0;
0042         bool has_number = false;
0043     };
0044 
0045     system::result<value_type>
0046     parse(
0047         char const*& it,
0048         char const* end) const noexcept;
0049 };
0050 
0051 //------------------------------------------------
0052 
0053 /** Rule for port-part
0054 
0055     @par BNF
0056     @code
0057     port-part       = [ ":" port ]
0058 
0059     port            = *DIGIT
0060     @endcode
0061 
0062     @par Specification
0063     @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
0064         >3.2.2. Host (rfc3986)</a>
0065 
0066     @see
0067         @ref port_rule.
0068 */
0069 struct port_part_rule_t
0070 {
0071     struct value_type
0072     {
0073         bool has_port = false;
0074         core::string_view port;
0075         bool has_number = false;
0076         std::uint16_t port_number = 0;
0077     };
0078 
0079     auto
0080     parse(
0081         char const*& it,
0082         char const* end
0083             ) const noexcept ->
0084         system::result<value_type>;
0085 };
0086 
0087 constexpr port_part_rule_t port_part_rule{};
0088 
0089 } // detail
0090 } // urls
0091 } // boost
0092 
0093 #endif