File indexing completed on 2025-01-18 09:53:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_URL_IMPL_SEGMENTS_ENCODED_REF_HPP
0012 #define BOOST_URL_IMPL_SEGMENTS_ENCODED_REF_HPP
0013
0014 #include <boost/url/detail/config.hpp>
0015 #include <boost/url/detail/segments_iter_impl.hpp>
0016 #include <boost/url/detail/any_segments_iter.hpp>
0017 #include <type_traits>
0018
0019 namespace boost {
0020 namespace urls {
0021
0022
0023
0024
0025
0026
0027
0028 inline
0029 void
0030 segments_encoded_ref::
0031 clear() noexcept
0032 {
0033 erase(begin(), end());
0034 }
0035
0036 template<class FwdIt>
0037 void
0038 segments_encoded_ref::
0039 assign(
0040 FwdIt first, FwdIt last)
0041 {
0042
0043
0044
0045
0046
0047 static_assert(
0048 std::is_convertible<
0049 typename std::iterator_traits<
0050 FwdIt>::reference,
0051 core::string_view>::value,
0052 "Type requirements not met");
0053
0054 u_->edit_segments(
0055 begin().it_,
0056 end().it_,
0057 detail::make_segments_encoded_iter(
0058 first, last));
0059 }
0060
0061 template<class FwdIt>
0062 auto
0063 segments_encoded_ref::
0064 insert(
0065 iterator before,
0066 FwdIt first,
0067 FwdIt last) ->
0068 iterator
0069 {
0070
0071
0072
0073
0074
0075 static_assert(
0076 std::is_convertible<
0077 typename std::iterator_traits<
0078 FwdIt>::reference,
0079 core::string_view>::value,
0080 "Type requirements not met");
0081
0082 return insert(
0083 before,
0084 first,
0085 last,
0086 typename std::iterator_traits<
0087 FwdIt>::iterator_category{});
0088 }
0089
0090 inline
0091 auto
0092 segments_encoded_ref::
0093 erase(
0094 iterator pos) noexcept ->
0095 iterator
0096 {
0097 return erase(pos, std::next(pos));
0098 }
0099
0100 template<class FwdIt>
0101 auto
0102 segments_encoded_ref::
0103 replace(
0104 iterator from,
0105 iterator to,
0106 FwdIt first,
0107 FwdIt last) ->
0108 iterator
0109 {
0110
0111
0112
0113
0114
0115 static_assert(
0116 std::is_convertible<
0117 typename std::iterator_traits<
0118 FwdIt>::reference,
0119 core::string_view>::value,
0120 "Type requirements not met");
0121
0122 return u_->edit_segments(
0123 from.it_,
0124 to.it_,
0125 detail::make_segments_encoded_iter(
0126 first, last));
0127 }
0128
0129
0130
0131 inline
0132 void
0133 segments_encoded_ref::
0134 push_back(
0135 pct_string_view s)
0136 {
0137 insert(end(), s);
0138 }
0139
0140 inline
0141 void
0142 segments_encoded_ref::
0143 pop_back() noexcept
0144 {
0145 erase(std::prev(end()));
0146 }
0147
0148
0149
0150 template<class FwdIt>
0151 auto
0152 segments_encoded_ref::
0153 insert(
0154 iterator before,
0155 FwdIt first,
0156 FwdIt last,
0157 std::forward_iterator_tag) ->
0158 iterator
0159 {
0160 return u_->edit_segments(
0161 before.it_,
0162 before.it_,
0163 detail::make_segments_encoded_iter(
0164 first, last));
0165 }
0166
0167 }
0168 }
0169
0170 #endif