GCC Code Coverage Report


Directory: libs/url/
File: boost/url/grammar/impl/not_empty_rule.hpp
Date: 2024-01-19 15:42:54
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 template<class R>
21 auto
22 8 not_empty_rule_t<R>::
23 parse(
24 char const*& it,
25 char const* end) const ->
26 system::result<value_type>
27 {
28 8 if(it == end)
29 {
30 // empty
31 1 BOOST_URL_RETURN_EC(
32 error::mismatch);
33 }
34 7 auto const it0 = it;
35 7 auto rv = r_.parse(it, end);
36 7 if( !rv )
37 {
38 // error
39 3 return rv;
40 }
41 4 if(it == it0)
42 {
43 // empty
44 1 BOOST_URL_RETURN_EC(
45 error::mismatch);
46 }
47 // value
48 3 return rv;
49 }
50
51 } // grammar
52 } // urls
53 } // boost
54
55 #endif
56