Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:27

0001 //
0002 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/url
0008 //
0009 
0010 #ifndef BOOST_URL_GRAMMAR_IMPL_PARSE_HPP
0011 #define BOOST_URL_GRAMMAR_IMPL_PARSE_HPP
0012 
0013 #include <boost/url/grammar/error.hpp>
0014 #include <boost/url/grammar/type_traits.hpp>
0015 
0016 namespace boost {
0017 namespace urls {
0018 namespace grammar {
0019 
0020 template<class R>
0021 BOOST_URL_NO_INLINE
0022 auto
0023 parse(
0024     char const*& it,
0025     char const* end,
0026     R const& r) ->
0027         system::result<typename R::value_type>
0028 {
0029     // If this goes off, it means the rule
0030     // passed in did not meet the requirements.
0031     // Please check the documentation.
0032     static_assert(
0033         is_rule<R>::value,
0034         "Rule requirements not met");
0035 
0036     return r.parse(it, end);
0037 }
0038 
0039 template<class R>
0040 BOOST_URL_NO_INLINE
0041 auto
0042 parse(
0043     core::string_view s,
0044     R const& r) ->
0045         system::result<typename R::value_type>
0046 {
0047     // If this goes off, it means the rule
0048     // passed in did not meet the requirements.
0049     // Please check the documentation.
0050     static_assert(
0051         is_rule<R>::value,
0052         "Rule requirements not met");
0053 
0054     auto it = s.data();
0055     auto const end = it + s.size();
0056     auto rv = r.parse(it, end);
0057     if( rv &&
0058         it != end)
0059         return error::leftover;
0060     return rv;
0061 }
0062 
0063 } // grammar
0064 } // urls
0065 } // boost
0066 
0067 #endif