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/mpl/bool.hpp>
16 ///////////////////////////////////////////////////////////////////////////////
17 namespace boost { namespace spirit { namespace detail
20 ///////////////////////////////////////////////////////////////////////////
21 // Default implementations of the different policies to be used with a
22 // multi_pass iterator
23 ///////////////////////////////////////////////////////////////////////////
24 struct default_input_policy
26 default_input_policy() {}
28 template <typename Functor>
29 default_input_policy(Functor const&) {}
31 template <typename MultiPass>
32 static void destroy(MultiPass&) {}
34 void swap(default_input_policy&) {}
36 template <typename MultiPass, typename TokenType>
37 static void advance_input(MultiPass& mp);
39 template <typename MultiPass>
40 static typename MultiPass::reference get_input(MultiPass& mp);
42 template <typename MultiPass>
43 static bool input_at_eof(MultiPass const& mp);
45 template <typename MultiPass, typename TokenType>
46 static bool input_is_valid(MultiPass& mp, TokenType& curtok);
49 struct default_ownership_policy
51 template <typename MultiPass>
52 static void destroy(MultiPass&) {}
54 void swap(default_ownership_policy&) {}
56 template <typename MultiPass>
57 static void clone(MultiPass&) {}
59 template <typename MultiPass>
60 static bool release(MultiPass& mp);
62 template <typename MultiPass>
63 static bool is_unique(MultiPass const& mp);
66 struct default_storage_policy
68 template <typename MultiPass>
69 static void destroy(MultiPass&) {}
71 void swap(default_storage_policy&) {}
73 template <typename MultiPass>
74 static typename MultiPass::reference dereference(MultiPass const& mp);
76 template <typename MultiPass>
77 static void increment(MultiPass&) {}
79 template <typename MultiPass>
80 static void clear_queue(MultiPass&) {}
82 template <typename MultiPass>
83 static bool is_eof(MultiPass const& mp);
85 template <typename MultiPass>
86 static bool equal_to(MultiPass const& mp, MultiPass const& x);
88 template <typename MultiPass>
89 static bool less_than(MultiPass const& mp, MultiPass const& x);
92 struct default_checking_policy
94 template <typename MultiPass>
95 static void destroy(MultiPass&) {}
97 void swap(default_checking_policy&) {}
99 template <typename MultiPass>
100 static void docheck(MultiPass const&) {}
102 template <typename MultiPass>
103 static void clear_queue(MultiPass&) {}