File indexing completed on 2025-02-22 09:55:54
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_STRING_FIND_FORMAT_HPP
0012 #define BOOST_STRING_FIND_FORMAT_HPP
0013
0014 #include <deque>
0015 #include <boost/range/iterator_range_core.hpp>
0016 #include <boost/range/begin.hpp>
0017 #include <boost/range/end.hpp>
0018 #include <boost/range/const_iterator.hpp>
0019 #include <boost/range/as_literal.hpp>
0020
0021 #include <boost/algorithm/string/concept.hpp>
0022 #include <boost/algorithm/string/detail/find_format.hpp>
0023 #include <boost/algorithm/string/detail/find_format_all.hpp>
0024
0025
0026
0027
0028
0029
0030
0031 namespace boost {
0032 namespace algorithm {
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 template<
0053 typename OutputIteratorT,
0054 typename RangeT,
0055 typename FinderT,
0056 typename FormatterT>
0057 inline OutputIteratorT find_format_copy(
0058 OutputIteratorT Output,
0059 const RangeT& Input,
0060 FinderT Finder,
0061 FormatterT Formatter )
0062 {
0063
0064 BOOST_CONCEPT_ASSERT((
0065 FinderConcept<
0066 FinderT,
0067 BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
0068 ));
0069 BOOST_CONCEPT_ASSERT((
0070 FormatterConcept<
0071 FormatterT,
0072 FinderT,BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
0073 ));
0074
0075 iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_input(::boost::as_literal(Input));
0076
0077 return detail::find_format_copy_impl(
0078 Output,
0079 lit_input,
0080 Formatter,
0081 Finder( ::boost::begin(lit_input), ::boost::end(lit_input) ) );
0082 }
0083
0084
0085
0086
0087
0088 template<
0089 typename SequenceT,
0090 typename FinderT,
0091 typename FormatterT>
0092 inline SequenceT find_format_copy(
0093 const SequenceT& Input,
0094 FinderT Finder,
0095 FormatterT Formatter )
0096 {
0097
0098 BOOST_CONCEPT_ASSERT((
0099 FinderConcept<
0100 FinderT,
0101 BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
0102 ));
0103 BOOST_CONCEPT_ASSERT((
0104 FormatterConcept<
0105 FormatterT,
0106 FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
0107 ));
0108
0109 return detail::find_format_copy_impl(
0110 Input,
0111 Formatter,
0112 Finder(::boost::begin(Input), ::boost::end(Input)));
0113 }
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124 template<
0125 typename SequenceT,
0126 typename FinderT,
0127 typename FormatterT>
0128 inline void find_format(
0129 SequenceT& Input,
0130 FinderT Finder,
0131 FormatterT Formatter)
0132 {
0133
0134 BOOST_CONCEPT_ASSERT((
0135 FinderConcept<
0136 FinderT,
0137 BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
0138 ));
0139 BOOST_CONCEPT_ASSERT((
0140 FormatterConcept<
0141 FormatterT,
0142 FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
0143 ));
0144
0145 detail::find_format_impl(
0146 Input,
0147 Formatter,
0148 Finder(::boost::begin(Input), ::boost::end(Input)));
0149 }
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171 template<
0172 typename OutputIteratorT,
0173 typename RangeT,
0174 typename FinderT,
0175 typename FormatterT>
0176 inline OutputIteratorT find_format_all_copy(
0177 OutputIteratorT Output,
0178 const RangeT& Input,
0179 FinderT Finder,
0180 FormatterT Formatter)
0181 {
0182
0183 BOOST_CONCEPT_ASSERT((
0184 FinderConcept<
0185 FinderT,
0186 BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
0187 ));
0188 BOOST_CONCEPT_ASSERT((
0189 FormatterConcept<
0190 FormatterT,
0191 FinderT,BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
0192 ));
0193
0194 iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_input(::boost::as_literal(Input));
0195
0196 return detail::find_format_all_copy_impl(
0197 Output,
0198 lit_input,
0199 Finder,
0200 Formatter,
0201 Finder(::boost::begin(lit_input), ::boost::end(lit_input)));
0202 }
0203
0204
0205
0206
0207
0208 template<
0209 typename SequenceT,
0210 typename FinderT,
0211 typename FormatterT >
0212 inline SequenceT find_format_all_copy(
0213 const SequenceT& Input,
0214 FinderT Finder,
0215 FormatterT Formatter )
0216 {
0217
0218 BOOST_CONCEPT_ASSERT((
0219 FinderConcept<
0220 FinderT,
0221 BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
0222 ));
0223 BOOST_CONCEPT_ASSERT((
0224 FormatterConcept<
0225 FormatterT,
0226 FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
0227 ));
0228
0229 return detail::find_format_all_copy_impl(
0230 Input,
0231 Finder,
0232 Formatter,
0233 Finder( ::boost::begin(Input), ::boost::end(Input) ) );
0234 }
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246 template<
0247 typename SequenceT,
0248 typename FinderT,
0249 typename FormatterT >
0250 inline void find_format_all(
0251 SequenceT& Input,
0252 FinderT Finder,
0253 FormatterT Formatter )
0254 {
0255
0256 BOOST_CONCEPT_ASSERT((
0257 FinderConcept<
0258 FinderT,
0259 BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
0260 ));
0261 BOOST_CONCEPT_ASSERT((
0262 FormatterConcept<
0263 FormatterT,
0264 FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
0265 ));
0266
0267 detail::find_format_all_impl(
0268 Input,
0269 Finder,
0270 Formatter,
0271 Finder(::boost::begin(Input), ::boost::end(Input)));
0272
0273 }
0274
0275 }
0276
0277
0278 using algorithm::find_format_copy;
0279 using algorithm::find_format;
0280 using algorithm::find_format_all_copy;
0281 using algorithm::find_format_all;
0282
0283 }
0284
0285
0286 #endif