| 1 | /*============================================================================= |
| 2 | Copyright (c) 2007 Tobias Schwinger |
| 3 | Copyright (c) 2001-2011 Hartmut Kaiser |
| 4 | http://spirit.sourceforge.net/ |
| 5 | |
| 6 | Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 7 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 8 | =============================================================================*/ |
| 9 | #if !defined(BOOST_SPIRIT_ITERATOR_MULTI_PASS_FWD_APR_18_2008_1102AM) |
| 10 | #define BOOST_SPIRIT_ITERATOR_MULTI_PASS_FWD_APR_18_2008_1102AM |
| 11 | |
| 12 | #include <cstddef> |
| 13 | #include <boost/spirit/home/support/multi_pass_wrapper.hpp> |
| 14 | #include <boost/swap.hpp> |
| 15 | |
| 16 | namespace boost { namespace spirit { |
| 17 | |
| 18 | namespace iterator_policies |
| 19 | { |
| 20 | // input policies |
| 21 | struct input_iterator; |
| 22 | struct buffering_input_iterator; |
| 23 | struct istream; |
| 24 | struct lex_input; |
| 25 | struct functor_input; |
| 26 | struct split_functor_input; |
| 27 | |
| 28 | // ownership policies |
| 29 | struct ref_counted; |
| 30 | struct first_owner; |
| 31 | |
| 32 | // checking policies |
| 33 | class illegal_backtracking; |
| 34 | struct buf_id_check; |
| 35 | struct no_check; |
| 36 | |
| 37 | // storage policies |
| 38 | struct split_std_deque; |
| 39 | template<std::size_t N> struct fixed_size_queue; |
| 40 | |
| 41 | // policy combiner |
| 42 | #if defined(BOOST_SPIRIT_DEBUG) |
| 43 | template<typename Ownership = ref_counted |
| 44 | , typename Checking = buf_id_check |
| 45 | , typename Input = buffering_input_iterator |
| 46 | , typename Storage = split_std_deque> |
| 47 | struct default_policy; |
| 48 | #else |
| 49 | template<typename Ownership = ref_counted |
| 50 | , typename Checking = no_check |
| 51 | , typename Input = buffering_input_iterator |
| 52 | , typename Storage = split_std_deque> |
| 53 | struct default_policy; |
| 54 | #endif |
| 55 | } |
| 56 | |
| 57 | template <typename T |
| 58 | , typename Policies = iterator_policies::default_policy<> > |
| 59 | class multi_pass; |
| 60 | |
| 61 | template <typename T, typename Policies> |
| 62 | void swap(multi_pass<T, Policies> &x, multi_pass<T, Policies> &y); |
| 63 | |
| 64 | }} // namespace boost::spirit |
| 65 | |
| 66 | namespace boost { namespace spirit { namespace traits |
| 67 | { |
| 68 | // declare special functions allowing to integrate any multi_pass iterator |
| 69 | // with expectation points |
| 70 | |
| 71 | // multi_pass iterators require special handling (for the non-specialized |
| 72 | // versions of these functions see support/multi_pass_wrapper.hpp) |
| 73 | template <typename T, typename Policies> |
| 74 | void clear_queue(multi_pass<T, Policies>& |
| 75 | , BOOST_SCOPED_ENUM(clear_mode) mode = clear_mode::clear_if_enabled); |
| 76 | |
| 77 | template <typename T, typename Policies> |
| 78 | void inhibit_clear_queue(multi_pass<T, Policies>&, bool); |
| 79 | |
| 80 | template <typename T, typename Policies> |
| 81 | bool inhibit_clear_queue(multi_pass<T, Policies>&); |
| 82 | |
| 83 | // Helper template to recognize a multi_pass iterator. This specialization |
| 84 | // will be instantiated for any multi_pass iterator. |
| 85 | template <typename T, typename Policies> |
| 86 | struct is_multi_pass<multi_pass<T, Policies> > : mpl::true_ {}; |
| 87 | |
| 88 | }}} |
| 89 | |
| 90 | #endif |
| 91 | |
| 92 | |