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

            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_PARAMS_REF_HPP
      12              : #define BOOST_URL_IMPL_PARAMS_REF_HPP
      13              : 
      14              : #include <boost/url/params_view.hpp>
      15              : #include <boost/url/detail/any_params_iter.hpp>
      16              : #include <boost/url/detail/except.hpp>
      17              : #include <boost/url/grammar/recycled.hpp>
      18              : #include <boost/assert.hpp>
      19              : 
      20              : namespace boost {
      21              : namespace urls {
      22              : 
      23              : template<class FwdIt>
      24              : void
      25            8 : params_ref::
      26              : assign(FwdIt first, FwdIt last)
      27              : {
      28              : /*  If you get a compile error here, it
      29              :     means that the iterators you passed
      30              :     do not meet the requirements stated
      31              :     in the documentation.
      32              : */
      33              :     static_assert(
      34              :         std::is_convertible<
      35              :             typename std::iterator_traits<
      36              :                 FwdIt>::reference,
      37              :             param_view>::value,
      38              :         "Type requirements not met");
      39              : 
      40            8 :     assign(first, last,
      41              :         typename std::iterator_traits<
      42              :             FwdIt>::iterator_category{});
      43            8 : }
      44              : 
      45              : template<class FwdIt>
      46              : auto
      47            4 : params_ref::
      48              : append(FwdIt first, FwdIt last) ->
      49              :     iterator
      50              : {
      51              : /*  If you get a compile error here, it
      52              :     means that the iterators you passed
      53              :     do not meet the requirements stated
      54              :     in the documentation.
      55              : */
      56              :     static_assert(
      57              :         std::is_convertible<
      58              :             typename std::iterator_traits<
      59              :                 FwdIt>::reference,
      60              :             param_view>::value,
      61              :         "Type requirements not met");
      62              : 
      63            4 :     return insert(
      64            4 :         end(), first, last);
      65              : }
      66              : 
      67              : template<class FwdIt>
      68              : auto
      69           20 : params_ref::
      70              : insert(
      71              :     iterator before,
      72              :     FwdIt first,
      73              :     FwdIt last) ->
      74              :         iterator
      75              : {
      76              : /*  If you get a compile error here, it
      77              :     means that the iterators you passed
      78              :     do not meet the requirements stated
      79              :     in the documentation.
      80              : */
      81              :     static_assert(
      82              :         std::is_convertible<
      83              :             typename std::iterator_traits<
      84              :                 FwdIt>::reference,
      85              :             param_view>::value,
      86              :         "Type requirements not met");
      87              : 
      88           40 :     return insert(
      89              :         before,
      90              :         first,
      91              :         last,
      92              :         typename std::iterator_traits<
      93           40 :             FwdIt>::iterator_category{});
      94              : }
      95              : 
      96              : template<class FwdIt>
      97              : auto
      98            4 : params_ref::
      99              : replace(
     100              :     iterator from,
     101              :     iterator to,
     102              :     FwdIt first,
     103              :     FwdIt last) ->
     104              :         iterator
     105              : {
     106              : /*  If you get a compile error here, it
     107              :     means that the iterators you passed
     108              :     do not meet the requirements stated
     109              :     in the documentation.
     110              : */
     111              :     static_assert(
     112              :         std::is_convertible<
     113              :             typename std::iterator_traits<
     114              :                 FwdIt>::reference,
     115              :             param_view>::value,
     116              :         "Type requirements not met");
     117              : 
     118              :     return iterator(
     119            8 :         u_->edit_params(
     120              :             from.it_, to.it_,
     121              :             detail::make_params_iter(
     122            4 :                 first, last, opt_.space_as_plus)),
     123            8 :         opt_);
     124              : }
     125              : 
     126              : //------------------------------------------------
     127              : //
     128              : // implementation
     129              : //
     130              : //------------------------------------------------
     131              : 
     132              : template<class FwdIt>
     133              : void
     134            8 : params_ref::
     135              : assign(FwdIt first, FwdIt last,
     136              :     std::forward_iterator_tag)
     137              : {
     138            8 :     u_->edit_params(
     139            8 :         begin().it_,
     140           16 :         end().it_,
     141              :         detail::make_params_iter(
     142            8 :             first, last, opt_.space_as_plus));
     143            8 : }
     144              : 
     145              : template<class FwdIt>
     146              : auto
     147           20 : params_ref::
     148              : insert(
     149              :     iterator before,
     150              :     FwdIt first,
     151              :     FwdIt last,
     152              :     std::forward_iterator_tag) ->
     153              :         iterator
     154              : {
     155              :     return iterator(
     156           40 :         u_->edit_params(
     157              :             before.it_,
     158              :             before.it_,
     159              :             detail::make_params_iter(
     160           20 :                 first, last, opt_.space_as_plus)),
     161           40 :         opt_);
     162              : }
     163              : 
     164              : } // urls
     165              : } // boost
     166              : 
     167              : #endif
        

Generated by: LCOV version 2.3