![]() |
|
|||
File indexing completed on 2025-09-16 08:51:37
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 /** Match an unsigned decimal 0057 0058 Extra leading zeroes are disallowed. 0059 0060 @par Value Type 0061 @code 0062 using value_type = Unsigned; 0063 @endcode 0064 0065 @par Example 0066 Rules are used with the function @ref parse. 0067 @code 0068 system::result< unsigned short > rv = parse( "32767", unsigned_rule< unsigned short >{} ); 0069 @endcode 0070 0071 @par BNF 0072 @code 0073 unsigned = "0" / ( ["1"..."9"] *DIGIT ) 0074 @endcode 0075 0076 @tparam Unsigned The unsigned integer type used 0077 to store the result. 0078 0079 @see 0080 @ref grammar::parse. 0081 */ 0082 template<class Unsigned> 0083 struct unsigned_rule 0084 { 0085 BOOST_STATIC_ASSERT( 0086 std::numeric_limits< 0087 Unsigned>::is_integer && 0088 ! std::numeric_limits< 0089 Unsigned>::is_signed); 0090 0091 using value_type = Unsigned; 0092 0093 auto 0094 parse( 0095 char const*& it, 0096 char const* end 0097 ) const noexcept -> 0098 system::result<value_type>; 0099 }; 0100 #endif 0101 0102 } // grammar 0103 } // urls 0104 } // boost 0105 0106 #include <boost/url/grammar/impl/unsigned_rule.hpp> 0107 0108 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |