File indexing completed on 2025-01-18 09:28:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_STRING_FIND_ITERATOR_DETAIL_HPP
0012 #define BOOST_STRING_FIND_ITERATOR_DETAIL_HPP
0013
0014 #include <boost/algorithm/string/config.hpp>
0015 #include <boost/range/iterator_range_core.hpp>
0016 #include <boost/iterator/iterator_facade.hpp>
0017 #include <boost/iterator/iterator_categories.hpp>
0018 #include <boost/function.hpp>
0019
0020 namespace boost {
0021 namespace algorithm {
0022 namespace detail {
0023
0024
0025
0026
0027 template<typename IteratorT>
0028 class find_iterator_base
0029 {
0030 protected:
0031
0032 typedef IteratorT input_iterator_type;
0033 typedef iterator_range<IteratorT> match_type;
0034 typedef function2<
0035 match_type,
0036 input_iterator_type,
0037 input_iterator_type> finder_type;
0038
0039 protected:
0040
0041
0042
0043 BOOST_DEFAULTED_FUNCTION(find_iterator_base(), {})
0044
0045
0046 BOOST_DEFAULTED_FUNCTION(find_iterator_base( const find_iterator_base& Other ), :
0047 m_Finder(Other.m_Finder) {}
0048 )
0049
0050
0051 BOOST_DEFAULTED_FUNCTION(find_iterator_base& operator=( const find_iterator_base& Other ), {
0052 m_Finder = Other.m_Finder;
0053 return *this;
0054 })
0055
0056
0057 template<typename FinderT>
0058 find_iterator_base( FinderT Finder, int ) :
0059 m_Finder(Finder) {}
0060
0061
0062 BOOST_DEFAULTED_FUNCTION(~find_iterator_base(), {})
0063
0064
0065 match_type do_find(
0066 input_iterator_type Begin,
0067 input_iterator_type End ) const
0068 {
0069 if (!m_Finder.empty())
0070 {
0071 return m_Finder(Begin,End);
0072 }
0073 else
0074 {
0075 return match_type(End,End);
0076 }
0077 }
0078
0079
0080 bool is_null() const
0081 {
0082 return m_Finder.empty();
0083 }
0084
0085 private:
0086
0087 finder_type m_Finder;
0088 };
0089
0090 }
0091 }
0092 }
0093
0094
0095 #endif