multi_pass.hpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // Copyright (c) 2001 Daniel C. Nuffer
  2. // Copyright (c) 2001-2011 Hartmut Kaiser
  3. //
  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)
  6. #if !defined(BOOST_SPIRIT_ITERATOR_MULTI_PASS_MAR_16_2007_1122AM)
  7. #define BOOST_SPIRIT_ITERATOR_MULTI_PASS_MAR_16_2007_1122AM
  8. #include <boost/config.hpp>
  9. #include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
  10. #include <boost/mpl/bool.hpp>
  11. #include <iterator>
  12. #include <algorithm>
  13. ///////////////////////////////////////////////////////////////////////////////
  14. namespace boost { namespace spirit { namespace detail
  15. {
  16. ///////////////////////////////////////////////////////////////////////////
  17. // Default implementations of the different policies to be used with a
  18. // multi_pass iterator
  19. ///////////////////////////////////////////////////////////////////////////
  20. struct default_input_policy
  21. {
  22. default_input_policy() {}
  23. template <typename Functor>
  24. default_input_policy(Functor const&) {}
  25. template <typename MultiPass>
  26. static void destroy(MultiPass&) {}
  27. void swap(default_input_policy&) {}
  28. template <typename MultiPass, typename TokenType>
  29. static void advance_input(MultiPass& mp);
  30. template <typename MultiPass>
  31. static typename MultiPass::reference get_input(MultiPass& mp);
  32. template <typename MultiPass>
  33. static bool input_at_eof(MultiPass const& mp);
  34. template <typename MultiPass, typename TokenType>
  35. static bool input_is_valid(MultiPass& mp, TokenType& curtok);
  36. };
  37. struct default_ownership_policy
  38. {
  39. template <typename MultiPass>
  40. static void destroy(MultiPass&) {}
  41. void swap(default_ownership_policy&) {}
  42. template <typename MultiPass>
  43. static void clone(MultiPass&) {}
  44. template <typename MultiPass>
  45. static bool release(MultiPass& mp);
  46. template <typename MultiPass>
  47. static bool is_unique(MultiPass const& mp);
  48. };
  49. struct default_storage_policy
  50. {
  51. template <typename MultiPass>
  52. static void destroy(MultiPass&) {}
  53. void swap(default_storage_policy&) {}
  54. template <typename MultiPass>
  55. static typename MultiPass::reference dereference(MultiPass const& mp);
  56. template <typename MultiPass>
  57. static void increment(MultiPass&) {}
  58. template <typename MultiPass>
  59. static void clear_queue(MultiPass&) {}
  60. template <typename MultiPass>
  61. static bool is_eof(MultiPass const& mp);
  62. template <typename MultiPass>
  63. static bool equal_to(MultiPass const& mp, MultiPass const& x);
  64. template <typename MultiPass>
  65. static bool less_than(MultiPass const& mp, MultiPass const& x);
  66. };
  67. struct default_checking_policy
  68. {
  69. template <typename MultiPass>
  70. static void destroy(MultiPass&) {}
  71. void swap(default_checking_policy&) {}
  72. template <typename MultiPass>
  73. static void docheck(MultiPass const&) {}
  74. template <typename MultiPass>
  75. static void clear_queue(MultiPass&) {}
  76. };
  77. }}}
  78. #endif