100.00% Lines (9/9) 100.00% Functions (1/1)
TLA Baseline Branch
Line Hits Code Line Hits Code
1   // 1   //
2   // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) 2   // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3   // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com) 3   // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
4   // 4   //
5   // Distributed under the Boost Software License, Version 1.0. (See accompanying 5   // Distributed under the Boost Software License, Version 1.0. (See accompanying
6   // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6   // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7   // 7   //
8   // Official repository: https://github.com/boostorg/url 8   // Official repository: https://github.com/boostorg/url
9   // 9   //
10   10  
11   #ifndef BOOST_URL_GRAMMAR_IMPL_OPTIONAL_RULE_HPP 11   #ifndef BOOST_URL_GRAMMAR_IMPL_OPTIONAL_RULE_HPP
12   #define BOOST_URL_GRAMMAR_IMPL_OPTIONAL_RULE_HPP 12   #define BOOST_URL_GRAMMAR_IMPL_OPTIONAL_RULE_HPP
13   13  
14   #include <boost/url/grammar/error.hpp> 14   #include <boost/url/grammar/error.hpp>
15   15  
16   namespace boost { 16   namespace boost {
17   namespace urls { 17   namespace urls {
18   namespace grammar { 18   namespace grammar {
19   19  
20   template<class R> 20   template<class R>
21   BOOST_URL_CXX14_CONSTEXPR 21   BOOST_URL_CXX14_CONSTEXPR
22   auto 22   auto
HITCBC 23   8923 implementation_defined::optional_rule_t<R>:: 23   8923 implementation_defined::optional_rule_t<R>::
24   parse( 24   parse(
25   char const*& it, 25   char const*& it,
26   char const* end) const -> 26   char const* end) const ->
27   system::result<value_type> 27   system::result<value_type>
28   { 28   {
HITCBC 29   8923 if(it == end) 29   8923 if(it == end)
HITCBC 30   259 return boost::none; 30   259 return boost::none;
HITCBC 31   8664 auto const it0 = it; 31   8664 auto const it0 = it;
32   auto rv = 32   auto rv =
HITCBC 33   8664 this->get().parse(it, end); 33   8664 this->get().parse(it, end);
HITCBC 34   8664 if(rv) 34   8664 if(rv)
HITCBC 35   1646 return value_type(*rv); 35   1646 return value_type(*rv);
HITCBC 36   7018 it = it0; 36   7018 it = it0;
HITCBC 37   7018 return boost::none; 37   7018 return boost::none;
38   } 38   }
39   39  
40   } // grammar 40   } // grammar
41   } // urls 41   } // urls
42   } // boost 42   } // boost
43   43  
44   #endif 44   #endif