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 | 2469 | 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 | 2469 | grammar::variant_rule( | |
35 | uri_rule, | ||
36 | 2469 | relative_ref_rule)); | |
37 |
2/2✓ Branch 1 taken 41 times.
✓ Branch 2 taken 2428 times.
|
2469 | if(! rv) |
38 | 41 | return rv.error(); | |
39 |
2/2✓ Branch 2 taken 1285 times.
✓ Branch 3 taken 1143 times.
|
2428 | switch(rv->index()) |
40 | { | ||
41 | 1285 | default: | |
42 | case 0: | ||
43 | 1285 | return boost::variant2::get<0>(*rv); | |
44 | 1143 | case 1: | |
45 | 1143 | return boost::variant2::get<1>(*rv); | |
46 | } | ||
47 | } | ||
48 | |||
49 | } // urls | ||
50 | } // boost | ||
51 | |||
52 | #endif | ||
53 |