LCOV - code coverage report
Current view: top level - url/detail - segments_iter_impl.hpp (source / functions) Coverage Total Hit
Test: coverage_remapped.info Lines: 100.0 % 7 7
Test Date: 2026-02-25 21:00:01 Functions: 100.0 % 3 3

           TLA  Line data    Source code
       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 BOOST_SYMBOL_VISIBLE segments_iter_impl
      24                 :     : private parts_base
      25                 : {
      26                 :     path_ref ref; // parent path data the iterator aliases
      27                 :     std::size_t pos = 0; // encoded offset of current segment start
      28                 :     std::size_t next = 0; // encoded offset one past current segment
      29                 :     std::size_t index = 0; // segment index within the parent path
      30                 :     std::size_t dn = 0; // decoded length of current segment
      31                 :     std::size_t decoded_prefix = 0; // decoded chars preceding current segment
      32                 : private:
      33                 :     pct_string_view s_;
      34                 : public:
      35                 : 
      36                 :     segments_iter_impl() = default;
      37                 :     segments_iter_impl(
      38                 :         segments_iter_impl const&) noexcept = default;
      39                 :     segments_iter_impl& operator=(
      40                 :         segments_iter_impl const&) noexcept = default;
      41                 : 
      42                 :     // begin
      43                 :     segments_iter_impl(
      44                 :         detail::path_ref const&) noexcept;
      45                 : 
      46                 :     // end
      47                 :     segments_iter_impl(
      48                 :         detail::path_ref const&,
      49                 :         int) noexcept;
      50                 : 
      51                 :     // at index
      52                 :     segments_iter_impl(
      53                 :         url_impl const& u_,
      54                 :         std::size_t pos_,
      55                 :         std::size_t i_) noexcept;
      56                 : 
      57                 :     void update() noexcept;
      58                 : 
      59                 :     void
      60                 :     increment() noexcept;
      61                 : 
      62                 :     void
      63                 :     decrement() noexcept;
      64                 : 
      65                 :     pct_string_view
      66 HIT        4827 :     dereference() const noexcept
      67                 :     {
      68            4827 :         return s_;
      69                 :     }
      70                 : 
      71                 :     std::size_t
      72              24 :     decoded_prefix_size() const noexcept
      73                 :     {
      74              24 :         return decoded_prefix;
      75                 :     }
      76                 : 
      77                 :     bool
      78            5251 :     equal(
      79                 :         segments_iter_impl const& other) const noexcept
      80                 :     {
      81            5251 :         BOOST_ASSERT(ref.alias_of(other.ref));
      82            5251 :         return index == other.index;
      83                 :     }
      84                 : };
      85                 : 
      86                 : } // detail
      87                 : } // urls
      88                 : } // boost
      89                 : 
      90                 : #include <boost/url/detail/impl/segments_iter_impl.hpp>
      91                 : 
      92                 : #endif
        

Generated by: LCOV version 2.3