multi_pass_fwd.hpp 3.0 KB

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