multi_pass_wrapper.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright (c) 2001-2011 Hartmut Kaiser
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #if !defined(BOOST_SPIRIT_ITERATOR_MULTI_PASS_WRAPPER_JUL_12_2009_0914PM)
  6. #define BOOST_SPIRIT_ITERATOR_MULTI_PASS_WRAPPER_JUL_12_2009_0914PM
  7. #if defined(_MSC_VER)
  8. #pragma once
  9. #endif
  10. #include <boost/mpl/bool.hpp>
  11. #include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp>
  12. namespace boost { namespace spirit { namespace traits
  13. {
  14. // declare special functions allowing to integrate any multi_pass iterator
  15. // with expectation points
  16. // normal iterators require no special handling
  17. BOOST_SCOPED_ENUM_START(clear_mode)
  18. {
  19. clear_if_enabled,
  20. clear_always
  21. };
  22. BOOST_SCOPED_ENUM_END
  23. template <typename Iterator>
  24. void clear_queue(Iterator&
  25. , BOOST_SCOPED_ENUM(clear_mode) /*mode*/ = clear_mode::clear_if_enabled)
  26. {}
  27. template <typename Iterator>
  28. void inhibit_clear_queue(Iterator&, bool)
  29. {}
  30. template <typename Iterator>
  31. bool inhibit_clear_queue(Iterator&)
  32. {
  33. return false;
  34. }
  35. // Helper template to recognize a multi_pass iterator. This specialization
  36. // will be instantiated for any non-multi_pass iterator.
  37. template <typename Iterator>
  38. struct is_multi_pass : mpl::false_ {};
  39. }}}
  40. #endif