File indexing completed on 2025-01-18 09:53:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_URL_RFC_DETAIL_QUERY_PART_RULE_HPP
0011 #define BOOST_URL_RFC_DETAIL_QUERY_PART_RULE_HPP
0012
0013 #include <boost/url/detail/config.hpp>
0014 #include <boost/url/error_types.hpp>
0015 #include <boost/url/pct_string_view.hpp>
0016 #include <boost/url/rfc/query_rule.hpp>
0017 #include <boost/url/grammar/parse.hpp>
0018 #include <cstdlib>
0019
0020 namespace boost {
0021 namespace urls {
0022 namespace detail {
0023
0024
0025
0026
0027
0028
0029
0030
0031 struct query_part_rule_t
0032 {
0033 struct value_type
0034 {
0035 pct_string_view query;
0036 std::size_t count = 0;
0037 bool has_query = false;
0038 };
0039
0040 auto
0041 parse(
0042 char const*& it,
0043 char const* end
0044 ) const noexcept ->
0045 system::result<value_type>
0046 {
0047 if( it == end ||
0048 *it != '?')
0049 return {};
0050 ++it;
0051 auto rv = grammar::parse(
0052 it, end, query_rule);
0053 if(! rv)
0054 return rv.error();
0055 value_type t;
0056 t.query = rv->buffer();
0057 t.count = rv->size();
0058 t.has_query = true;
0059 return t;
0060 }
0061 };
0062
0063 constexpr query_part_rule_t query_part_rule{};
0064
0065 }
0066 }
0067 }
0068
0069 #endif