1 // Copyright (c) 2001 Daniel C. Nuffer
2 // Copyright (c) 2001-2011 Hartmut Kaiser
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #if !defined(BOOST_SPIRIT_ITERATOR_MULTI_PASS_MAR_16_2007_1122AM)
8 #define BOOST_SPIRIT_ITERATOR_MULTI_PASS_MAR_16_2007_1122AM
10 #include <boost/config.hpp>
11 #include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
12 #include <boost/iterator.hpp>
13 #include <boost/mpl/bool.hpp>
17 ///////////////////////////////////////////////////////////////////////////////
18 namespace boost { namespace spirit { namespace detail
21 ///////////////////////////////////////////////////////////////////////////
22 // Default implementations of the different policies to be used with a
23 // multi_pass iterator
24 ///////////////////////////////////////////////////////////////////////////
25 struct default_input_policy
27 default_input_policy() {}
29 template <typename Functor>
30 default_input_policy(Functor const&) {}
32 template <typename MultiPass>
33 static void destroy(MultiPass&) {}
35 void swap(default_input_policy&) {}
37 template <typename MultiPass, typename TokenType>
38 static void advance_input(MultiPass& mp);
40 template <typename MultiPass>
41 static typename MultiPass::reference get_input(MultiPass& mp);
43 template <typename MultiPass>
44 static bool input_at_eof(MultiPass const& mp);
46 template <typename MultiPass, typename TokenType>
47 static bool input_is_valid(MultiPass& mp, TokenType& curtok);
50 struct default_ownership_policy
52 template <typename MultiPass>
53 static void destroy(MultiPass&) {}
55 void swap(default_ownership_policy&) {}
57 template <typename MultiPass>
58 static void clone(MultiPass&) {}
60 template <typename MultiPass>
61 static bool release(MultiPass& mp);
63 template <typename MultiPass>
64 static bool is_unique(MultiPass const& mp);
67 struct default_storage_policy
69 template <typename MultiPass>
70 static void destroy(MultiPass&) {}
72 void swap(default_storage_policy&) {}
74 template <typename MultiPass>
75 static typename MultiPass::reference dereference(MultiPass const& mp);
77 template <typename MultiPass>
78 static void increment(MultiPass&) {}
80 template <typename MultiPass>
81 static void clear_queue(MultiPass&) {}
83 template <typename MultiPass>
84 static bool is_eof(MultiPass const& mp);
86 template <typename MultiPass>
87 static bool equal_to(MultiPass const& mp, MultiPass const& x);
89 template <typename MultiPass>
90 static bool less_than(MultiPass const& mp, MultiPass const& x);
93 struct default_checking_policy
95 template <typename MultiPass>
96 static void destroy(MultiPass&) {}
98 void swap(default_checking_policy&) {}
100 template <typename MultiPass>
101 static void docheck(MultiPass const&) {}
103 template <typename MultiPass>
104 static void clear_queue(MultiPass&) {}