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_NOT_EMPTY_RULE_HPP
0011 #define BOOST_URL_GRAMMAR_IMPL_NOT_EMPTY_RULE_HPP
0012 
0013 #include <boost/url/grammar/error.hpp>
0014 #include <boost/url/grammar/parse.hpp>
0015 
0016 namespace boost {
0017 namespace urls {
0018 namespace grammar {
0019 
0020 template<class R>
0021 auto
0022 not_empty_rule_t<R>::
0023 parse(
0024     char const*& it,
0025     char const* end) const ->
0026         system::result<value_type>
0027 {
0028     if(it == end)
0029     {
0030         // empty
0031         BOOST_URL_RETURN_EC(
0032             error::mismatch);
0033     }
0034     auto const it0 = it;
0035     auto rv = r_.parse(it, end);
0036     if(  !rv )
0037     {
0038         // error
0039         return rv;
0040     }
0041     if(it == it0)
0042     {
0043         // empty
0044         BOOST_URL_RETURN_EC(
0045             error::mismatch);
0046     }
0047     // value
0048     return rv;
0049 }
0050 
0051 } // grammar
0052 } // urls
0053 } // boost
0054 
0055 #endif