GCC Code Coverage Report


Directory: libs/url/
File: boost/url/detail/segments_iter_impl.hpp
Date: 2024-08-20 16:05:55
Exec Total Coverage
Lines: 5 5 100.0%
Functions: 2 2 100.0%
Branches: 1 2 50.0%

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_DETAIL_SEGMENTS_ITER_IMPL_HPP
12 #define BOOST_URL_DETAIL_SEGMENTS_ITER_IMPL_HPP
13
14 #include <boost/url/detail/parts_base.hpp>
15 #include <boost/url/detail/url_impl.hpp>
16 #include <boost/core/detail/string_view.hpp>
17 #include <string>
18
19 namespace boost {
20 namespace urls {
21 namespace detail {
22
23 struct segments_iter_impl
24 : private parts_base
25 {
26 path_ref ref;
27 std::size_t pos = 0;
28 std::size_t next = 0;
29 std::size_t index = 0;
30 std::size_t dn = 0;
31 private:
32 pct_string_view s_;
33 public:
34
35 segments_iter_impl() = default;
36 segments_iter_impl(
37 segments_iter_impl const&) noexcept = default;
38 segments_iter_impl& operator=(
39 segments_iter_impl const&) noexcept = default;
40
41 // begin
42 segments_iter_impl(
43 detail::path_ref const&) noexcept;
44
45 // end
46 segments_iter_impl(
47 detail::path_ref const&,
48 int) noexcept;
49
50 // at index
51 segments_iter_impl(
52 url_impl const& u_,
53 std::size_t pos_,
54 std::size_t i_) noexcept;
55
56 void update() noexcept;
57
58 BOOST_URL_DECL
59 void
60 increment() noexcept;
61
62 BOOST_URL_DECL
63 void
64 decrement() noexcept;
65
66 pct_string_view
67 4695 dereference() const noexcept
68 {
69 4695 return s_;
70 }
71
72 bool
73 5080 equal(
74 segments_iter_impl const& other) const noexcept
75 {
76
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5080 times.
5080 BOOST_ASSERT(ref.alias_of(other.ref));
77 5080 return index == other.index;
78 }
79 };
80
81 } // detail
82 } // urls
83 } // boost
84
85 #endif
86