| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) | ||
| 3 | // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com) | ||
| 4 | // | ||
| 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) | ||
| 7 | // | ||
| 8 | // Official repository: https://github.com/boostorg/url | ||
| 9 | // | ||
| 10 | |||
| 11 | |||
| 12 | #include <boost/url/detail/config.hpp> | ||
| 13 | #include <boost/url/url_view.hpp> | ||
| 14 | #include <boost/url/parse.hpp> | ||
| 15 | #include <boost/url/detail/except.hpp> | ||
| 16 | |||
| 17 | namespace boost { | ||
| 18 | namespace urls { | ||
| 19 | |||
| 20 | namespace detail { | ||
| 21 | |||
| 22 | url_view | ||
| 23 | 3533 | url_impl:: | |
| 24 | construct() const noexcept | ||
| 25 | { | ||
| 26 | 3533 | return url_view(*this); | |
| 27 | } | ||
| 28 | |||
| 29 | } // detail | ||
| 30 | |||
| 31 | //------------------------------------------------ | ||
| 32 | |||
| 33 | url_view:: | ||
| 34 | url_view() noexcept = default; | ||
| 35 | |||
| 36 | 264 | url_view:: | |
| 37 | 264 | url_view(core::string_view s) | |
| 38 | 264 | : url_view(parse_uri_reference(s | |
| 39 |
2/2✓ Branch 2 taken 263 times.
✓ Branch 3 taken 1 times.
|
264 | ).value(BOOST_URL_POS)) |
| 40 | { | ||
| 41 | 263 | } | |
| 42 | |||
| 43 | 15729 | url_view:: | |
| 44 | url_view( | ||
| 45 | 15729 | url_view_base const& u) noexcept | |
| 46 | 15729 | : url_view_base(u.impl_) | |
| 47 | { | ||
| 48 |
2/2✓ Branch 0 taken 145 times.
✓ Branch 1 taken 15584 times.
|
15729 | if (u.pi_->from_ == from::url) |
| 49 | { | ||
| 50 | 145 | pi_ = u.pi_; | |
| 51 | } | ||
| 52 | else | ||
| 53 | { | ||
| 54 | 15584 | impl_ = u.impl_; | |
| 55 | 15584 | pi_ = &impl_; | |
| 56 | } | ||
| 57 | 15729 | } | |
| 58 | |||
| 59 | url_view& | ||
| 60 | 13 | url_view:: | |
| 61 | operator=( | ||
| 62 | url_view_base const& u) noexcept | ||
| 63 | { | ||
| 64 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 12 times.
|
13 | if (pi_ == u.pi_) |
| 65 | 1 | return *this; | |
| 66 | |||
| 67 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if (u.pi_->from_ == from::url) |
| 68 | { | ||
| 69 | ✗ | pi_ = u.pi_; | |
| 70 | } | ||
| 71 | else | ||
| 72 | { | ||
| 73 | 12 | impl_ = u.impl_; | |
| 74 | 12 | pi_ = &impl_; | |
| 75 | } | ||
| 76 | 12 | return *this; | |
| 77 | } | ||
| 78 | |||
| 79 | } // urls | ||
| 80 | } // boost | ||
| 81 | |||
| 82 |