| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | //  Boost string_algo library finder.hpp header file  ---------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-07-27 10:27:37 +00:00
										 |  |  | //  Copyright Pavol Droba 2002-2006.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Distributed under the Boost Software License, Version 1.0.
 | 
					
						
							|  |  |  | //    (See accompanying file LICENSE_1_0.txt or copy at
 | 
					
						
							|  |  |  | //          http://www.boost.org/LICENSE_1_0.txt)
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-07-27 10:27:37 +00:00
										 |  |  | //  See http://www.boost.org/ for updates, documentation, and revision history.
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef BOOST_STRING_FINDER_DETAIL_HPP
 | 
					
						
							|  |  |  | #define BOOST_STRING_FINDER_DETAIL_HPP
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <boost/algorithm/string/config.hpp>
 | 
					
						
							|  |  |  | #include <boost/algorithm/string/constants.hpp>
 | 
					
						
							|  |  |  | #include <boost/detail/iterator.hpp>
 | 
					
						
							| 
									
										
										
										
											2005-01-21 16:45:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-17 20:37:20 +00:00
										 |  |  | #include <boost/range/iterator_range_core.hpp>
 | 
					
						
							| 
									
										
										
										
											2005-01-21 16:45:29 +00:00
										 |  |  | #include <boost/range/begin.hpp>
 | 
					
						
							|  |  |  | #include <boost/range/end.hpp>
 | 
					
						
							|  |  |  | #include <boost/range/empty.hpp>
 | 
					
						
							| 
									
										
										
										
											2007-07-01 22:23:55 +00:00
										 |  |  | #include <boost/range/as_literal.hpp>
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace boost { | 
					
						
							|  |  |  |     namespace algorithm { | 
					
						
							|  |  |  |         namespace detail { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //  find first functor -----------------------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // find a subsequence in the sequence ( functor )
 | 
					
						
							|  |  |  |             /*
 | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 Returns a pair <begin,end> marking the subsequence in the sequence. | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 If the find fails, functor returns <End,End> | 
					
						
							|  |  |  |             */ | 
					
						
							|  |  |  |             template<typename SearchIteratorT,typename PredicateT> | 
					
						
							|  |  |  |             struct first_finderF | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 typedef SearchIteratorT search_iterator_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Construction
 | 
					
						
							|  |  |  |                 template< typename SearchT > | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 first_finderF( const SearchT& Search, PredicateT Comp ) : | 
					
						
							| 
									
										
										
										
											2008-06-17 21:04:00 +00:00
										 |  |  |                     m_Search(::boost::begin(Search), ::boost::end(Search)), m_Comp(Comp) {} | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 first_finderF( | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                         search_iterator_type SearchBegin, | 
					
						
							|  |  |  |                         search_iterator_type SearchEnd, | 
					
						
							|  |  |  |                         PredicateT Comp ) : | 
					
						
							|  |  |  |                     m_Search(SearchBegin, SearchEnd), m_Comp(Comp) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 operator()( | 
					
						
							|  |  |  |                     ForwardIteratorT Begin, | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     ForwardIteratorT End ) const | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     typedef iterator_range<ForwardIteratorT> result_type; | 
					
						
							|  |  |  |                     typedef ForwardIteratorT input_iterator_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     // Outer loop
 | 
					
						
							|  |  |  |                     for(input_iterator_type OuterIt=Begin; | 
					
						
							|  |  |  |                         OuterIt!=End; | 
					
						
							|  |  |  |                         ++OuterIt) | 
					
						
							|  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                         // Sanity check
 | 
					
						
							|  |  |  |                         if( boost::empty(m_Search) ) | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                             return result_type( End, End ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                         input_iterator_type InnerIt=OuterIt; | 
					
						
							|  |  |  |                         search_iterator_type SubstrIt=m_Search.begin(); | 
					
						
							|  |  |  |                         for(; | 
					
						
							|  |  |  |                             InnerIt!=End && SubstrIt!=m_Search.end(); | 
					
						
							|  |  |  |                             ++InnerIt,++SubstrIt) | 
					
						
							|  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                             if( !( m_Comp(*InnerIt,*SubstrIt) ) ) | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                                 break; | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                         // Substring matching succeeded
 | 
					
						
							|  |  |  |                         if ( SubstrIt==m_Search.end() ) | 
					
						
							|  |  |  |                             return result_type( OuterIt, InnerIt ); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     return result_type( End, End ); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             private: | 
					
						
							|  |  |  |                 iterator_range<search_iterator_type> m_Search; | 
					
						
							|  |  |  |                 PredicateT m_Comp; | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //  find last functor -----------------------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-28 17:51:56 +00:00
										 |  |  |             // find the last match a subsequence in the sequence ( functor )
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             /*
 | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 Returns a pair <begin,end> marking the subsequence in the sequence. | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 If the find fails, returns <End,End> | 
					
						
							|  |  |  |             */ | 
					
						
							|  |  |  |             template<typename SearchIteratorT, typename PredicateT> | 
					
						
							|  |  |  |             struct last_finderF | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 typedef SearchIteratorT search_iterator_type; | 
					
						
							|  |  |  |                 typedef first_finderF< | 
					
						
							|  |  |  |                     search_iterator_type, | 
					
						
							|  |  |  |                     PredicateT> first_finder_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Construction
 | 
					
						
							|  |  |  |                 template< typename SearchT > | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 last_finderF( const SearchT& Search, PredicateT Comp ) : | 
					
						
							| 
									
										
										
										
											2008-06-17 21:04:00 +00:00
										 |  |  |                     m_Search(::boost::begin(Search), ::boost::end(Search)), m_Comp(Comp) {} | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 last_finderF( | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                         search_iterator_type SearchBegin, | 
					
						
							|  |  |  |                         search_iterator_type SearchEnd, | 
					
						
							|  |  |  |                         PredicateT Comp ) : | 
					
						
							|  |  |  |                     m_Search(SearchBegin, SearchEnd), m_Comp(Comp) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 operator()( | 
					
						
							|  |  |  |                     ForwardIteratorT Begin, | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     ForwardIteratorT End ) const | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     typedef iterator_range<ForwardIteratorT> result_type; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-01-21 16:45:29 +00:00
										 |  |  |                     if( boost::empty(m_Search) ) | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                         return result_type( End, End ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     typedef BOOST_STRING_TYPENAME boost::detail:: | 
					
						
							|  |  |  |                         iterator_traits<ForwardIteratorT>::iterator_category category; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     return findit( Begin, End, category() ); | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |             private: | 
					
						
							|  |  |  |                 // forward iterator
 | 
					
						
							|  |  |  |                 template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 findit( | 
					
						
							|  |  |  |                     ForwardIteratorT Begin, | 
					
						
							|  |  |  |                     ForwardIteratorT End, | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     std::forward_iterator_tag ) const | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     typedef iterator_range<ForwardIteratorT> result_type; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                     first_finder_type first_finder( | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                         m_Search.begin(), m_Search.end(), m_Comp ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     result_type M=first_finder( Begin, End ); | 
					
						
							|  |  |  |                     result_type Last=M; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     while( M ) | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         Last=M; | 
					
						
							| 
									
										
										
										
											2008-06-17 21:04:00 +00:00
										 |  |  |                         M=first_finder( ::boost::end(M), End ); | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     return Last; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // bidirectional iterator
 | 
					
						
							|  |  |  |                 template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 findit( | 
					
						
							|  |  |  |                     ForwardIteratorT Begin, | 
					
						
							|  |  |  |                     ForwardIteratorT End, | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     std::bidirectional_iterator_tag ) const | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     typedef iterator_range<ForwardIteratorT> result_type; | 
					
						
							|  |  |  |                     typedef ForwardIteratorT input_iterator_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     // Outer loop
 | 
					
						
							|  |  |  |                     for(input_iterator_type OuterIt=End; | 
					
						
							|  |  |  |                         OuterIt!=Begin; ) | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         input_iterator_type OuterIt2=--OuterIt; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                         input_iterator_type InnerIt=OuterIt2; | 
					
						
							|  |  |  |                         search_iterator_type SubstrIt=m_Search.begin(); | 
					
						
							|  |  |  |                         for(; | 
					
						
							|  |  |  |                             InnerIt!=End && SubstrIt!=m_Search.end(); | 
					
						
							|  |  |  |                             ++InnerIt,++SubstrIt) | 
					
						
							|  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                             if( !( m_Comp(*InnerIt,*SubstrIt) ) ) | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                                 break; | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                         // Substring matching succeeded
 | 
					
						
							|  |  |  |                         if( SubstrIt==m_Search.end() ) | 
					
						
							|  |  |  |                             return result_type( OuterIt2, InnerIt ); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     return result_type( End, End ); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             private: | 
					
						
							|  |  |  |                 iterator_range<search_iterator_type> m_Search; | 
					
						
							|  |  |  |                 PredicateT m_Comp; | 
					
						
							|  |  |  |             }; | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | //  find n-th functor -----------------------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |             // find the n-th match of a subsequence in the sequence ( functor )
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             /*
 | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 Returns a pair <begin,end> marking the subsequence in the sequence. | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 If the find fails, returns <End,End> | 
					
						
							|  |  |  |             */ | 
					
						
							|  |  |  |             template<typename SearchIteratorT, typename PredicateT> | 
					
						
							|  |  |  |             struct nth_finderF | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 typedef SearchIteratorT search_iterator_type; | 
					
						
							|  |  |  |                 typedef first_finderF< | 
					
						
							|  |  |  |                     search_iterator_type, | 
					
						
							|  |  |  |                     PredicateT> first_finder_type; | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |                 typedef last_finderF< | 
					
						
							|  |  |  |                     search_iterator_type, | 
					
						
							|  |  |  |                     PredicateT> last_finder_type; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 // Construction
 | 
					
						
							|  |  |  |                 template< typename SearchT > | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 nth_finderF( | 
					
						
							|  |  |  |                         const SearchT& Search, | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                         int Nth, | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                         PredicateT Comp) : | 
					
						
							| 
									
										
										
										
											2008-06-17 21:04:00 +00:00
										 |  |  |                     m_Search(::boost::begin(Search), ::boost::end(Search)), | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     m_Nth(Nth), | 
					
						
							|  |  |  |                     m_Comp(Comp) {} | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 nth_finderF( | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                         search_iterator_type SearchBegin, | 
					
						
							|  |  |  |                         search_iterator_type SearchEnd, | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                         int Nth, | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                         PredicateT Comp) : | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                     m_Search(SearchBegin, SearchEnd), | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     m_Nth(Nth), | 
					
						
							|  |  |  |                     m_Comp(Comp) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 operator()( | 
					
						
							|  |  |  |                     ForwardIteratorT Begin, | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     ForwardIteratorT End ) const | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 { | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |                     if(m_Nth>=0) | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         return find_forward(Begin, End, m_Nth); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     else | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         return find_backward(Begin, End, -m_Nth); | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |             private: | 
					
						
							|  |  |  |                 // Implementation helpers
 | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							|  |  |  |                 find_forward( | 
					
						
							|  |  |  |                     ForwardIteratorT Begin, | 
					
						
							|  |  |  |                     ForwardIteratorT End, | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |                     unsigned int N) const | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 { | 
					
						
							|  |  |  |                     typedef iterator_range<ForwardIteratorT> result_type; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                     // Sanity check
 | 
					
						
							|  |  |  |                     if( boost::empty(m_Search) ) | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                         return result_type( End, End ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                     // Instantiate find functor
 | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                     first_finder_type first_finder( | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                         m_Search.begin(), m_Search.end(), m_Comp ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     result_type M( Begin, Begin ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                     for( unsigned int n=0; n<=N; ++n ) | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     { | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                         // find next match
 | 
					
						
							| 
									
										
										
										
											2008-06-17 21:04:00 +00:00
										 |  |  |                         M=first_finder( ::boost::end(M), End ); | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                         if ( !M ) | 
					
						
							|  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                             // Subsequence not found, return
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                             return M; | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     return M; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							|  |  |  |                 find_backward( | 
					
						
							|  |  |  |                     ForwardIteratorT Begin, | 
					
						
							|  |  |  |                     ForwardIteratorT End, | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |                     unsigned int N) const | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 { | 
					
						
							|  |  |  |                     typedef iterator_range<ForwardIteratorT> result_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     // Sanity check
 | 
					
						
							|  |  |  |                     if( boost::empty(m_Search) ) | 
					
						
							|  |  |  |                         return result_type( End, End ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     // Instantiate find functor
 | 
					
						
							|  |  |  |                     last_finder_type last_finder( | 
					
						
							|  |  |  |                         m_Search.begin(), m_Search.end(), m_Comp ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     result_type M( End, End ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     for( unsigned int n=1; n<=N; ++n ) | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         // find next match
 | 
					
						
							| 
									
										
										
										
											2008-06-17 21:04:00 +00:00
										 |  |  |                         M=last_finder( Begin, ::boost::begin(M) ); | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                         if ( !M ) | 
					
						
							|  |  |  |                         { | 
					
						
							|  |  |  |                             // Subsequence not found, return
 | 
					
						
							|  |  |  |                             return M; | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     return M; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             private: | 
					
						
							|  |  |  |                 iterator_range<search_iterator_type> m_Search; | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 int m_Nth; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 PredicateT m_Comp; | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-13 13:21:31 +00:00
										 |  |  | //  find head/tail implementation helpers ---------------------------//
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |             template<typename ForwardIteratorT> | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							|  |  |  |             find_head_impl( | 
					
						
							|  |  |  |                 ForwardIteratorT Begin, | 
					
						
							|  |  |  |                 ForwardIteratorT End, | 
					
						
							|  |  |  |                 unsigned int N, | 
					
						
							|  |  |  |                 std::forward_iterator_tag ) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 typedef ForwardIteratorT input_iterator_type; | 
					
						
							|  |  |  |                 typedef iterator_range<ForwardIteratorT> result_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 input_iterator_type It=Begin; | 
					
						
							|  |  |  |                 for( | 
					
						
							|  |  |  |                     unsigned int Index=0; | 
					
						
							|  |  |  |                     Index<N && It!=End; ++Index,++It ) {}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 return result_type( Begin, It ); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							|  |  |  |             find_head_impl( | 
					
						
							|  |  |  |                 ForwardIteratorT Begin, | 
					
						
							|  |  |  |                 ForwardIteratorT End, | 
					
						
							|  |  |  |                 unsigned int N, | 
					
						
							|  |  |  |                 std::random_access_iterator_tag ) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 typedef iterator_range<ForwardIteratorT> result_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 if ( (End<=Begin) || ( static_cast<unsigned int>(End-Begin) < N ) ) | 
					
						
							|  |  |  |                     return result_type( Begin, End ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 return result_type(Begin,Begin+N); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // Find head implementation
 | 
					
						
							|  |  |  |             template<typename ForwardIteratorT> | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							|  |  |  |             find_head_impl( | 
					
						
							|  |  |  |                 ForwardIteratorT Begin, | 
					
						
							|  |  |  |                 ForwardIteratorT End, | 
					
						
							|  |  |  |                 unsigned int N ) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 typedef BOOST_STRING_TYPENAME boost::detail:: | 
					
						
							|  |  |  |                     iterator_traits<ForwardIteratorT>::iterator_category category; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-05 20:01:10 +00:00
										 |  |  |                 return ::boost::algorithm::detail::find_head_impl( Begin, End, N, category() ); | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |             template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							|  |  |  |             find_tail_impl( | 
					
						
							|  |  |  |                 ForwardIteratorT Begin, | 
					
						
							|  |  |  |                 ForwardIteratorT End, | 
					
						
							| 
									
										
										
										
											2006-02-13 13:21:31 +00:00
										 |  |  |                 unsigned int N, | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 std::forward_iterator_tag ) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 typedef ForwardIteratorT input_iterator_type; | 
					
						
							|  |  |  |                 typedef iterator_range<ForwardIteratorT> result_type; | 
					
						
							| 
									
										
										
										
											2004-03-09 18:09:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 unsigned int Index=0; | 
					
						
							|  |  |  |                 input_iterator_type It=Begin; | 
					
						
							|  |  |  |                 input_iterator_type It2=Begin; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 // Advance It2 by N increments
 | 
					
						
							|  |  |  |                 for( Index=0; Index<N && It2!=End; ++Index,++It2 ) {}; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 // Advance It, It2 to the end
 | 
					
						
							|  |  |  |                 for(; It2!=End; ++It,++It2 ) {}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 return result_type( It, It2 ); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							|  |  |  |             find_tail_impl( | 
					
						
							|  |  |  |                 ForwardIteratorT Begin, | 
					
						
							|  |  |  |                 ForwardIteratorT End, | 
					
						
							| 
									
										
										
										
											2006-02-13 13:21:31 +00:00
										 |  |  |                 unsigned int N, | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 std::bidirectional_iterator_tag ) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 typedef ForwardIteratorT input_iterator_type; | 
					
						
							|  |  |  |                 typedef iterator_range<ForwardIteratorT> result_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 input_iterator_type It=End; | 
					
						
							|  |  |  |                 for( | 
					
						
							|  |  |  |                     unsigned int Index=0; | 
					
						
							|  |  |  |                     Index<N && It!=Begin; ++Index,--It ) {}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 return result_type( It, End ); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							|  |  |  |             find_tail_impl( | 
					
						
							|  |  |  |                 ForwardIteratorT Begin, | 
					
						
							|  |  |  |                 ForwardIteratorT End, | 
					
						
							| 
									
										
										
										
											2006-02-13 13:21:31 +00:00
										 |  |  |                 unsigned int N, | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 std::random_access_iterator_tag ) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 typedef iterator_range<ForwardIteratorT> result_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 if ( (End<=Begin) || ( static_cast<unsigned int>(End-Begin) < N ) ) | 
					
						
							|  |  |  |                     return result_type( Begin, End ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 return result_type( End-N, End ); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |                         // Operation
 | 
					
						
							|  |  |  |             template< typename ForwardIteratorT > | 
					
						
							|  |  |  |             iterator_range<ForwardIteratorT> | 
					
						
							|  |  |  |             find_tail_impl( | 
					
						
							|  |  |  |                 ForwardIteratorT Begin, | 
					
						
							|  |  |  |                 ForwardIteratorT End, | 
					
						
							| 
									
										
										
										
											2006-02-13 13:21:31 +00:00
										 |  |  |                 unsigned int N ) | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |             { | 
					
						
							|  |  |  |                 typedef BOOST_STRING_TYPENAME boost::detail:: | 
					
						
							|  |  |  |                     iterator_traits<ForwardIteratorT>::iterator_category category; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-05 20:01:10 +00:00
										 |  |  |                 return ::boost::algorithm::detail::find_tail_impl( Begin, End, N, category() ); | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-13 13:21:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | //  find head functor -----------------------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // find a head in the sequence ( functor )
 | 
					
						
							|  |  |  |             /*
 | 
					
						
							|  |  |  |                 This functor find a head of the specified range. For | 
					
						
							|  |  |  |                 a specified N, the head is a subsequence of N starting | 
					
						
							|  |  |  |                 elements of the range. | 
					
						
							|  |  |  |             */ | 
					
						
							|  |  |  |             struct head_finderF | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 // Construction
 | 
					
						
							|  |  |  |                 head_finderF( int N ) : m_N(N) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							|  |  |  |                 operator()( | 
					
						
							|  |  |  |                     ForwardIteratorT Begin, | 
					
						
							|  |  |  |                     ForwardIteratorT End ) const | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     if(m_N>=0) | 
					
						
							|  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2009-08-05 20:01:10 +00:00
										 |  |  |                         return ::boost::algorithm::detail::find_head_impl( Begin, End, m_N ); | 
					
						
							| 
									
										
										
										
											2006-02-13 13:21:31 +00:00
										 |  |  |                     } | 
					
						
							|  |  |  |                     else | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         iterator_range<ForwardIteratorT> Res= | 
					
						
							| 
									
										
										
										
											2009-08-05 20:01:10 +00:00
										 |  |  |                             ::boost::algorithm::detail::find_tail_impl( Begin, End, -m_N ); | 
					
						
							| 
									
										
										
										
											2006-02-13 13:21:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-05 20:01:10 +00:00
										 |  |  |                         return ::boost::make_iterator_range(Begin, Res.begin()); | 
					
						
							| 
									
										
										
										
											2006-02-13 13:21:31 +00:00
										 |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             private: | 
					
						
							|  |  |  |                 int m_N; | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //  find tail functor -----------------------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             // find a tail in the sequence ( functor )
 | 
					
						
							|  |  |  |             /*
 | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 This functor find a tail of the specified range. For | 
					
						
							|  |  |  |                 a specified N, the head is a subsequence of N starting | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 elements of the range. | 
					
						
							|  |  |  |             */ | 
					
						
							|  |  |  |             struct tail_finderF | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 // Construction
 | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 tail_finderF( int N ) : m_N(N) {} | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 operator()( | 
					
						
							|  |  |  |                     ForwardIteratorT Begin, | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     ForwardIteratorT End ) const | 
					
						
							|  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |                     if(m_N>=0) | 
					
						
							|  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2009-08-05 20:01:10 +00:00
										 |  |  |                         return ::boost::algorithm::detail::find_tail_impl( Begin, End, m_N ); | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |                     } | 
					
						
							|  |  |  |                     else | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         iterator_range<ForwardIteratorT> Res= | 
					
						
							| 
									
										
										
										
											2009-08-05 20:01:10 +00:00
										 |  |  |                             ::boost::algorithm::detail::find_head_impl( Begin, End, -m_N ); | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-05 20:01:10 +00:00
										 |  |  |                         return ::boost::make_iterator_range(Res.end(), End); | 
					
						
							| 
									
										
										
										
											2006-02-06 18:10:18 +00:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             private: | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                 int m_N; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //  find token functor -----------------------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // find a token in a sequence ( functor )
 | 
					
						
							|  |  |  |             /*
 | 
					
						
							|  |  |  |                 This find functor finds a token specified be a predicate | 
					
						
							|  |  |  |                 in a sequence. It is equivalent of std::find algorithm, | 
					
						
							|  |  |  |                 with an exception that it return range instead of a single | 
					
						
							|  |  |  |                 iterator. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 If bCompress is set to true, adjacent matching tokens are | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 concatenated into one match. | 
					
						
							|  |  |  |             */ | 
					
						
							|  |  |  |             template< typename PredicateT > | 
					
						
							|  |  |  |             struct token_finderF | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 // Construction
 | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 token_finderF( | 
					
						
							|  |  |  |                     PredicateT Pred, | 
					
						
							|  |  |  |                     token_compress_mode_type eCompress=token_compress_off ) : | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                         m_Pred(Pred), m_eCompress(eCompress) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template< typename ForwardIteratorT > | 
					
						
							|  |  |  |                 iterator_range<ForwardIteratorT> | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 operator()( | 
					
						
							|  |  |  |                     ForwardIteratorT Begin, | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     ForwardIteratorT End ) const | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     typedef iterator_range<ForwardIteratorT> result_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     ForwardIteratorT It=std::find_if( Begin, End, m_Pred ); | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     if( It==End ) | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         return result_type( End, End ); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     else | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         ForwardIteratorT It2=It; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                         if( m_eCompress==token_compress_on ) | 
					
						
							|  |  |  |                         { | 
					
						
							|  |  |  |                             // Find first non-matching character
 | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                             while( It2!=End && m_Pred(*It2) ) ++It2; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                         } | 
					
						
							|  |  |  |                         else | 
					
						
							|  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2006-01-31 12:36:32 +00:00
										 |  |  |                             // Advance by one position
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                             ++It2; | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                         return result_type( It, It2 ); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             private: | 
					
						
							|  |  |  |                 PredicateT m_Pred; | 
					
						
							|  |  |  |                 token_compress_mode_type m_eCompress; | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //  find range functor -----------------------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // find a range in the sequence ( functor )
 | 
					
						
							|  |  |  |             /*
 | 
					
						
							|  |  |  |                 This functor actually does not perform any find operation. | 
					
						
							|  |  |  |                 It always returns given iterator range as a result. | 
					
						
							|  |  |  |             */ | 
					
						
							|  |  |  |             template<typename ForwardIterator1T> | 
					
						
							|  |  |  |             struct range_finderF | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 typedef ForwardIterator1T input_iterator_type; | 
					
						
							|  |  |  |                 typedef iterator_range<input_iterator_type> result_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Construction
 | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 range_finderF( | 
					
						
							|  |  |  |                     input_iterator_type Begin, | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     input_iterator_type End ) : m_Range(Begin, End) {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 range_finderF(const iterator_range<input_iterator_type>& Range) : | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     m_Range(Range) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template< typename ForwardIterator2T > | 
					
						
							| 
									
										
										
										
											2005-04-12 04:37:06 +00:00
										 |  |  |                 iterator_range<ForwardIterator2T> | 
					
						
							|  |  |  |                 operator()( | 
					
						
							|  |  |  |                     ForwardIterator2T, | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     ForwardIterator2T ) const | 
					
						
							|  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2005-05-16 12:35:22 +00:00
										 |  |  | #if BOOST_WORKAROUND( __MWERKS__, <= 0x3003 ) 
 | 
					
						
							| 
									
										
										
										
											2005-05-15 02:38:04 +00:00
										 |  |  |                     return iterator_range<const ForwardIterator2T>(this->m_Range); | 
					
						
							| 
									
										
										
										
											2005-05-16 12:35:22 +00:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                     return m_Range; | 
					
						
							| 
									
										
										
										
											2005-05-16 12:35:22 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             private: | 
					
						
							|  |  |  |                 iterator_range<input_iterator_type> m_Range; | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         } // namespace detail
 | 
					
						
							|  |  |  |     } // namespace algorithm
 | 
					
						
							|  |  |  | } // namespace boost
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif  // BOOST_STRING_FINDER_DETAIL_HPP
 |