GCC Code Coverage Report


Directory: libs/url/
File: boost/url/grammar/impl/not_empty_rule.hpp
Date: 2024-09-08 09:46:49
Exec Total Coverage
Lines: 10 10 100.0%
Functions: 0 0 -%
Branches: 0 0 -%

Line Branch Exec Source
1 //
2 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/boostorg/url
8 //
9
10 #ifndef BOOST_URL_GRAMMAR_IMPL_NOT_EMPTY_RULE_HPP
11 #define BOOST_URL_GRAMMAR_IMPL_NOT_EMPTY_RULE_HPP
12
13 #include <boost/url/grammar/error.hpp>
14 #include <boost/url/grammar/parse.hpp>
15
16 namespace boost {
17 namespace urls {
18 namespace grammar {
19
20 namespace implementation_defined {
21 template<class R>
22 auto
23 8 not_empty_rule_t<R>::
24 parse(
25 char const*& it,
26 char const* end) const ->
27 system::result<value_type>
28 {
29 8 if(it == end)
30 {
31 // empty
32 1 BOOST_URL_RETURN_EC(
33 error::mismatch);
34 }
35 7 auto const it0 = it;
36 7 auto rv = r_.parse(it, end);
37 7 if( !rv )
38 {
39 // error
40 3 return rv;
41 }
42 4 if(it == it0)
43 {
44 // empty
45 1 BOOST_URL_RETURN_EC(
46 error::mismatch);
47 }
48 // value
49 3 return rv;
50 }
51 }
52
53 } // grammar
54 } // urls
55 } // boost
56
57 #endif
58