GCC Code Coverage Report


Directory: libs/url/
File: libs/url/src/rfc/uri_reference_rule.cpp
Date: 2024-01-19 15:42:54
Exec Total Coverage
Lines: 10 10 100.0%
Functions: 1 1 100.0%
Branches: 4 4 100.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_RFC_IMPL_URI_REFERENCE_RULE_IPP
11 #define BOOST_URL_RFC_IMPL_URI_REFERENCE_RULE_IPP
12
13 #include <boost/url/detail/config.hpp>
14 #include <boost/url/rfc/uri_reference_rule.hpp>
15 #include <boost/url/rfc/uri_rule.hpp>
16 #include <boost/url/rfc/relative_ref_rule.hpp>
17 #include <boost/url/grammar/parse.hpp>
18 #include <boost/url/grammar/variant_rule.hpp>
19 #include <boost/variant2/variant.hpp>
20
21 namespace boost {
22 namespace urls {
23
24 auto
25 2485 uri_reference_rule_t::
26 parse(
27 char const*& it,
28 char const* const end
29 ) const noexcept ->
30 system::result<value_type>
31 {
32 auto rv = grammar::parse(
33 it, end,
34 2485 grammar::variant_rule(
35 uri_rule,
36 2485 relative_ref_rule));
37
2/2
✓ Branch 1 taken 41 times.
✓ Branch 2 taken 2444 times.
2485 if(! rv)
38 41 return rv.error();
39
2/2
✓ Branch 2 taken 1293 times.
✓ Branch 3 taken 1151 times.
2444 switch(rv->index())
40 {
41 1293 default:
42 case 0:
43 1293 return boost::variant2::get<0>(*rv);
44 1151 case 1:
45 1151 return boost::variant2::get<1>(*rv);
46 }
47 }
48
49 } // urls
50 } // boost
51
52 #endif
53