File indexing completed on 2025-02-22 09:55:54
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_STRING_ERASE_HPP
0012 #define BOOST_STRING_ERASE_HPP
0013
0014 #include <boost/algorithm/string/config.hpp>
0015
0016 #include <boost/range/iterator_range_core.hpp>
0017 #include <boost/range/begin.hpp>
0018 #include <boost/range/end.hpp>
0019 #include <boost/range/iterator.hpp>
0020 #include <boost/range/const_iterator.hpp>
0021
0022 #include <boost/algorithm/string/find_format.hpp>
0023 #include <boost/algorithm/string/finder.hpp>
0024 #include <boost/algorithm/string/formatter.hpp>
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 template<typename OutputIteratorT, typename RangeT>
0050 inline OutputIteratorT erase_range_copy(
0051 OutputIteratorT Output,
0052 const RangeT& Input,
0053 const iterator_range<
0054 BOOST_STRING_TYPENAME
0055 range_const_iterator<RangeT>::type>& SearchRange )
0056 {
0057 return ::boost::algorithm::find_format_copy(
0058 Output,
0059 Input,
0060 ::boost::algorithm::range_finder(SearchRange),
0061 ::boost::algorithm::empty_formatter(Input) );
0062 }
0063
0064
0065
0066
0067
0068 template<typename SequenceT>
0069 inline SequenceT erase_range_copy(
0070 const SequenceT& Input,
0071 const iterator_range<
0072 BOOST_STRING_TYPENAME
0073 range_const_iterator<SequenceT>::type>& SearchRange )
0074 {
0075 return ::boost::algorithm::find_format_copy(
0076 Input,
0077 ::boost::algorithm::range_finder(SearchRange),
0078 ::boost::algorithm::empty_formatter(Input) );
0079 }
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089 template<typename SequenceT>
0090 inline void erase_range(
0091 SequenceT& Input,
0092 const iterator_range<
0093 BOOST_STRING_TYPENAME
0094 range_iterator<SequenceT>::type>& SearchRange )
0095 {
0096 ::boost::algorithm::find_format(
0097 Input,
0098 ::boost::algorithm::range_finder(SearchRange),
0099 ::boost::algorithm::empty_formatter(Input) );
0100 }
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118 template<
0119 typename OutputIteratorT,
0120 typename Range1T,
0121 typename Range2T>
0122 inline OutputIteratorT erase_first_copy(
0123 OutputIteratorT Output,
0124 const Range1T& Input,
0125 const Range2T& Search )
0126 {
0127 return ::boost::algorithm::find_format_copy(
0128 Output,
0129 Input,
0130 ::boost::algorithm::first_finder(Search),
0131 ::boost::algorithm::empty_formatter(Input) );
0132 }
0133
0134
0135
0136
0137
0138 template<typename SequenceT, typename RangeT>
0139 inline SequenceT erase_first_copy(
0140 const SequenceT& Input,
0141 const RangeT& Search )
0142 {
0143 return ::boost::algorithm::find_format_copy(
0144 Input,
0145 ::boost::algorithm::first_finder(Search),
0146 ::boost::algorithm::empty_formatter(Input) );
0147 }
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157 template<typename SequenceT, typename RangeT>
0158 inline void erase_first(
0159 SequenceT& Input,
0160 const RangeT& Search )
0161 {
0162 ::boost::algorithm::find_format(
0163 Input,
0164 ::boost::algorithm::first_finder(Search),
0165 ::boost::algorithm::empty_formatter(Input) );
0166 }
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186 template<
0187 typename OutputIteratorT,
0188 typename Range1T,
0189 typename Range2T>
0190 inline OutputIteratorT ierase_first_copy(
0191 OutputIteratorT Output,
0192 const Range1T& Input,
0193 const Range2T& Search,
0194 const std::locale& Loc=std::locale() )
0195 {
0196 return ::boost::algorithm::find_format_copy(
0197 Output,
0198 Input,
0199 ::boost::algorithm::first_finder(Search, is_iequal(Loc)),
0200 ::boost::algorithm::empty_formatter(Input) );
0201 }
0202
0203
0204
0205
0206
0207 template<typename SequenceT, typename RangeT>
0208 inline SequenceT ierase_first_copy(
0209 const SequenceT& Input,
0210 const RangeT& Search,
0211 const std::locale& Loc=std::locale() )
0212 {
0213 return ::boost::algorithm::find_format_copy(
0214 Input,
0215 ::boost::algorithm::first_finder(Search, is_iequal(Loc)),
0216 ::boost::algorithm::empty_formatter(Input) );
0217 }
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228 template<typename SequenceT, typename RangeT>
0229 inline void ierase_first(
0230 SequenceT& Input,
0231 const RangeT& Search,
0232 const std::locale& Loc=std::locale() )
0233 {
0234 ::boost::algorithm::find_format(
0235 Input,
0236 ::boost::algorithm::first_finder(Search, is_iequal(Loc)),
0237 ::boost::algorithm::empty_formatter(Input) );
0238 }
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256 template<
0257 typename OutputIteratorT,
0258 typename Range1T,
0259 typename Range2T>
0260 inline OutputIteratorT erase_last_copy(
0261 OutputIteratorT Output,
0262 const Range1T& Input,
0263 const Range2T& Search )
0264 {
0265 return ::boost::algorithm::find_format_copy(
0266 Output,
0267 Input,
0268 ::boost::algorithm::last_finder(Search),
0269 ::boost::algorithm::empty_formatter(Input) );
0270 }
0271
0272
0273
0274
0275
0276 template<typename SequenceT, typename RangeT>
0277 inline SequenceT erase_last_copy(
0278 const SequenceT& Input,
0279 const RangeT& Search )
0280 {
0281 return ::boost::algorithm::find_format_copy(
0282 Input,
0283 ::boost::algorithm::last_finder(Search),
0284 ::boost::algorithm::empty_formatter(Input) );
0285 }
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295 template<typename SequenceT, typename RangeT>
0296 inline void erase_last(
0297 SequenceT& Input,
0298 const RangeT& Search )
0299 {
0300 ::boost::algorithm::find_format(
0301 Input,
0302 ::boost::algorithm::last_finder(Search),
0303 ::boost::algorithm::empty_formatter(Input) );
0304 }
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324 template<
0325 typename OutputIteratorT,
0326 typename Range1T,
0327 typename Range2T>
0328 inline OutputIteratorT ierase_last_copy(
0329 OutputIteratorT Output,
0330 const Range1T& Input,
0331 const Range2T& Search,
0332 const std::locale& Loc=std::locale() )
0333 {
0334 return ::boost::algorithm::find_format_copy(
0335 Output,
0336 Input,
0337 ::boost::algorithm::last_finder(Search, is_iequal(Loc)),
0338 ::boost::algorithm::empty_formatter(Input) );
0339 }
0340
0341
0342
0343
0344
0345 template<typename SequenceT, typename RangeT>
0346 inline SequenceT ierase_last_copy(
0347 const SequenceT& Input,
0348 const RangeT& Search,
0349 const std::locale& Loc=std::locale() )
0350 {
0351 return ::boost::algorithm::find_format_copy(
0352 Input,
0353 ::boost::algorithm::last_finder(Search, is_iequal(Loc)),
0354 ::boost::algorithm::empty_formatter(Input) );
0355 }
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366 template<typename SequenceT, typename RangeT>
0367 inline void ierase_last(
0368 SequenceT& Input,
0369 const RangeT& Search,
0370 const std::locale& Loc=std::locale() )
0371 {
0372 ::boost::algorithm::find_format(
0373 Input,
0374 ::boost::algorithm::last_finder(Search, is_iequal(Loc)),
0375 ::boost::algorithm::empty_formatter(Input) );
0376 }
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397 template<
0398 typename OutputIteratorT,
0399 typename Range1T,
0400 typename Range2T>
0401 inline OutputIteratorT erase_nth_copy(
0402 OutputIteratorT Output,
0403 const Range1T& Input,
0404 const Range2T& Search,
0405 int Nth )
0406 {
0407 return ::boost::algorithm::find_format_copy(
0408 Output,
0409 Input,
0410 ::boost::algorithm::nth_finder(Search, Nth),
0411 ::boost::algorithm::empty_formatter(Input) );
0412 }
0413
0414
0415
0416
0417
0418 template<typename SequenceT, typename RangeT>
0419 inline SequenceT erase_nth_copy(
0420 const SequenceT& Input,
0421 const RangeT& Search,
0422 int Nth )
0423 {
0424 return ::boost::algorithm::find_format_copy(
0425 Input,
0426 ::boost::algorithm::nth_finder(Search, Nth),
0427 ::boost::algorithm::empty_formatter(Input) );
0428 }
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440 template<typename SequenceT, typename RangeT>
0441 inline void erase_nth(
0442 SequenceT& Input,
0443 const RangeT& Search,
0444 int Nth )
0445 {
0446 ::boost::algorithm::find_format(
0447 Input,
0448 ::boost::algorithm::nth_finder(Search, Nth),
0449 ::boost::algorithm::empty_formatter(Input) );
0450 }
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470
0471
0472 template<
0473 typename OutputIteratorT,
0474 typename Range1T,
0475 typename Range2T>
0476 inline OutputIteratorT ierase_nth_copy(
0477 OutputIteratorT Output,
0478 const Range1T& Input,
0479 const Range2T& Search,
0480 int Nth,
0481 const std::locale& Loc=std::locale() )
0482 {
0483 return ::boost::algorithm::find_format_copy(
0484 Output,
0485 Input,
0486 ::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
0487 ::boost::algorithm::empty_formatter(Input) );
0488 }
0489
0490
0491
0492
0493
0494 template<typename SequenceT, typename RangeT>
0495 inline SequenceT ierase_nth_copy(
0496 const SequenceT& Input,
0497 const RangeT& Search,
0498 int Nth,
0499 const std::locale& Loc=std::locale() )
0500 {
0501 return ::boost::algorithm::find_format_copy(
0502 Input,
0503 ::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
0504 empty_formatter(Input) );
0505 }
0506
0507
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517
0518 template<typename SequenceT, typename RangeT>
0519 inline void ierase_nth(
0520 SequenceT& Input,
0521 const RangeT& Search,
0522 int Nth,
0523 const std::locale& Loc=std::locale() )
0524 {
0525 ::boost::algorithm::find_format(
0526 Input,
0527 ::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
0528 ::boost::algorithm::empty_formatter(Input) );
0529 }
0530
0531
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549 template<
0550 typename OutputIteratorT,
0551 typename Range1T,
0552 typename Range2T>
0553 inline OutputIteratorT erase_all_copy(
0554 OutputIteratorT Output,
0555 const Range1T& Input,
0556 const Range2T& Search )
0557 {
0558 return ::boost::algorithm::find_format_all_copy(
0559 Output,
0560 Input,
0561 ::boost::algorithm::first_finder(Search),
0562 ::boost::algorithm::empty_formatter(Input) );
0563 }
0564
0565
0566
0567
0568
0569 template<typename SequenceT, typename RangeT>
0570 inline SequenceT erase_all_copy(
0571 const SequenceT& Input,
0572 const RangeT& Search )
0573 {
0574 return ::boost::algorithm::find_format_all_copy(
0575 Input,
0576 ::boost::algorithm::first_finder(Search),
0577 ::boost::algorithm::empty_formatter(Input) );
0578 }
0579
0580
0581
0582
0583
0584
0585
0586
0587
0588 template<typename SequenceT, typename RangeT>
0589 inline void erase_all(
0590 SequenceT& Input,
0591 const RangeT& Search )
0592 {
0593 ::boost::algorithm::find_format_all(
0594 Input,
0595 ::boost::algorithm::first_finder(Search),
0596 ::boost::algorithm::empty_formatter(Input) );
0597 }
0598
0599
0600
0601
0602
0603
0604
0605
0606
0607
0608
0609
0610
0611
0612
0613
0614
0615
0616
0617 template<
0618 typename OutputIteratorT,
0619 typename Range1T,
0620 typename Range2T>
0621 inline OutputIteratorT ierase_all_copy(
0622 OutputIteratorT Output,
0623 const Range1T& Input,
0624 const Range2T& Search,
0625 const std::locale& Loc=std::locale() )
0626 {
0627 return ::boost::algorithm::find_format_all_copy(
0628 Output,
0629 Input,
0630 ::boost::algorithm::first_finder(Search, is_iequal(Loc)),
0631 ::boost::algorithm::empty_formatter(Input) );
0632 }
0633
0634
0635
0636
0637
0638 template<typename SequenceT, typename RangeT>
0639 inline SequenceT ierase_all_copy(
0640 const SequenceT& Input,
0641 const RangeT& Search,
0642 const std::locale& Loc=std::locale() )
0643 {
0644 return ::boost::algorithm::find_format_all_copy(
0645 Input,
0646 ::boost::algorithm::first_finder(Search, is_iequal(Loc)),
0647 ::boost::algorithm::empty_formatter(Input) );
0648 }
0649
0650
0651
0652
0653
0654
0655
0656
0657
0658
0659 template<typename SequenceT, typename RangeT>
0660 inline void ierase_all(
0661 SequenceT& Input,
0662 const RangeT& Search,
0663 const std::locale& Loc=std::locale() )
0664 {
0665 ::boost::algorithm::find_format_all(
0666 Input,
0667 ::boost::algorithm::first_finder(Search, is_iequal(Loc)),
0668 ::boost::algorithm::empty_formatter(Input) );
0669 }
0670
0671
0672
0673
0674
0675
0676
0677
0678
0679
0680
0681
0682
0683
0684
0685
0686
0687
0688
0689
0690
0691 template<
0692 typename OutputIteratorT,
0693 typename RangeT>
0694 inline OutputIteratorT erase_head_copy(
0695 OutputIteratorT Output,
0696 const RangeT& Input,
0697 int N )
0698 {
0699 return ::boost::algorithm::find_format_copy(
0700 Output,
0701 Input,
0702 ::boost::algorithm::head_finder(N),
0703 ::boost::algorithm::empty_formatter( Input ) );
0704 }
0705
0706
0707
0708
0709
0710 template<typename SequenceT>
0711 inline SequenceT erase_head_copy(
0712 const SequenceT& Input,
0713 int N )
0714 {
0715 return ::boost::algorithm::find_format_copy(
0716 Input,
0717 ::boost::algorithm::head_finder(N),
0718 ::boost::algorithm::empty_formatter( Input ) );
0719 }
0720
0721
0722
0723
0724
0725
0726
0727
0728
0729
0730
0731
0732 template<typename SequenceT>
0733 inline void erase_head(
0734 SequenceT& Input,
0735 int N )
0736 {
0737 ::boost::algorithm::find_format(
0738 Input,
0739 ::boost::algorithm::head_finder(N),
0740 ::boost::algorithm::empty_formatter( Input ) );
0741 }
0742
0743
0744
0745
0746
0747
0748
0749
0750
0751
0752
0753
0754
0755
0756
0757
0758
0759
0760
0761
0762
0763 template<
0764 typename OutputIteratorT,
0765 typename RangeT>
0766 inline OutputIteratorT erase_tail_copy(
0767 OutputIteratorT Output,
0768 const RangeT& Input,
0769 int N )
0770 {
0771 return ::boost::algorithm::find_format_copy(
0772 Output,
0773 Input,
0774 ::boost::algorithm::tail_finder(N),
0775 ::boost::algorithm::empty_formatter( Input ) );
0776 }
0777
0778
0779
0780
0781
0782 template<typename SequenceT>
0783 inline SequenceT erase_tail_copy(
0784 const SequenceT& Input,
0785 int N )
0786 {
0787 return ::boost::algorithm::find_format_copy(
0788 Input,
0789 ::boost::algorithm::tail_finder(N),
0790 ::boost::algorithm::empty_formatter( Input ) );
0791 }
0792
0793
0794
0795
0796
0797
0798
0799
0800
0801
0802
0803
0804 template<typename SequenceT>
0805 inline void erase_tail(
0806 SequenceT& Input,
0807 int N )
0808 {
0809 ::boost::algorithm::find_format(
0810 Input,
0811 ::boost::algorithm::tail_finder(N),
0812 ::boost::algorithm::empty_formatter( Input ) );
0813 }
0814
0815 }
0816
0817
0818 using algorithm::erase_range_copy;
0819 using algorithm::erase_range;
0820 using algorithm::erase_first_copy;
0821 using algorithm::erase_first;
0822 using algorithm::ierase_first_copy;
0823 using algorithm::ierase_first;
0824 using algorithm::erase_last_copy;
0825 using algorithm::erase_last;
0826 using algorithm::ierase_last_copy;
0827 using algorithm::ierase_last;
0828 using algorithm::erase_nth_copy;
0829 using algorithm::erase_nth;
0830 using algorithm::ierase_nth_copy;
0831 using algorithm::ierase_nth;
0832 using algorithm::erase_all_copy;
0833 using algorithm::erase_all;
0834 using algorithm::ierase_all_copy;
0835 using algorithm::ierase_all;
0836 using algorithm::erase_head_copy;
0837 using algorithm::erase_head;
0838 using algorithm::erase_tail_copy;
0839 using algorithm::erase_tail;
0840
0841 }
0842
0843
0844 #endif