100.00% Lines (10/10)
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_URI_REFERENCE_RULE_HPP | 11 | #ifndef BOOST_URL_RFC_IMPL_URI_REFERENCE_RULE_HPP | |||||
| 12 | #define BOOST_URL_RFC_IMPL_URI_REFERENCE_RULE_HPP | 12 | #define BOOST_URL_RFC_IMPL_URI_REFERENCE_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/rfc/uri_rule.hpp> | 16 | #include <boost/url/rfc/uri_rule.hpp> | |||||
| 17 | #include <boost/url/rfc/relative_ref_rule.hpp> | 17 | #include <boost/url/rfc/relative_ref_rule.hpp> | |||||
| 18 | #include <boost/url/grammar/error.hpp> | 18 | #include <boost/url/grammar/error.hpp> | |||||
| 19 | #include <boost/url/grammar/parse.hpp> | 19 | #include <boost/url/grammar/parse.hpp> | |||||
| 20 | 20 | |||||||
| 21 | namespace boost { | 21 | namespace boost { | |||||
| 22 | namespace urls { | 22 | namespace urls { | |||||
| 23 | 23 | |||||||
| 24 | BOOST_URL_CXX20_CONSTEXPR_OR_INLINE | 24 | BOOST_URL_CXX20_CONSTEXPR_OR_INLINE | |||||
| 25 | auto | 25 | auto | |||||
| HITCBC | 26 | 12773 | implementation_defined::uri_reference_rule_t:: | 26 | 12777 | implementation_defined::uri_reference_rule_t:: | ||
| 27 | parse( | 27 | parse( | |||||
| 28 | char const*& it, | 28 | char const*& it, | |||||
| 29 | char const* const end | 29 | char const* const end | |||||
| 30 | ) const noexcept -> | 30 | ) const noexcept -> | |||||
| 31 | system::result<value_type> | 31 | system::result<value_type> | |||||
| 32 | { | 32 | { | |||||
| 33 | // Try URI first, then relative-ref. | 33 | // Try URI first, then relative-ref. | |||||
| 34 | // Use separate variables for each parse attempt | 34 | // Use separate variables for each parse attempt | |||||
| 35 | // to avoid variant2 cross-alternative reassignment, | 35 | // to avoid variant2 cross-alternative reassignment, | |||||
| 36 | // which uses placement new (not constexpr before C++26). | 36 | // which uses placement new (not constexpr before C++26). | |||||
| HITCBC | 37 | 12773 | auto const it0 = it; | 37 | 12777 | auto const it0 = it; | ||
| HITCBC | 38 | 12773 | auto rv1 = grammar::parse( | 38 | 12777 | auto rv1 = grammar::parse( | ||
| 39 | it, end, uri_rule); | 39 | it, end, uri_rule); | |||||
| HITCBC | 40 | 12773 | if(rv1) | 40 | 12777 | if(rv1) | ||
| HITCBC | 41 | 2834 | return *rv1; | 41 | 2834 | return *rv1; | ||
| HITCBC | 42 | 9939 | it = it0; | 42 | 9943 | it = it0; | ||
| HITCBC | 43 | 9939 | auto rv2 = grammar::parse( | 43 | 9943 | auto rv2 = grammar::parse( | ||
| 44 | it, end, relative_ref_rule); | 44 | it, end, relative_ref_rule); | |||||
| HITCBC | 45 | 9939 | if(rv2) | 45 | 9943 | if(rv2) | ||
| HITCBC | 46 | 9581 | return *rv2; | 46 | 9585 | return *rv2; | ||
| HITCBC | 47 | 358 | BOOST_URL_CONSTEXPR_RETURN_EC( | 47 | 358 | BOOST_URL_CONSTEXPR_RETURN_EC( | ||
| 48 | grammar::error::mismatch); | 48 | grammar::error::mismatch); | |||||
| 49 | } | 49 | } | |||||
| 50 | 50 | |||||||
| 51 | } // urls | 51 | } // urls | |||||
| 52 | } // boost | 52 | } // boost | |||||
| 53 | 53 | |||||||
| 54 | 54 | |||||||
| 55 | #endif | 55 | #endif | |||||