LCOV - code coverage report
Current view: top level - /jenkins/workspace/boost-root/libs/url/src - segments_encoded_ref.cpp (source / functions) Coverage Total Hit
Test: coverage_remapped.info Lines: 100.0 % 52 52
Test Date: 2026-02-13 15:53:22 Functions: 100.0 % 16 16

            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              : 
      12              : #include <boost/url/detail/config.hpp>
      13              : #include <boost/url/segments_encoded_ref.hpp>
      14              : #include <boost/url/url.hpp>
      15              : #include <boost/url/detail/path.hpp>
      16              : 
      17              : namespace boost {
      18              : namespace urls {
      19              : 
      20              : //------------------------------------------------
      21              : //
      22              : // Special Members
      23              : //
      24              : //------------------------------------------------
      25              : 
      26          467 : segments_encoded_ref::
      27              : segments_encoded_ref(
      28          467 :     url_base& u) noexcept
      29              :     : segments_encoded_base(
      30          934 :         detail::path_ref(u.impl_))
      31          467 :     , u_(&u)
      32              : {
      33          467 : }
      34              : 
      35           34 : segments_encoded_ref::
      36              : operator
      37              : segments_encoded_view() const noexcept
      38              : {
      39           34 :     return segments_encoded_view(ref_);
      40              : }
      41              : 
      42              : segments_encoded_ref&
      43            1 : segments_encoded_ref::
      44              : operator=(
      45              :     segments_encoded_ref const& other)
      46              : {
      47            1 :     if (!ref_.alias_of(other.ref_))
      48            1 :         assign(other.begin(), other.end());
      49            1 :     return *this;
      50              : }
      51              : 
      52              : segments_encoded_ref&
      53            1 : segments_encoded_ref::
      54              : operator=(
      55              :     segments_encoded_view const& other)
      56              : {
      57            1 :     assign(other.begin(), other.end());
      58            1 :     return *this;
      59              : }
      60              : 
      61              : segments_encoded_ref&
      62            4 : segments_encoded_ref::
      63              : operator=(std::initializer_list<
      64              :     pct_string_view> init)
      65              : {
      66            4 :     assign(init.begin(), init.end());
      67            4 :     return *this;
      68              : }
      69              : 
      70              : //------------------------------------------------
      71              : //
      72              : // Modifiers
      73              : //
      74              : //------------------------------------------------
      75              : 
      76              : void
      77            9 : segments_encoded_ref::
      78              : clear() noexcept
      79              : {
      80            9 :     erase(begin(), end());
      81            9 : }
      82              : 
      83              : void
      84            6 : segments_encoded_ref::
      85              : assign(
      86              :     std::initializer_list<
      87              :         pct_string_view> init)
      88              : {
      89            6 :     assign(init.begin(), init.end());
      90            6 : }
      91              : 
      92              : auto
      93           50 : segments_encoded_ref::
      94              : insert(
      95              :     iterator before,
      96              :     pct_string_view s) ->
      97              :         iterator
      98              : {
      99           50 :     return u_->edit_segments(
     100              :         before.it_,
     101              :         before.it_,
     102          100 :         detail::segment_encoded_iter(s));
     103              : }
     104              : 
     105              : auto
     106           14 : segments_encoded_ref::
     107              : insert(
     108              :     iterator before,
     109              :     std::initializer_list<
     110              :             pct_string_view> init) ->
     111              :         iterator
     112              : {
     113           14 :     return insert(
     114              :         before,
     115              :         init.begin(),
     116           14 :         init.end());
     117              : }
     118              : 
     119              : auto
     120          152 : segments_encoded_ref::
     121              : erase(
     122              :     iterator first,
     123              :     iterator last) noexcept ->
     124              :         iterator
     125              : {
     126          152 :     core::string_view s;
     127          152 :     return u_->edit_segments(
     128              :         first.it_,
     129              :         last.it_,
     130          304 :         detail::make_segments_encoded_iter(
     131          152 :             &s, &s));
     132              : }
     133              : 
     134              : auto
     135           10 : segments_encoded_ref::
     136              : replace(
     137              :     iterator pos,
     138              :     pct_string_view s) ->
     139              :         iterator
     140              : {
     141           30 :     return u_->edit_segments(
     142              :         pos.it_,
     143           10 :         std::next(pos).it_,
     144           20 :         detail::segment_encoded_iter(s));
     145              : }
     146              : 
     147              : auto
     148           12 : segments_encoded_ref::
     149              : replace(
     150              :     iterator from,
     151              :     iterator to,
     152              :     pct_string_view s) ->
     153              :         iterator
     154              : {
     155           12 :     return u_->edit_segments(
     156              :         from.it_,
     157              :         to.it_,
     158           24 :         detail::segment_encoded_iter(s));
     159              : }
     160              : 
     161              : auto
     162            6 : segments_encoded_ref::
     163              : replace(
     164              :     iterator from,
     165              :     iterator to,
     166              :     std::initializer_list<
     167              :         pct_string_view> init) ->
     168              :     iterator
     169              : {
     170            6 :     return replace(
     171              :         from,
     172              :         to,
     173              :         init.begin(),
     174            6 :         init.end());
     175              : }
     176              : 
     177              : auto
     178          137 : segments_encoded_ref::
     179              : erase(
     180              :     iterator pos) noexcept ->
     181              :         iterator
     182              : {
     183          137 :     return erase(pos, std::next(pos));
     184              : }
     185              : 
     186              : void
     187           20 : segments_encoded_ref::
     188              : push_back(
     189              :     pct_string_view s)
     190              : {
     191           20 :     insert(end(), s);
     192           20 : }
     193              : 
     194              : void
     195          125 : segments_encoded_ref::
     196              : pop_back() noexcept
     197              : {
     198          250 :     erase(std::prev(end()));
     199          125 : }
     200              : 
     201              : } // urls
     202              : } // boost
     203              : 
        

Generated by: LCOV version 2.3