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 | #ifndef BOOST_URL_IMPL_URL_VIEW_IPP | ||
12 | #define BOOST_URL_IMPL_URL_VIEW_IPP | ||
13 | |||
14 | #include <boost/url/detail/config.hpp> | ||
15 | #include <boost/url/url_view.hpp> | ||
16 | #include <boost/url/parse.hpp> | ||
17 | #include <boost/url/detail/except.hpp> | ||
18 | |||
19 | namespace boost { | ||
20 | namespace urls { | ||
21 | |||
22 | namespace detail { | ||
23 | |||
24 | url_view | ||
25 | 3519 | url_impl:: | |
26 | construct() const noexcept | ||
27 | { | ||
28 | 3519 | return url_view(*this); | |
29 | } | ||
30 | |||
31 | } // detail | ||
32 | |||
33 | //------------------------------------------------ | ||
34 | |||
35 | url_view:: | ||
36 | url_view() noexcept = default; | ||
37 | |||
38 | 264 | url_view:: | |
39 | 264 | url_view(core::string_view s) | |
40 | 264 | : url_view(parse_uri_reference(s | |
41 |
2/2✓ Branch 2 taken 263 times.
✓ Branch 3 taken 1 times.
|
264 | ).value(BOOST_URL_POS)) |
42 | { | ||
43 | 263 | } | |
44 | |||
45 | 15679 | url_view:: | |
46 | url_view( | ||
47 | 15679 | url_view_base const& u) noexcept | |
48 | 15679 | : url_view_base(u.impl_) | |
49 | { | ||
50 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 15536 times.
|
15679 | if (u.pi_->from_ == from::url) |
51 | { | ||
52 | 143 | pi_ = u.pi_; | |
53 | } | ||
54 | else | ||
55 | { | ||
56 | 15536 | impl_ = u.impl_; | |
57 | 15536 | pi_ = &impl_; | |
58 | } | ||
59 | 15679 | } | |
60 | |||
61 | url_view& | ||
62 | 13 | url_view:: | |
63 | operator=( | ||
64 | url_view_base const& u) noexcept | ||
65 | { | ||
66 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 12 times.
|
13 | if (pi_ == u.pi_) |
67 | 1 | return *this; | |
68 | |||
69 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if (u.pi_->from_ == from::url) |
70 | { | ||
71 | ✗ | pi_ = u.pi_; | |
72 | } | ||
73 | else | ||
74 | { | ||
75 | 12 | impl_ = u.impl_; | |
76 | 12 | pi_ = &impl_; | |
77 | } | ||
78 | 12 | return *this; | |
79 | } | ||
80 | |||
81 | } // urls | ||
82 | } // boost | ||
83 | |||
84 | #endif | ||
85 |