File indexing completed on 2025-01-30 10:02:03
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/core/empty_value.hpp>
0017 #include <boost/assert.hpp>
0018
0019 namespace boost {
0020 namespace urls {
0021 namespace grammar {
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 #ifdef BOOST_URL_DOCS
0059 template<class Rule>
0060 constexpr
0061 __implementation_defined__
0062 optional_rule( Rule r ) noexcept;
0063 #else
0064 template<class Rule>
0065 struct optional_rule_t
0066 : private empty_value<Rule>
0067 {
0068 using value_type = boost::optional<
0069 typename Rule::value_type>;
0070
0071 system::result<value_type>
0072 parse(
0073 char const*& it,
0074 char const* end) const;
0075
0076 template<class R_>
0077 friend
0078 constexpr
0079 auto
0080 optional_rule(
0081 R_ const& r) ->
0082 optional_rule_t<R_>;
0083
0084 private:
0085 constexpr
0086 optional_rule_t(
0087 Rule const& r) noexcept
0088 : empty_value<Rule>(
0089 empty_init,
0090 r)
0091 {
0092 }
0093 };
0094
0095 template<class Rule>
0096 auto
0097 constexpr
0098 optional_rule(
0099 Rule const& r) ->
0100 optional_rule_t<Rule>
0101 {
0102 return { r };
0103 }
0104 #endif
0105
0106 }
0107 }
0108 }
0109
0110 #include <boost/url/grammar/impl/optional_rule.hpp>
0111
0112 #endif