| 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/segments_base.hpp> | ||
| 14 | #include <ostream> | ||
| 15 | |||
| 16 | namespace boost { | ||
| 17 | namespace urls { | ||
| 18 | |||
| 19 | auto | ||
| 20 | 838 | segments_base:: | |
| 21 | iterator:: | ||
| 22 | operator*() const -> | ||
| 23 | reference | ||
| 24 | { | ||
| 25 | 838 | encoding_opts opt; | |
| 26 | 838 | opt.space_as_plus = false; | |
| 27 |
1/2✓ Branch 3 taken 838 times.
✗ Branch 4 not taken.
|
838 | return it_.dereference().decode(opt); |
| 28 | } | ||
| 29 | |||
| 30 | 525 | segments_base:: | |
| 31 | iterator:: | ||
| 32 | iterator( | ||
| 33 | 525 | detail::path_ref const& ref) noexcept | |
| 34 | 525 | : it_(ref) | |
| 35 | { | ||
| 36 | 525 | } | |
| 37 | |||
| 38 | 404 | segments_base:: | |
| 39 | iterator:: | ||
| 40 | iterator( | ||
| 41 | detail::path_ref const& ref, | ||
| 42 | 404 | int) noexcept | |
| 43 | 404 | : it_(ref, 0) | |
| 44 | { | ||
| 45 | 404 | } | |
| 46 | |||
| 47 | //------------------------------------------------ | ||
| 48 | // | ||
| 49 | // segments_base | ||
| 50 | // | ||
| 51 | //------------------------------------------------ | ||
| 52 | |||
| 53 | 389 | segments_base:: | |
| 54 | segments_base( | ||
| 55 | 389 | detail::path_ref const& ref) noexcept | |
| 56 | 389 | : ref_(ref) | |
| 57 | { | ||
| 58 | 389 | } | |
| 59 | |||
| 60 | pct_string_view | ||
| 61 | 79 | segments_base:: | |
| 62 | buffer() const noexcept | ||
| 63 | { | ||
| 64 | 79 | return ref_.buffer(); | |
| 65 | } | ||
| 66 | |||
| 67 | bool | ||
| 68 | 41 | segments_base:: | |
| 69 | is_absolute() const noexcept | ||
| 70 | { | ||
| 71 | 41 | return ref_.buffer().starts_with('/'); | |
| 72 | } | ||
| 73 | |||
| 74 | bool | ||
| 75 | 81 | segments_base:: | |
| 76 | empty() const noexcept | ||
| 77 | { | ||
| 78 | 81 | return ref_.nseg() == 0; | |
| 79 | } | ||
| 80 | |||
| 81 | std::size_t | ||
| 82 | 289 | segments_base:: | |
| 83 | size() const noexcept | ||
| 84 | { | ||
| 85 | 289 | return ref_.nseg(); | |
| 86 | } | ||
| 87 | |||
| 88 | auto | ||
| 89 | 525 | segments_base:: | |
| 90 | begin() const noexcept -> | ||
| 91 | iterator | ||
| 92 | { | ||
| 93 | 525 | return iterator(ref_); | |
| 94 | } | ||
| 95 | |||
| 96 | auto | ||
| 97 | 404 | segments_base:: | |
| 98 | end() const noexcept -> | ||
| 99 | iterator | ||
| 100 | { | ||
| 101 | 404 | return iterator(ref_, 0); | |
| 102 | } | ||
| 103 | |||
| 104 | //------------------------------------------------ | ||
| 105 | |||
| 106 | std::ostream& | ||
| 107 | 15 | operator<<( | |
| 108 | std::ostream& os, | ||
| 109 | segments_base const& ps) | ||
| 110 | { | ||
| 111 |
1/2✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
|
15 | os << ps.buffer(); |
| 112 | 15 | return os; | |
| 113 | } | ||
| 114 | |||
| 115 | } // urls | ||
| 116 | } // boost | ||
| 117 | |||
| 118 |