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_REF_HPP
0012 #define BOOST_URL_IMPL_SEGMENTS_REF_HPP
0013
0014 #include <boost/url/detail/config.hpp>
0015 #include <boost/url/detail/any_segments_iter.hpp>
0016 #include <boost/url/detail/segments_iter_impl.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_ref::
0031 clear() noexcept
0032 {
0033 erase(begin(), end());
0034 }
0035
0036 template<class FwdIt>
0037 void
0038 segments_ref::
0039 assign(FwdIt first, FwdIt last)
0040 {
0041
0042
0043
0044
0045
0046 static_assert(
0047 std::is_convertible<
0048 typename std::iterator_traits<
0049 FwdIt>::reference,
0050 core::string_view>::value,
0051 "Type requirements not met");
0052
0053 u_->edit_segments(
0054 begin().it_,
0055 end().it_,
0056 detail::make_segments_iter(
0057 first, last));
0058 }
0059
0060 template<class FwdIt>
0061 auto
0062 segments_ref::
0063 insert(
0064 iterator before,
0065 FwdIt first,
0066 FwdIt last) ->
0067 iterator
0068 {
0069
0070
0071
0072
0073
0074 static_assert(
0075 std::is_convertible<
0076 typename std::iterator_traits<
0077 FwdIt>::reference,
0078 core::string_view>::value,
0079 "Type requirements not met");
0080
0081 return insert(
0082 before,
0083 first,
0084 last,
0085 typename std::iterator_traits<
0086 FwdIt>::iterator_category{});
0087 }
0088
0089 inline
0090 auto
0091 segments_ref::
0092 erase(
0093 iterator pos) noexcept ->
0094 iterator
0095 {
0096 return erase(pos, std::next(pos));
0097 }
0098
0099 template<class FwdIt>
0100 auto
0101 segments_ref::
0102 replace(
0103 iterator from,
0104 iterator to,
0105 FwdIt first,
0106 FwdIt last) ->
0107 iterator
0108 {
0109
0110
0111
0112
0113
0114 static_assert(
0115 std::is_convertible<
0116 typename std::iterator_traits<
0117 FwdIt>::reference,
0118 core::string_view>::value,
0119 "Type requirements not met");
0120
0121 return u_->edit_segments(
0122 from.it_,
0123 to.it_,
0124 detail::make_segments_iter(
0125 first, last));
0126 }
0127
0128
0129
0130 inline
0131 void
0132 segments_ref::
0133 push_back(
0134 core::string_view s)
0135 {
0136 insert(end(), s);
0137 }
0138
0139 inline
0140 void
0141 segments_ref::
0142 pop_back() noexcept
0143 {
0144 erase(std::prev(end()));
0145 }
0146
0147
0148
0149 template<class FwdIt>
0150 auto
0151 segments_ref::
0152 insert(
0153 iterator before,
0154 FwdIt first,
0155 FwdIt last,
0156 std::forward_iterator_tag) ->
0157 iterator
0158 {
0159 return u_->edit_segments(
0160 before.it_,
0161 before.it_,
0162 detail::make_segments_iter(
0163 first, last));
0164 }
0165
0166 }
0167 }
0168
0169 #endif