123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- // Boost string_algo library finder.hpp header file
- // 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)
- // See http://www.boost.org/ for updates, documentation, and revision history.
- #ifndef BOOST_STRING_FINDER_HPP
- #define BOOST_STRING_FINDER_HPP
- #include <boost/algorithm/string/config.hpp>
- #include <boost/range/iterator_range_core.hpp>
- #include <boost/range/begin.hpp>
- #include <boost/range/end.hpp>
- #include <boost/range/iterator.hpp>
- #include <boost/range/const_iterator.hpp>
- #include <boost/algorithm/string/constants.hpp>
- #include <boost/algorithm/string/detail/finder.hpp>
- #include <boost/algorithm/string/compare.hpp>
- namespace boost {
- namespace algorithm {
- // Finder generators
-
- //! "First" finder
-
- template<typename RangeT>
- inline detail::first_finderF<
- BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
- is_equal>
- first_finder( const RangeT& Search )
- {
- return
- detail::first_finderF<
- BOOST_STRING_TYPENAME
- range_const_iterator<RangeT>::type,
- is_equal>( ::boost::as_literal(Search), is_equal() ) ;
- }
- //! "First" finder
-
- template<typename RangeT,typename PredicateT>
- inline detail::first_finderF<
- BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
- PredicateT>
- first_finder(
- const RangeT& Search, PredicateT Comp )
- {
- return
- detail::first_finderF<
- BOOST_STRING_TYPENAME
- range_const_iterator<RangeT>::type,
- PredicateT>( ::boost::as_literal(Search), Comp );
- }
- //! "Last" finder
-
- template<typename RangeT>
- inline detail::last_finderF<
- BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
- is_equal>
- last_finder( const RangeT& Search )
- {
- return
- detail::last_finderF<
- BOOST_STRING_TYPENAME
- range_const_iterator<RangeT>::type,
- is_equal>( ::boost::as_literal(Search), is_equal() );
- }
- //! "Last" finder
-
- template<typename RangeT, typename PredicateT>
- inline detail::last_finderF<
- BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
- PredicateT>
- last_finder( const RangeT& Search, PredicateT Comp )
- {
- return
- detail::last_finderF<
- BOOST_STRING_TYPENAME
- range_const_iterator<RangeT>::type,
- PredicateT>( ::boost::as_literal(Search), Comp ) ;
- }
- //! "Nth" finder
-
- template<typename RangeT>
- inline detail::nth_finderF<
- BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
- is_equal>
- nth_finder(
- const RangeT& Search,
- int Nth)
- {
- return
- detail::nth_finderF<
- BOOST_STRING_TYPENAME
- range_const_iterator<RangeT>::type,
- is_equal>( ::boost::as_literal(Search), Nth, is_equal() ) ;
- }
- //! "Nth" finder
-
- template<typename RangeT, typename PredicateT>
- inline detail::nth_finderF<
- BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
- PredicateT>
- nth_finder(
- const RangeT& Search,
- int Nth,
- PredicateT Comp )
- {
- return
- detail::nth_finderF<
- BOOST_STRING_TYPENAME
- range_const_iterator<RangeT>::type,
- PredicateT>( ::boost::as_literal(Search), Nth, Comp );
- }
- //! "Head" finder
-
- inline detail::head_finderF
- head_finder( int N )
- {
- return detail::head_finderF(N);
- }
-
- //! "Tail" finder
-
- inline detail::tail_finderF
- tail_finder( int N )
- {
- return detail::tail_finderF(N);
- }
- //! "Token" finder
-
- template< typename PredicateT >
- inline detail::token_finderF<PredicateT>
- token_finder(
- PredicateT Pred,
- token_compress_mode_type eCompress=token_compress_off )
- {
- return detail::token_finderF<PredicateT>( Pred, eCompress );
- }
- //! "Range" finder
-
- template< typename ForwardIteratorT >
- inline detail::range_finderF<ForwardIteratorT>
- range_finder(
- ForwardIteratorT Begin,
- ForwardIteratorT End )
- {
- return detail::range_finderF<ForwardIteratorT>( Begin, End );
- }
- //! "Range" finder
-
- template< typename ForwardIteratorT >
- inline detail::range_finderF<ForwardIteratorT>
- range_finder( iterator_range<ForwardIteratorT> Range )
- {
- return detail::range_finderF<ForwardIteratorT>( Range );
- }
- } // namespace algorithm
- // pull the names to the boost namespace
- using algorithm::first_finder;
- using algorithm::last_finder;
- using algorithm::nth_finder;
- using algorithm::head_finder;
- using algorithm::tail_finder;
- using algorithm::token_finder;
- using algorithm::range_finder;
- } // namespace boost
- #endif // BOOST_STRING_FINDER_HPP
|