| 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 | |||
| 11 | #include <boost/url/detail/config.hpp> | ||
| 12 | #include <boost/url/rfc/relative_ref_rule.hpp> | ||
| 13 | #include <boost/url/rfc/query_rule.hpp> | ||
| 14 | #include "detail/fragment_part_rule.hpp" | ||
| 15 | #include "detail/query_part_rule.hpp" | ||
| 16 | #include "detail/relative_part_rule.hpp" | ||
| 17 | #include <boost/url/grammar/delim_rule.hpp> | ||
| 18 | #include <boost/url/grammar/tuple_rule.hpp> | ||
| 19 | #include <boost/url/grammar/optional_rule.hpp> | ||
| 20 | #include <boost/url/grammar/parse.hpp> | ||
| 21 | |||
| 22 | namespace boost { | ||
| 23 | namespace urls { | ||
| 24 | |||
| 25 | auto | ||
| 26 | 1340 | implementation_defined::relative_ref_rule_t:: | |
| 27 | parse( | ||
| 28 | char const*& it, | ||
| 29 | char const* const end | ||
| 30 | ) const noexcept -> | ||
| 31 | system::result<value_type> | ||
| 32 | { | ||
| 33 | 1340 | detail::url_impl u(detail::url_impl::from::string); | |
| 34 | 1340 | u.cs_ = it; | |
| 35 | |||
| 36 | // relative-part | ||
| 37 | { | ||
| 38 | auto rv = grammar::parse( | ||
| 39 | it, end, | ||
| 40 | 1340 | detail::relative_part_rule); | |
| 41 |
2/2✓ Branch 1 taken 42 times.
✓ Branch 2 taken 1298 times.
|
1340 | if(! rv) |
| 42 | 42 | return rv.error(); | |
| 43 |
2/2✓ Branch 1 taken 243 times.
✓ Branch 2 taken 1055 times.
|
1298 | if(rv->has_authority) |
| 44 | 243 | u.apply_authority(rv->authority); | |
| 45 | 1298 | u.apply_path( | |
| 46 | 1298 | rv->path, rv->segment_count); | |
| 47 |
2/2✓ Branch 1 taken 1298 times.
✓ Branch 2 taken 42 times.
|
1340 | } |
| 48 | |||
| 49 | // [ "?" query ] | ||
| 50 | { | ||
| 51 | 1298 | auto rv = grammar::parse( | |
| 52 | it, end, detail::query_part_rule); | ||
| 53 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1298 times.
|
1298 | if(! rv) |
| 54 | ✗ | return rv.error(); | |
| 55 |
2/2✓ Branch 1 taken 219 times.
✓ Branch 2 taken 1079 times.
|
1298 | if(rv->has_query) |
| 56 | { | ||
| 57 | // map "?" to { {} } | ||
| 58 | 219 | u.apply_query( | |
| 59 | 219 | rv->query, | |
| 60 | 219 | rv->count + | |
| 61 | 219 | rv->query.empty()); | |
| 62 | } | ||
| 63 | } | ||
| 64 | |||
| 65 | // [ "#" fragment ] | ||
| 66 | { | ||
| 67 | 1298 | auto rv = grammar::parse( | |
| 68 | it, end, detail::fragment_part_rule); | ||
| 69 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1297 times.
|
1298 | if(! rv) |
| 70 | 1 | return rv.error(); | |
| 71 |
2/2✓ Branch 1 taken 59 times.
✓ Branch 2 taken 1238 times.
|
1297 | if(rv->has_fragment) |
| 72 | 59 | u.apply_frag(rv->fragment); | |
| 73 | } | ||
| 74 | |||
| 75 | 1297 | return u.construct(); | |
| 76 | } | ||
| 77 | |||
| 78 | } // urls | ||
| 79 | } // boost | ||
| 80 | |||
| 81 |