Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:28

0001 //
0002 // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
0003 // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
0004 //
0005 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0006 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // Official repository: https://github.com/boostorg/url
0009 //
0010 
0011 #ifndef BOOST_URL_IMPL_PARAMS_ENCODED_REF_HPP
0012 #define BOOST_URL_IMPL_PARAMS_ENCODED_REF_HPP
0013 
0014 #include <boost/url/detail/except.hpp>
0015 #include <boost/assert.hpp>
0016 
0017 namespace boost {
0018 namespace urls {
0019 
0020 //------------------------------------------------
0021 //
0022 // Modifiers
0023 //
0024 //------------------------------------------------
0025 
0026 inline
0027 void
0028 params_encoded_ref::
0029 clear() noexcept
0030 {
0031     u_->remove_query();
0032 }
0033 
0034 template<class FwdIt>
0035 void
0036 params_encoded_ref::
0037 assign(FwdIt first, FwdIt last)
0038 {
0039 /*  If you get a compile error here, it
0040     means that the iterators you passed
0041     do not meet the requirements stated
0042     in the documentation.
0043 */
0044     static_assert(
0045         std::is_convertible<
0046             typename std::iterator_traits<
0047                 FwdIt>::reference,
0048             param_view>::value,
0049         "Type requirements not met");
0050 
0051     assign(first, last,
0052         typename std::iterator_traits<
0053             FwdIt>::iterator_category{});
0054 }
0055 
0056 inline
0057 auto
0058 params_encoded_ref::
0059 append(
0060     param_pct_view const& p) ->
0061         iterator
0062 {
0063     return insert(end(), p);
0064 }
0065 
0066 inline
0067 auto
0068 params_encoded_ref::
0069 append(
0070     std::initializer_list<
0071         param_pct_view> init) ->
0072     iterator
0073 {
0074     return insert(end(), init);
0075 }
0076 
0077 template<class FwdIt>
0078 auto
0079 params_encoded_ref::
0080 append(
0081     FwdIt first, FwdIt last) ->
0082     iterator
0083 {
0084 /*  If you get a compile error here, it
0085     means that the iterators you passed
0086     do not meet the requirements stated
0087     in the documentation.
0088 */
0089     static_assert(
0090         std::is_convertible<
0091             typename std::iterator_traits<
0092                 FwdIt>::reference,
0093             param_view>::value,
0094         "Type requirements not met");
0095 
0096     return insert(
0097         end(), first, last);
0098 }
0099 
0100 template<class FwdIt>
0101 auto
0102 params_encoded_ref::
0103 insert(
0104     iterator before,
0105     FwdIt first,
0106     FwdIt last) ->
0107         iterator
0108 {
0109 /*  If you get a compile error here, it
0110     means that the iterators you passed
0111     do not meet the requirements stated
0112     in the documentation.
0113 */
0114     static_assert(
0115         std::is_convertible<
0116             typename std::iterator_traits<
0117                 FwdIt>::reference,
0118             param_view>::value,
0119         "Type requirements not met");
0120 
0121     return insert(
0122         before,
0123         first,
0124         last,
0125         typename std::iterator_traits<
0126             FwdIt>::iterator_category{});
0127 }
0128 
0129 template<class FwdIt>
0130 auto
0131 params_encoded_ref::
0132 replace(
0133     iterator from,
0134     iterator to,
0135     FwdIt first,
0136     FwdIt last) ->
0137         iterator
0138 {
0139 /*  If you get a compile error here, it
0140     means that the iterators you passed
0141     do not meet the requirements stated
0142     in the documentation.
0143 */
0144     static_assert(
0145         std::is_convertible<
0146             typename std::iterator_traits<
0147                 FwdIt>::reference,
0148             param_view>::value,
0149         "Type requirements not met");
0150 
0151     return u_->edit_params(
0152         from.it_, to.it_,
0153         detail::make_params_encoded_iter(
0154             first, last));
0155 }
0156 
0157 //------------------------------------------------
0158 //
0159 // implementation
0160 //
0161 //------------------------------------------------
0162 
0163 template<class FwdIt>
0164 void
0165 params_encoded_ref::
0166 assign(FwdIt first, FwdIt last,
0167     std::forward_iterator_tag)
0168 {
0169     u_->edit_params(
0170         begin().it_,
0171         end().it_,
0172         detail::make_params_encoded_iter(
0173             first, last));
0174 }
0175 
0176 template<class FwdIt>
0177 auto
0178 params_encoded_ref::
0179 insert(
0180     iterator before,
0181     FwdIt first,
0182     FwdIt last,
0183     std::forward_iterator_tag) ->
0184         iterator
0185 {
0186     return u_->edit_params(
0187         before.it_,
0188         before.it_,
0189         detail::make_params_encoded_iter(
0190             first, last));
0191 }
0192 
0193 } // urls
0194 } // boost
0195 
0196 #endif