File indexing completed on 2025-09-17 08:52:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_URL_GRAMMAR_OPTIONAL_RULE_HPP
0011 #define BOOST_URL_GRAMMAR_OPTIONAL_RULE_HPP
0012
0013 #include <boost/url/detail/config.hpp>
0014 #include <boost/url/optional.hpp>
0015 #include <boost/url/error_types.hpp>
0016 #include <boost/url/grammar/type_traits.hpp>
0017 #include <boost/core/empty_value.hpp>
0018 #include <boost/assert.hpp>
0019
0020 namespace boost {
0021 namespace urls {
0022 namespace grammar {
0023
0024 namespace implementation_defined {
0025 template<class Rule>
0026 struct optional_rule_t
0027 : private empty_value<Rule>
0028 {
0029 using value_type = boost::optional<
0030 typename Rule::value_type>;
0031
0032 system::result<value_type>
0033 parse(
0034 char const*& it,
0035 char const* end) const;
0036
0037 constexpr
0038 optional_rule_t(
0039 Rule const& r) noexcept
0040 : empty_value<Rule>(
0041 empty_init,
0042 r)
0043 {
0044 }
0045 };
0046 }
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084 template<BOOST_URL_CONSTRAINT(Rule) R>
0085 auto
0086 constexpr
0087 optional_rule(
0088 R const& r) ->
0089 implementation_defined::optional_rule_t<R>
0090 {
0091 BOOST_STATIC_ASSERT(grammar::is_rule<R>::value);
0092 return { r };
0093 }
0094
0095 }
0096 }
0097 }
0098
0099 #include <boost/url/grammar/impl/optional_rule.hpp>
0100
0101 #endif