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 // Copyright (c) 2022 Alan de Freitas (alandefreitas at gmail dot com)
0004 //
0005 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0006 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // Official repository: https://github.com/boostorg/url
0009 //
0010 
0011 #ifndef BOOST_URL_GRAMMAR_UNSIGNED_RULE_HPP
0012 #define BOOST_URL_GRAMMAR_UNSIGNED_RULE_HPP
0013 
0014 #include <boost/url/detail/config.hpp>
0015 #include <boost/url/error_types.hpp>
0016 #include <boost/url/grammar/charset.hpp>
0017 #include <boost/core/detail/string_view.hpp>
0018 #include <boost/static_assert.hpp>
0019 #include <limits>
0020 #include <type_traits>
0021 
0022 namespace boost {
0023 namespace urls {
0024 namespace grammar {
0025 
0026 /** Match an unsigned decimal
0027 
0028     Extra leading zeroes are disallowed.
0029 
0030     @par Value Type
0031     @code
0032     using value_type = Unsigned;
0033     @endcode
0034 
0035     @par Example
0036     Rules are used with the function @ref parse.
0037     @code
0038     system::result< unsigned short > rv = parse( "32767", unsigned_rule< unsigned short >{} );
0039     @endcode
0040 
0041     @par BNF
0042     @code
0043     unsigned      = "0" / ( ["1"..."9"] *DIGIT )
0044     @endcode
0045 
0046     @tparam Unsigned The unsigned integer type used
0047     to store the result.
0048 
0049     @see
0050         @ref grammar::parse.
0051 */
0052 #ifdef BOOST_URL_DOCS
0053 template<class Unsigned>
0054 struct unsigned_rule;
0055 #else
0056 template<class Unsigned>
0057 struct unsigned_rule
0058 {
0059     BOOST_STATIC_ASSERT(
0060         std::numeric_limits<
0061             Unsigned>::is_integer &&
0062         ! std::numeric_limits<
0063             Unsigned>::is_signed);
0064 
0065     using value_type = Unsigned;
0066 
0067     auto
0068     parse(
0069         char const*& it,
0070         char const* end
0071             ) const noexcept ->
0072         system::result<value_type>;
0073 };
0074 #endif
0075 
0076 } // grammar
0077 } // urls
0078 } // boost
0079 
0080 #include <boost/url/grammar/impl/unsigned_rule.hpp>
0081 
0082 #endif