LCOV - code coverage report
Current view: top level - url/impl - segments_encoded_ref.hpp (source / functions) Coverage Total Hit
Test: coverage_remapped.info Lines: 100.0 % 14 14
Test Date: 2026-02-13 15:53:22 Functions: 100.0 % 11 11

            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_IMPL_SEGMENTS_ENCODED_REF_HPP
      12              : #define BOOST_URL_IMPL_SEGMENTS_ENCODED_REF_HPP
      13              : 
      14              : #include <boost/url/detail/config.hpp>
      15              : #include <boost/url/detail/segments_iter_impl.hpp>
      16              : #include <boost/url/detail/any_segments_iter.hpp>
      17              : #include <type_traits>
      18              : 
      19              : namespace boost {
      20              : namespace urls {
      21              : 
      22              : //------------------------------------------------
      23              : //
      24              : // Modifiers
      25              : //
      26              : //------------------------------------------------
      27              : 
      28              : template<class FwdIt>
      29              : void
      30           24 : segments_encoded_ref::
      31              : assign(
      32              :     FwdIt first, FwdIt last)
      33              : {
      34              : /*  If you get a compile error here, it
      35              :     means that the iterators you passed
      36              :     do not meet the requirements stated
      37              :     in the documentation.
      38              : */
      39              :     static_assert(
      40              :         std::is_convertible<
      41              :             typename std::iterator_traits<
      42              :                 FwdIt>::reference,
      43              :             core::string_view>::value,
      44              :         "Type requirements not met");
      45              : 
      46           42 :     u_->edit_segments(
      47           18 :         begin().it_,
      48           36 :         end().it_,
      49              :         detail::make_segments_encoded_iter(
      50              :             first, last));
      51           18 : }
      52              : 
      53              : template<class FwdIt>
      54              : auto
      55          158 : segments_encoded_ref::
      56              : insert(
      57              :     iterator before,
      58              :     FwdIt first,
      59              :     FwdIt last) ->
      60              :         iterator
      61              : {
      62              : /*  If you get a compile error here, it
      63              :     means that the iterators you passed
      64              :     do not meet the requirements stated
      65              :     in the documentation.
      66              : */
      67              :     static_assert(
      68              :         std::is_convertible<
      69              :             typename std::iterator_traits<
      70              :                 FwdIt>::reference,
      71              :             core::string_view>::value,
      72              :         "Type requirements not met");
      73              : 
      74          309 :     return insert(
      75              :         before,
      76              :         first,
      77              :         last,
      78              :         typename std::iterator_traits<
      79          302 :             FwdIt>::iterator_category{});
      80              : }
      81              : 
      82              : template<class FwdIt>
      83              : auto
      84           14 : segments_encoded_ref::
      85              : replace(
      86              :     iterator from,
      87              :     iterator to,
      88              :     FwdIt first,
      89              :     FwdIt last) ->
      90              :         iterator
      91              : {
      92              : /*  If you get a compile error here, it
      93              :     means that the iterators you passed
      94              :     do not meet the requirements stated
      95              :     in the documentation.
      96              : */
      97              :     static_assert(
      98              :         std::is_convertible<
      99              :             typename std::iterator_traits<
     100              :                 FwdIt>::reference,
     101              :             core::string_view>::value,
     102              :         "Type requirements not met");
     103              : 
     104           28 :     return u_->edit_segments(
     105              :         from.it_,
     106              :         to.it_,
     107              :         detail::make_segments_encoded_iter(
     108           24 :             first, last));
     109              : }
     110              : 
     111              : //------------------------------------------------
     112              : 
     113              : template<class FwdIt>
     114              : auto
     115          158 : segments_encoded_ref::
     116              : insert(
     117              :     iterator before,
     118              :     FwdIt first,
     119              :     FwdIt last,
     120              :     std::forward_iterator_tag) ->
     121              :         iterator
     122              : {
     123          309 :     return u_->edit_segments(
     124              :         before.it_,
     125              :         before.it_,
     126              :         detail::make_segments_encoded_iter(
     127          302 :             first, last));
     128              : }
     129              : 
     130              : } // urls
     131              : } // boost
     132              : 
     133              : #endif
        

Generated by: LCOV version 2.3