File indexing completed on 2024-11-16 09:04:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_STRING_ITER_FIND_HPP
0012 #define BOOST_STRING_ITER_FIND_HPP
0013
0014 #include <boost/algorithm/string/config.hpp>
0015 #include <algorithm>
0016 #include <iterator>
0017 #include <boost/iterator/transform_iterator.hpp>
0018
0019 #include <boost/range/iterator_range_core.hpp>
0020 #include <boost/range/begin.hpp>
0021 #include <boost/range/end.hpp>
0022 #include <boost/range/iterator.hpp>
0023 #include <boost/range/value_type.hpp>
0024 #include <boost/range/as_literal.hpp>
0025
0026 #include <boost/algorithm/string/concept.hpp>
0027 #include <boost/algorithm/string/find_iterator.hpp>
0028 #include <boost/algorithm/string/detail/util.hpp>
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 namespace boost {
0042 namespace algorithm {
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067 template<
0068 typename SequenceSequenceT,
0069 typename RangeT,
0070 typename FinderT >
0071 inline SequenceSequenceT&
0072 iter_find(
0073 SequenceSequenceT& Result,
0074 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0075 RangeT&& Input,
0076 #else
0077 RangeT& Input,
0078 #endif
0079 FinderT Finder )
0080 {
0081 BOOST_CONCEPT_ASSERT((
0082 FinderConcept<
0083 FinderT,
0084 BOOST_STRING_TYPENAME range_iterator<RangeT>::type>
0085 ));
0086
0087 iterator_range<BOOST_STRING_TYPENAME range_iterator<RangeT>::type> lit_input(::boost::as_literal(Input));
0088
0089 typedef BOOST_STRING_TYPENAME
0090 range_iterator<RangeT>::type input_iterator_type;
0091 typedef find_iterator<input_iterator_type> find_iterator_type;
0092 typedef detail::copy_iterator_rangeF<
0093 BOOST_STRING_TYPENAME
0094 range_value<SequenceSequenceT>::type,
0095 input_iterator_type> copy_range_type;
0096
0097 input_iterator_type InputEnd=::boost::end(lit_input);
0098
0099 typedef transform_iterator<copy_range_type, find_iterator_type>
0100 transform_iter_type;
0101
0102 transform_iter_type itBegin=
0103 ::boost::make_transform_iterator(
0104 find_iterator_type( ::boost::begin(lit_input), InputEnd, Finder ),
0105 copy_range_type());
0106
0107 transform_iter_type itEnd=
0108 ::boost::make_transform_iterator(
0109 find_iterator_type(),
0110 copy_range_type());
0111
0112 SequenceSequenceT Tmp(itBegin, itEnd);
0113
0114 Result.swap(Tmp);
0115 return Result;
0116 }
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142 template<
0143 typename SequenceSequenceT,
0144 typename RangeT,
0145 typename FinderT >
0146 inline SequenceSequenceT&
0147 iter_split(
0148 SequenceSequenceT& Result,
0149 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0150 RangeT&& Input,
0151 #else
0152 RangeT& Input,
0153 #endif
0154 FinderT Finder )
0155 {
0156 BOOST_CONCEPT_ASSERT((
0157 FinderConcept<FinderT,
0158 BOOST_STRING_TYPENAME range_iterator<RangeT>::type>
0159 ));
0160
0161 iterator_range<BOOST_STRING_TYPENAME range_iterator<RangeT>::type> lit_input(::boost::as_literal(Input));
0162
0163 typedef BOOST_STRING_TYPENAME
0164 range_iterator<RangeT>::type input_iterator_type;
0165 typedef split_iterator<input_iterator_type> find_iterator_type;
0166 typedef detail::copy_iterator_rangeF<
0167 BOOST_STRING_TYPENAME
0168 range_value<SequenceSequenceT>::type,
0169 input_iterator_type> copy_range_type;
0170
0171 input_iterator_type InputEnd=::boost::end(lit_input);
0172
0173 typedef transform_iterator<copy_range_type, find_iterator_type>
0174 transform_iter_type;
0175
0176 transform_iter_type itBegin=
0177 ::boost::make_transform_iterator(
0178 find_iterator_type( ::boost::begin(lit_input), InputEnd, Finder ),
0179 copy_range_type() );
0180
0181 transform_iter_type itEnd=
0182 ::boost::make_transform_iterator(
0183 find_iterator_type(),
0184 copy_range_type() );
0185
0186 SequenceSequenceT Tmp(itBegin, itEnd);
0187
0188 Result.swap(Tmp);
0189 return Result;
0190 }
0191
0192 }
0193
0194
0195 using algorithm::iter_find;
0196 using algorithm::iter_split;
0197
0198 }
0199
0200
0201 #endif