96.43% Lines (27/28)
100.00% Functions (1/1)
| TLA | Baseline | Branch | ||||||
|---|---|---|---|---|---|---|---|---|
| Line | Hits | Code | Line | Hits | Code | |||
| 1 | // | 1 | // | |||||
| 2 | // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) | 2 | // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) | |||||
| 3 | // Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) | 3 | // Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) | |||||
| 4 | // | 4 | // | |||||
| 5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | 5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |||||
| 6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | 6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |||||
| 7 | // | 7 | // | |||||
| 8 | // Official repository: https://github.com/boostorg/url | 8 | // Official repository: https://github.com/boostorg/url | |||||
| 9 | // | 9 | // | |||||
| 10 | 10 | |||||||
| 11 | #ifndef BOOST_URL_RFC_IMPL_ABSOLUTE_URI_RULE_HPP | 11 | #ifndef BOOST_URL_RFC_IMPL_ABSOLUTE_URI_RULE_HPP | |||||
| 12 | #define BOOST_URL_RFC_IMPL_ABSOLUTE_URI_RULE_HPP | 12 | #define BOOST_URL_RFC_IMPL_ABSOLUTE_URI_RULE_HPP | |||||
| 13 | 13 | |||||||
| 14 | #include <boost/url/detail/config.hpp> | 14 | #include <boost/url/detail/config.hpp> | |||||
| 15 | #include <boost/url/url_view.hpp> | 15 | #include <boost/url/url_view.hpp> | |||||
| 16 | #include <boost/url/grammar/delim_rule.hpp> | 16 | #include <boost/url/grammar/delim_rule.hpp> | |||||
| 17 | #include <boost/url/grammar/tuple_rule.hpp> | 17 | #include <boost/url/grammar/tuple_rule.hpp> | |||||
| 18 | #include <boost/url/grammar/optional_rule.hpp> | 18 | #include <boost/url/grammar/optional_rule.hpp> | |||||
| 19 | #include <boost/url/grammar/parse.hpp> | 19 | #include <boost/url/grammar/parse.hpp> | |||||
| 20 | #include <boost/url/rfc/detail/hier_part_rule.hpp> | 20 | #include <boost/url/rfc/detail/hier_part_rule.hpp> | |||||
| 21 | #include <boost/url/rfc/detail/query_part_rule.hpp> | 21 | #include <boost/url/rfc/detail/query_part_rule.hpp> | |||||
| 22 | #include <boost/url/rfc/detail/scheme_rule.hpp> | 22 | #include <boost/url/rfc/detail/scheme_rule.hpp> | |||||
| 23 | 23 | |||||||
| 24 | namespace boost { | 24 | namespace boost { | |||||
| 25 | namespace urls { | 25 | namespace urls { | |||||
| 26 | 26 | |||||||
| 27 | BOOST_URL_CXX20_CONSTEXPR_OR_INLINE | 27 | BOOST_URL_CXX20_CONSTEXPR_OR_INLINE | |||||
| 28 | auto | 28 | auto | |||||
| HITCBC | 29 | 29 | implementation_defined::absolute_uri_rule_t:: | 29 | 29 | implementation_defined::absolute_uri_rule_t:: | ||
| 30 | parse( | 30 | parse( | |||||
| 31 | char const*& it, | 31 | char const*& it, | |||||
| 32 | char const* const end | 32 | char const* const end | |||||
| 33 | ) const noexcept -> | 33 | ) const noexcept -> | |||||
| 34 | system::result<value_type> | 34 | system::result<value_type> | |||||
| 35 | { | 35 | { | |||||
| HITCBC | 36 | 29 | detail::url_impl u(detail::url_impl::from::string); | 36 | 29 | detail::url_impl u(detail::url_impl::from::string); | ||
| HITCBC | 37 | 29 | u.cs_ = it; | 37 | 29 | u.cs_ = it; | ||
| 38 | 38 | |||||||
| 39 | // scheme | 39 | // scheme | |||||
| 40 | { | 40 | { | |||||
| HITCBC | 41 | 29 | auto rv = grammar::parse( | 41 | 29 | auto rv = grammar::parse( | ||
| 42 | it, end, | 42 | it, end, | |||||
| HITCBC | 43 | 29 | grammar::tuple_rule( | 43 | 29 | grammar::tuple_rule( | ||
| HITCBC | 44 | 29 | detail::scheme_rule(), | 44 | 29 | detail::scheme_rule(), | ||
| HITCBC | 45 | 29 | grammar::squelch( | 45 | 29 | grammar::squelch( | ||
| HITCBC | 46 | 29 | grammar::delim_rule(':')))); | 46 | 29 | grammar::delim_rule(':')))); | ||
| HITCBC | 47 | 29 | if(! rv) | 47 | 29 | if(! rv) | ||
| HITCBC | 48 | 3 | return rv.error(); | 48 | 3 | return rv.error(); | ||
| HITCBC | 49 | 26 | u.apply_scheme(rv->scheme); | 49 | 26 | u.apply_scheme(rv->scheme); | ||
| 50 | } | 50 | } | |||||
| 51 | 51 | |||||||
| 52 | // hier_part | 52 | // hier_part | |||||
| 53 | { | 53 | { | |||||
| 54 | auto rv = grammar::parse( | 54 | auto rv = grammar::parse( | |||||
| HITCBC | 55 | 26 | it, end, detail::hier_part_rule); | 55 | 26 | it, end, detail::hier_part_rule); | ||
| HITCBC | 56 | 26 | if(! rv) | 56 | 26 | if(! rv) | ||
| HITCBC | 57 | 1 | return rv.error(); | 57 | 1 | return rv.error(); | ||
| HITCBC | 58 | 25 | if(rv->has_authority) | 58 | 25 | if(rv->has_authority) | ||
| HITCBC | 59 | 19 | u.apply_authority(rv->authority.u_); | 59 | 19 | u.apply_authority(rv->authority.u_); | ||
| HITCBC | 60 | 50 | u.apply_path( | 60 | 50 | u.apply_path( | ||
| HITCBC | 61 | 25 | rv->path, | 61 | 25 | rv->path, | ||
| HITCBC | 62 | 25 | rv->segment_count); | 62 | 25 | rv->segment_count); | ||
| HITCBC | 63 | 26 | } | 63 | 26 | } | ||
| 64 | 64 | |||||||
| 65 | // [ "?" query ] | 65 | // [ "?" query ] | |||||
| 66 | { | 66 | { | |||||
| HITCBC | 67 | 25 | auto rv = grammar::parse( | 67 | 25 | auto rv = grammar::parse( | ||
| 68 | it, end, detail::query_part_rule); | 68 | it, end, detail::query_part_rule); | |||||
| HITCBC | 69 | 25 | if(! rv) | 69 | 25 | if(! rv) | ||
| MISUBC | 70 | ✗ | return rv.error(); | 70 | ✗ | return rv.error(); | ||
| HITCBC | 71 | 25 | if(rv->has_query) | 71 | 25 | if(rv->has_query) | ||
| 72 | { | 72 | { | |||||
| 73 | // map "?" to { {} } | 73 | // map "?" to { {} } | |||||
| HITCBC | 74 | 26 | u.apply_query( | 74 | 26 | u.apply_query( | ||
| HITCBC | 75 | 13 | rv->query, | 75 | 13 | rv->query, | ||
| HITCBC | 76 | 13 | rv->count); | 76 | 13 | rv->count); | ||
| 77 | } | 77 | } | |||||
| 78 | } | 78 | } | |||||
| 79 | 79 | |||||||
| HITCBC | 80 | 25 | return url_view(u); | 80 | 25 | return url_view(u); | ||
| 81 | } | 81 | } | |||||
| 82 | 82 | |||||||
| 83 | } // urls | 83 | } // urls | |||||
| 84 | } // boost | 84 | } // boost | |||||
| 85 | 85 | |||||||
| 86 | 86 | |||||||
| 87 | #endif | 87 | #endif | |||||