source: NonGTP/Boost/boost/algorithm/string/replace.hpp @ 857

Revision 857, 33.5 KB checked in by igarcia, 19 years ago (diff)
Line 
1//  Boost string_algo library replace.hpp header file  ---------------------------//
2
3//  Copyright Pavol Droba 2002-2003. Use, modification and
4//  distribution is subject to the Boost Software License, Version
5//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
6//  http://www.boost.org/LICENSE_1_0.txt)
7
8//  See http://www.boost.org for updates, documentation, and revision history.
9
10#ifndef BOOST_STRING_REPLACE_HPP
11#define BOOST_STRING_REPLACE_HPP
12
13#include <boost/algorithm/string/config.hpp>
14
15#include <boost/range/iterator_range.hpp>
16#include <boost/range/begin.hpp>
17#include <boost/range/end.hpp>
18#include <boost/range/iterator.hpp>
19#include <boost/range/const_iterator.hpp>
20
21#include <boost/algorithm/string/find_format.hpp>
22#include <boost/algorithm/string/finder.hpp>
23#include <boost/algorithm/string/formatter.hpp>
24#include <boost/algorithm/string/compare.hpp>
25
26/*! \file
27    Defines various replace algorithms. Each algorithm replaces
28    part(s) of the input according to set of searching and replace criteria.
29*/
30
31namespace boost {
32    namespace algorithm {
33
34//  replace_range --------------------------------------------------------------------//
35
36        //! Replace range algorithm
37        /*!
38            Replace the given range in the input string.
39            The result is a modified copy of the input. It is returned as a sequence
40            or copied to the output iterator.
41           
42            \param Output An output iterator to which the result will be copied
43            \param Input An input string
44            \param SearchRange A range in the input to be substituted
45            \param Format A substitute string
46            \return An output iterator pointing just after the last inserted character or
47                a modified copy of the input
48
49              \note The second variant of this function provides the strong exception-safety guarantee
50        */
51        template<
52            typename OutputIteratorT,
53            typename Range1T,
54            typename Range2T>
55        inline OutputIteratorT replace_range_copy(
56            OutputIteratorT Output,
57            const Range1T& Input,
58            const iterator_range<
59                BOOST_STRING_TYPENAME
60                    range_const_iterator<Range1T>::type>& SearchRange,
61            const Range2T& Format)
62        {
63            return find_format_copy(
64                Output,
65                Input,
66                range_finder(SearchRange),
67                const_formatter(Format));
68        }
69
70        //! Replace range algorithm
71        /*!
72            \overload
73        */
74        template<typename SequenceT, typename RangeT>
75        inline SequenceT replace_range_copy(
76            const SequenceT& Input,
77            const iterator_range<
78                BOOST_STRING_TYPENAME
79                    range_const_iterator<SequenceT>::type>& SearchRange,
80            const RangeT& Format)
81        {
82            return find_format_copy(
83                Input,
84                range_finder(SearchRange),
85                const_formatter(Format));
86        }
87
88        //! Replace range algorithm
89        /*!
90            Replace the given range in the input string.
91            The input sequence is modified in-place.
92
93            \param Input An input string
94            \param SearchRange A range in the input to be substituted
95            \param Format A substitute string
96        */
97        template<typename SequenceT, typename RangeT>
98        inline void replace_range(
99            SequenceT& Input,
100            const iterator_range<
101                BOOST_STRING_TYPENAME
102                    range_iterator<SequenceT>::type>& SearchRange,
103            const RangeT& Format)
104        {
105            find_format(
106                Input,
107                range_finder(SearchRange),
108                const_formatter(Format));
109        }
110
111//  replace_first --------------------------------------------------------------------//
112
113        //! Replace first algorithm
114        /*!
115            Replace the first match of the search substring in the input
116            with the format string.
117            The result is a modified copy of the input. It is returned as a sequence
118            or copied to the output iterator.
119           
120            \param Output An output iterator to which the result will be copied
121            \param Input An input string
122            \param Search A substring to be searched for
123            \param Format A substitute string
124            \return An output iterator pointing just after the last inserted character or
125                    a modified copy of the input
126
127              \note The second variant of this function provides the strong exception-safety guarantee
128        */
129        template<
130            typename OutputIteratorT,
131            typename Range1T,
132            typename Range2T,
133            typename Range3T>
134        inline OutputIteratorT replace_first_copy(
135            OutputIteratorT Output,
136            const Range1T& Input,
137            const Range2T& Search,
138            const Range3T& Format)
139        {
140            return find_format_copy(
141                Output,
142                Input,
143                first_finder(Search),
144                const_formatter(Format) );
145        }
146
147        //! Replace first algorithm
148        /*!
149            \overload
150        */
151        template<typename SequenceT, typename Range1T, typename Range2T>
152        inline SequenceT replace_first_copy(
153            const SequenceT& Input,
154            const Range1T& Search,
155            const Range2T& Format )
156        {
157            return find_format_copy(
158                Input,
159                first_finder(Search),
160                const_formatter(Format) );
161        }
162
163        //! Replace first algorithm
164        /*!
165            replace the first match of the search substring in the input
166            with the format string. The input sequence is modified in-place.
167
168            \param Input An input string
169            \param Search A substring to be searched for
170            \param Format A substitute string
171        */
172        template<typename SequenceT, typename Range1T, typename Range2T>
173        inline void replace_first(
174            SequenceT& Input,
175            const Range1T& Search,
176            const Range2T& Format )
177        {
178            find_format(
179                Input,
180                first_finder(Search),
181                const_formatter(Format) );
182        }
183
184//  replace_first ( case insensitive ) ---------------------------------------------//
185
186        //! Replace first algorithm ( case insensitive )
187        /*!
188            Replace the first match of the search substring in the input
189            with the format string.
190            The result is a modified copy of the input. It is returned as a sequence
191            or copied to the output iterator.
192            Searching is case insensitive.
193
194            \param Output An output iterator to which the result will be copied
195            \param Input An input string
196            \param Search A substring to be searched for
197            \param Format A substitute string
198            \param Loc A locale used for case insensitive comparison
199            \return An output iterator pointing just after the last inserted character or
200                a modified copy of the input
201
202             \note The second variant of this function provides the strong exception-safety guarantee
203        */
204        template<
205            typename OutputIteratorT,
206            typename Range1T,
207            typename Range2T,
208            typename Range3T>
209        inline OutputIteratorT ireplace_first_copy(
210            OutputIteratorT Output,
211            const Range1T& Input,
212            const Range2T& Search,
213            const Range3T& Format,
214            const std::locale& Loc=std::locale() )
215        {
216            return find_format_copy(
217                Output,
218                Input,
219                first_finder(Search, is_iequal(Loc)),
220                const_formatter(Format) );
221        }
222
223        //! Replace first algorithm ( case insensitive )
224        /*!
225            \overload
226        */
227        template<typename SequenceT, typename Range2T, typename Range1T>
228        inline SequenceT ireplace_first_copy(
229            const SequenceT& Input,
230            const Range2T& Search,
231            const Range1T& Format,
232            const std::locale& Loc=std::locale() )
233        {
234            return find_format_copy(
235                Input,
236                first_finder(Search, is_iequal(Loc)),
237                const_formatter(Format) );
238        }
239
240        //! Replace first algorithm ( case insensitive )
241        /*!
242            Replace the first match of the search substring in the input
243            with the format string. Input sequence is modified in-place.
244            Searching is case insensitive.
245
246            \param Input An input string
247            \param Search A substring to be searched for
248            \param Format A substitute string
249            \param Loc A locale used for case insensitive comparison
250        */
251        template<typename SequenceT, typename Range1T, typename Range2T>
252        inline void ireplace_first(
253            SequenceT& Input,
254            const Range1T& Search,
255            const Range2T& Format,
256            const std::locale& Loc=std::locale() )
257        {
258            find_format(
259                Input,
260                first_finder(Search, is_iequal(Loc)),
261                const_formatter(Format) );
262        }
263
264//  replace_last --------------------------------------------------------------------//
265
266        //! Replace last algorithm
267        /*!
268            Replace the last match of the search string in the input
269            with the format string.
270            The result is a modified copy of the input. It is returned as a sequence
271            or copied to the output iterator.
272
273            \param Output An output iterator to which the result will be copied
274            \param Input An input string
275            \param Search A substring to be searched for
276            \param Format A substitute string
277            \return An output iterator pointing just after the last inserted character or
278                    a modified copy of the input           
279
280              \note The second variant of this function provides the strong exception-safety guarantee
281        */
282        template<
283            typename OutputIteratorT,
284            typename Range1T,
285            typename Range2T,
286            typename Range3T>
287        inline OutputIteratorT replace_last_copy(
288            OutputIteratorT Output,
289            const Range1T& Input,
290            const Range2T& Search,
291            const Range3T& Format )
292        {
293            return find_format_copy(
294                Output,
295                Input,
296                last_finder(Search),
297                const_formatter(Format) );
298        }
299
300        //! Replace last algorithm
301        /*!
302            \overload
303        */
304        template<typename SequenceT, typename Range1T, typename Range2T>
305        inline SequenceT replace_last_copy(
306            const SequenceT& Input,
307            const Range1T& Search,
308            const Range2T& Format )
309        {
310            return find_format_copy(
311                Input,
312                last_finder(Search),
313                const_formatter(Format) );
314        }
315
316        //! Replace last algorithm
317        /*!
318            Replace the last match of the search string in the input
319            with the format string. Input sequence is modified in-place.
320
321            \param Input An input string
322            \param Search A substring to be searched for
323            \param Format A substitute string
324        */
325        template<typename SequenceT, typename Range1T, typename Range2T>
326        inline void replace_last(
327            SequenceT& Input,
328            const Range1T& Search,
329            const Range2T& Format )
330        {
331            find_format(
332                Input,
333                last_finder(Search),
334                const_formatter(Format) );
335        }
336
337//  replace_last ( case insensitive ) -----------------------------------------------//
338
339        //! Replace last algorithm ( case insensitive )
340        /*!
341            Replace the last match of the search string in the input
342            with the format string.
343            The result is a modified copy of the input. It is returned as a sequence
344            or copied to the output iterator.
345            Searching is case insensitive.
346
347            \param Output An output iterator to which the result will be copied
348            \param Input An input string
349            \param Search A substring to be searched for
350            \param Format A substitute string
351            \param Loc A locale used for case insensitive comparison
352            \return An output iterator pointing just after the last inserted character or
353                    a modified copy of the input 
354
355            \note The second variant of this function provides the strong exception-safety guarantee
356        */
357        template<
358            typename OutputIteratorT,
359            typename Range1T,
360            typename Range2T,
361            typename Range3T>
362        inline OutputIteratorT ireplace_last_copy(
363            OutputIteratorT Output,
364            const Range1T& Input,
365            const Range2T& Search,
366            const Range3T& Format,
367            const std::locale& Loc=std::locale() )
368        {
369            return find_format_copy(
370                Output,
371                Input,
372                last_finder(Search, is_iequal(Loc)),
373                const_formatter(Format) );
374        }
375
376        //! Replace last algorithm ( case insensitive )
377        /*!
378            \overload
379        */
380        template<typename SequenceT, typename Range1T, typename Range2T>
381        inline SequenceT ireplace_last_copy(
382            const SequenceT& Input,
383            const Range1T& Search,
384            const Range2T& Format,
385            const std::locale& Loc=std::locale() )
386        {
387            return find_format_copy(
388                Input,
389                last_finder(Search, is_iequal(Loc)),
390                const_formatter(Format) );
391        }
392
393        //! Replace last algorithm ( case insensitive )
394        /*!
395            Replace the last match of the search string in the input
396            with the format string.The input sequence is modified in-place.
397            Searching is case insensitive.
398
399            \param Input An input string
400            \param Search A substring to be searched for
401            \param Format A substitute string
402            \param Loc A locale used for case insensitive comparison
403            \return A reference to the modified input
404        */
405        template<typename SequenceT, typename Range1T, typename Range2T>
406        inline void ireplace_last(
407            SequenceT& Input,
408            const Range1T& Search,
409            const Range2T& Format,
410            const std::locale& Loc=std::locale() )
411        {
412            find_format(
413                Input,
414                last_finder(Search, is_iequal(Loc)),
415                const_formatter(Format) );
416        }
417
418//  replace_nth --------------------------------------------------------------------//
419
420        //! Replace nth algorithm
421        /*!
422            Replace an Nth (zero-indexed) match of the search string in the input
423            with the format string.
424            The result is a modified copy of the input. It is returned as a sequence
425            or copied to the output iterator.
426
427            \param Output An output iterator to which the result will be copied
428            \param Input An input string
429            \param Search A substring to be searched for
430            \param Nth An index of the match to be replaced. The index is 0-based.
431            \param Format A substitute string
432            \return An output iterator pointing just after the last inserted character or
433                a modified copy of the input
434
435            \note The second variant of this function provides the strong exception-safety guarantee
436        */
437        template<
438            typename OutputIteratorT,
439            typename Range1T,
440            typename Range2T,
441            typename Range3T>
442        inline OutputIteratorT replace_nth_copy(
443            OutputIteratorT Output,
444            const Range1T& Input,
445            const Range2T& Search,
446            unsigned int Nth,
447            const Range3T& Format )
448        {
449            return find_format_copy(
450                Output,
451                Input,
452                nth_finder(Search, Nth),
453                const_formatter(Format) );
454        }
455
456        //! Replace nth algorithm
457        /*!
458            \overload
459        */
460        template<typename SequenceT, typename Range1T, typename Range2T>
461        inline SequenceT replace_nth_copy(
462            const SequenceT& Input,
463            const Range1T& Search,
464            unsigned int Nth,
465            const Range2T& Format )
466        {
467            return find_format_copy(
468                Input,
469                nth_finder(Search, Nth),
470                const_formatter(Format) );
471        }
472
473        //! Replace nth algorithm
474        /*!
475            Replace an Nth (zero-indexed) match of the search string in the input
476            with the format string. Input sequence is modified in-place.
477
478            \param Input An input string
479            \param Search A substring to be searched for
480            \param Nth An index of the match to be replaced. The index is 0-based.
481            \param Format A substitute string
482        */
483        template<typename SequenceT, typename Range1T, typename Range2T>
484        inline void replace_nth(
485            SequenceT& Input,
486            const Range1T& Search,
487            unsigned int Nth,
488            const Range2T& Format )
489        {
490            find_format(
491                Input,
492                nth_finder(Search, Nth),
493                const_formatter(Format) );
494        }
495
496//  replace_nth ( case insensitive ) -----------------------------------------------//
497       
498        //! Replace nth algorithm ( case insensitive )
499        /*!
500            Replace an Nth (zero-indexed) match of the search string in the input
501            with the format string.
502            The result is a modified copy of the input. It is returned as a sequence
503            or copied to the output iterator.
504            Searching is case insensitive.
505
506            \param Output An output iterator to which the result will be copied
507            \param Input An input string
508            \param Search A substring to be searched for
509            \param Nth An index of the match to be replaced. The index is 0-based.
510            \param Format A substitute string
511            \param Loc A locale used for case insensitive comparison
512            \return An output iterator pointing just after the last inserted character or
513                    a modified copy of the input           
514
515            \note The second variant of this function provides the strong exception-safety guarantee
516       */
517        template<
518            typename OutputIteratorT,
519            typename Range1T,
520            typename Range2T,
521            typename Range3T>
522        inline OutputIteratorT ireplace_nth_copy(
523            OutputIteratorT Output,
524            const Range1T& Input,
525            const Range2T& Search,
526            unsigned int Nth,
527            const Range3T& Format,
528            const std::locale& Loc=std::locale() )
529        {
530            return find_format_copy(
531                Output,
532                Input,
533                nth_finder(Search, Nth, is_iequal(Loc) ),
534                const_formatter(Format) );
535        }
536
537        //! Replace nth algorithm ( case insensitive )
538        /*!
539            \overload
540        */
541        template<typename SequenceT, typename Range1T, typename Range2T>
542        inline SequenceT ireplace_nth_copy(
543            const SequenceT& Input,
544            const Range1T& Search,
545            unsigned int Nth,
546            const Range2T& Format,
547            const std::locale& Loc=std::locale() )
548        {
549            return find_format_copy(
550                Input,
551                nth_finder(Search, Nth, is_iequal(Loc)),
552                const_formatter(Format) );
553        }
554
555        //! Replace nth algorithm ( case insensitive )
556        /*!
557            Replace an Nth (zero-indexed) match of the search string in the input
558            with the format string. Input sequence is modified in-place.
559            Searching is case insensitive.
560
561            \param Input An input string
562            \param Search A substring to be searched for
563            \param Nth An index of the match to be replaced. The index is 0-based.
564            \param Format A substitute string
565            \param Loc A locale used for case insensitive comparison
566        */
567        template<typename SequenceT, typename Range1T, typename Range2T>
568        inline void ireplace_nth(
569            SequenceT& Input,
570            const Range1T& Search,
571            unsigned int Nth,
572            const Range2T& Format,
573            const std::locale& Loc=std::locale() )
574        {
575            find_format(
576                Input,
577                nth_finder(Search, Nth, is_iequal(Loc)),
578                const_formatter(Format) );
579        }
580
581//  replace_all --------------------------------------------------------------------//
582
583        //! Replace all algorithm
584        /*!
585            Replace all occurrences of the search string in the input
586            with the format string.
587            The result is a modified copy of the input. It is returned as a sequence
588            or copied to the output iterator.
589
590            \param Output An output iterator to which the result will be copied
591            \param Input An input string
592            \param Search A substring to be searched for
593            \param Format A substitute string
594            \return An output iterator pointing just after the last inserted character or
595                    a modified copy of the input
596
597             \note The second variant of this function provides the strong exception-safety guarantee
598        */
599        template<
600            typename OutputIteratorT,
601            typename Range1T,
602            typename Range2T,
603            typename Range3T>
604        inline OutputIteratorT replace_all_copy(
605            OutputIteratorT Output,
606            const Range1T& Input,
607            const Range2T& Search,
608            const Range3T& Format )
609        {
610            return find_format_all_copy(
611                Output,
612                Input,
613                first_finder(Search),
614                const_formatter(Format) );
615        }
616
617        //! Replace all algorithm
618        /*!
619            \overload
620        */
621        template<typename SequenceT, typename Range1T, typename Range2T>
622        inline SequenceT replace_all_copy(
623            const SequenceT& Input,
624            const Range1T& Search,
625            const Range2T& Format )
626        {
627            return find_format_all_copy(
628                Input,
629                first_finder(Search),
630                const_formatter(Format) );
631        }
632
633        //! Replace all algorithm
634        /*!
635            Replace all occurrences of the search string in the input
636            with the format string. The input sequence is modified in-place.
637
638            \param Input An input string
639            \param Search A substring to be searched for
640            \param Format A substitute string
641            \return A reference to the modified input
642        */
643        template<typename SequenceT, typename Range1T, typename Range2T>
644        inline void replace_all(
645            SequenceT& Input,
646            const Range1T& Search,
647            const Range2T& Format )
648        {
649            find_format_all(
650                Input,
651                first_finder(Search),
652                const_formatter(Format) );
653        }
654       
655//  replace_all ( case insensitive ) -----------------------------------------------//
656
657        //! Replace all algorithm ( case insensitive )
658        /*!
659            Replace all occurrences of the search string in the input
660            with the format string.
661            The result is a modified copy of the input. It is returned as a sequence
662            or copied to the output iterator.
663            Searching is case insensitive.
664
665            \param Output An output iterator to which the result will be copied
666            \param Input An input string
667            \param Search A substring to be searched for
668            \param Format A substitute string
669            \param Loc A locale used for case insensitive comparison
670            \return An output iterator pointing just after the last inserted character or
671                    a modified copy of the input
672
673            \note The second variant of this function provides the strong exception-safety guarantee
674        */
675        template<
676            typename OutputIteratorT,
677            typename Range1T,
678            typename Range2T,
679            typename Range3T>
680        inline OutputIteratorT ireplace_all_copy(
681            OutputIteratorT Output,
682            const Range1T& Input,
683            const Range2T& Search,
684            const Range3T& Format,
685            const std::locale& Loc=std::locale() )
686        {
687            return find_format_all_copy(
688                Output,
689                Input,
690                first_finder(Search, is_iequal(Loc)),
691                const_formatter(Format) );
692        }
693
694        //! Replace all algorithm ( case insensitive )
695        /*!
696            \overload
697        */
698        template<typename SequenceT, typename Range1T, typename Range2T>
699        inline SequenceT ireplace_all_copy(
700            const SequenceT& Input,
701            const Range1T& Search,
702            const Range2T& Format,
703            const std::locale& Loc=std::locale() )
704        {
705            return find_format_all_copy(
706                Input,
707                first_finder(Search, is_iequal(Loc)),
708                const_formatter(Format) );
709        }
710
711        //! Replace all algorithm ( case insensitive )
712        /*!
713            Replace all occurrences of the search string in the input
714            with the format string.The input sequence is modified in-place.
715            Searching is case insensitive.
716
717            \param Input An input string
718            \param Search A substring to be searched for
719            \param Format A substitute string
720            \param Loc A locale used for case insensitive comparison
721        */
722        template<typename SequenceT, typename Range1T, typename Range2T>
723        inline void ireplace_all(
724            SequenceT& Input,
725            const Range1T& Search,
726            const Range2T& Format,
727            const std::locale& Loc=std::locale() )
728        {
729            find_format_all(
730                Input,
731                first_finder(Search, is_iequal(Loc)),
732                const_formatter(Format) );
733        }
734       
735//  replace_head --------------------------------------------------------------------//
736
737        //! Replace head algorithm
738        /*!
739            Replace the head of the input with the given format string.
740            The head is a prefix of a string of given size.
741            If the sequence is shorter then required, whole string if
742            considered to be the head.
743            The result is a modified copy of the input. It is returned as a sequence
744            or copied to the output iterator.
745           
746            \param Output An output iterator to which the result will be copied
747            \param Input An input string
748            \param N Length of the head
749            \param Format A substitute string
750            \return An output iterator pointing just after the last inserted character or
751                a modified copy of the input 
752
753            \note The second variant of this function provides the strong exception-safety guarantee
754        */
755        template<
756            typename OutputIteratorT,
757            typename Range1T,
758            typename Range2T>
759        inline OutputIteratorT replace_head_copy(
760            OutputIteratorT Output,
761            const Range1T& Input,
762            unsigned int N,
763            const Range2T& Format )
764        {
765            return find_format_copy(
766                Output,
767                Input,
768                head_finder(N),
769                const_formatter(Format) );
770        }
771
772        //! Replace head algorithm
773        /*!
774            \overload
775        */
776        template<typename SequenceT, typename RangeT>
777        inline SequenceT replace_head_copy(
778            const SequenceT& Input,
779            unsigned int N,
780            const RangeT& Format )
781        {
782            return find_format_copy(
783                Input,
784                head_finder(N),
785                const_formatter(Format) );
786        }
787
788        //! Replace head algorithm
789        /*!
790            Replace the head of the input with the given format string.
791            The head is a prefix of a string of given size.
792            If the sequence is shorter then required, the whole string is
793            considered to be the head. The input sequence is modified in-place.
794
795            \param Input An input string
796            \param N Length of the head
797            \param Format A substitute string
798        */
799        template<typename SequenceT, typename RangeT>
800        inline void replace_head(
801            SequenceT& Input,
802            unsigned int N,
803            const RangeT& Format )
804        {
805            find_format(
806                Input,
807                head_finder(N),
808                const_formatter(Format) );
809        }
810
811//  replace_tail --------------------------------------------------------------------//
812
813        //! Replace tail algorithm
814        /*!
815            Replace the tail of the input with the given format string.
816            The tail is a suffix of a string of given size.
817            If the sequence is shorter then required, whole string is
818            considered to be the tail.
819            The result is a modified copy of the input. It is returned as a sequence
820            or copied to the output iterator.
821
822            \param Output An output iterator to which the result will be copied
823            \param Input An input string
824            \param N Length of the tail
825            \param Format A substitute string
826            \return An output iterator pointing just after the last inserted character or
827                    a modified copy of the input   
828
829              \note The second variant of this function provides the strong exception-safety guarantee
830        */
831        template<
832            typename OutputIteratorT,
833            typename Range1T,
834            typename Range2T>
835        inline OutputIteratorT replace_tail_copy(
836            OutputIteratorT Output,
837            const Range1T& Input,
838            unsigned int N,
839            const Range2T& Format )
840        {
841            return find_format_copy(
842                Output,
843                Input,
844                tail_finder(N),
845                const_formatter(Format) );
846        }
847
848        //! Replace tail algorithm
849        /*!
850            \overload
851        */
852        template<typename SequenceT, typename RangeT>
853        inline SequenceT replace_tail_copy(
854            const SequenceT& Input,
855            unsigned int N,
856            const RangeT& Format )
857        {
858            return find_format_copy(
859                Input,
860                tail_finder(N),
861                const_formatter(Format) );
862        }
863
864        //! Replace tail algorithm
865        /*!
866            Replace the tail of the input with the given format sequence.
867            The tail is a suffix of a string of given size.
868            If the sequence is shorter then required, the whole string is
869            considered to be the tail. The input sequence is modified in-place.
870
871            \param Input An input string
872            \param N Length of the tail
873            \param Format A substitute string
874        */
875        template<typename SequenceT, typename RangeT>
876        inline void replace_tail(
877            SequenceT& Input,
878            unsigned int N,
879            const RangeT& Format )
880        {
881            find_format(
882                Input,
883                tail_finder(N),
884                const_formatter(Format) );
885        }
886
887    } // namespace algorithm
888
889    // pull names to the boost namespace
890    using algorithm::replace_range_copy;
891    using algorithm::replace_range;
892    using algorithm::replace_first_copy;
893    using algorithm::replace_first;
894    using algorithm::ireplace_first_copy;
895    using algorithm::ireplace_first;
896    using algorithm::replace_last_copy;
897    using algorithm::replace_last;
898    using algorithm::ireplace_last_copy;
899    using algorithm::ireplace_last;
900    using algorithm::replace_nth_copy;
901    using algorithm::replace_nth;
902    using algorithm::ireplace_nth_copy;
903    using algorithm::ireplace_nth;
904    using algorithm::replace_all_copy;
905    using algorithm::replace_all;
906    using algorithm::ireplace_all_copy;
907    using algorithm::ireplace_all;
908    using algorithm::replace_head_copy;
909    using algorithm::replace_head;
910    using algorithm::replace_tail_copy;
911    using algorithm::replace_tail;
912
913} // namespace boost
914
915#endif  // BOOST_REPLACE_HPP
Note: See TracBrowser for help on using the repository browser.