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_OPTIONAL_RULE_HPP
0011 #define BOOST_URL_GRAMMAR_IMPL_OPTIONAL_RULE_HPP
0012 
0013 #include <boost/url/grammar/error.hpp>
0014 
0015 namespace boost {
0016 namespace urls {
0017 namespace grammar {
0018 
0019 template<class R>
0020 auto
0021 optional_rule_t<R>::
0022 parse(
0023     char const*& it,
0024     char const* end) const ->
0025         system::result<value_type>
0026 {
0027     if(it == end)
0028         return boost::none;
0029     auto const it0 = it;
0030     auto rv =
0031         this->get().parse(it, end);
0032     if(rv)
0033         return value_type(*rv);
0034     it = it0;
0035     return boost::none;
0036 }
0037 
0038 } // grammar
0039 } // urls
0040 } // boost
0041 
0042 #endif