Line data Source code
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 : 7 : #if !defined(BOOST_SPIRIT_ITERATOR_MULTI_PASS_MAR_16_2007_1122AM) 8 : #define BOOST_SPIRIT_ITERATOR_MULTI_PASS_MAR_16_2007_1122AM 9 : 10 : #include <boost/config.hpp> 11 : #include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp> 12 : #include <boost/mpl/bool.hpp> 13 : #include <iterator> 14 : #include <algorithm> 15 : 16 : /////////////////////////////////////////////////////////////////////////////// 17 : namespace boost { namespace spirit { namespace detail 18 : { 19 : 20 : /////////////////////////////////////////////////////////////////////////// 21 : // Default implementations of the different policies to be used with a 22 : // multi_pass iterator 23 : /////////////////////////////////////////////////////////////////////////// 24 : struct default_input_policy 25 : { 26 : default_input_policy() {} 27 : 28 : template <typename Functor> 29 : default_input_policy(Functor const&) {} 30 : 31 : template <typename MultiPass> 32 : static void destroy(MultiPass&) {} 33 : 34 : void swap(default_input_policy&) {} 35 : 36 : template <typename MultiPass, typename TokenType> 37 : static void advance_input(MultiPass& mp); 38 : 39 : template <typename MultiPass> 40 : static typename MultiPass::reference get_input(MultiPass& mp); 41 : 42 : template <typename MultiPass> 43 : static bool input_at_eof(MultiPass const& mp); 44 : 45 : template <typename MultiPass, typename TokenType> 46 : static bool input_is_valid(MultiPass& mp, TokenType& curtok); 47 : }; 48 : 49 : struct default_ownership_policy 50 : { 51 : template <typename MultiPass> 52 : static void destroy(MultiPass&) {} 53 : 54 : void swap(default_ownership_policy&) {} 55 : 56 : template <typename MultiPass> 57 : static void clone(MultiPass&) {} 58 : 59 : template <typename MultiPass> 60 : static bool release(MultiPass& mp); 61 : 62 : template <typename MultiPass> 63 : static bool is_unique(MultiPass const& mp); 64 : }; 65 : 66 : struct default_storage_policy 67 : { 68 : template <typename MultiPass> 69 : static void destroy(MultiPass&) {} 70 : 71 : void swap(default_storage_policy&) {} 72 : 73 : template <typename MultiPass> 74 : static typename MultiPass::reference dereference(MultiPass const& mp); 75 : 76 : template <typename MultiPass> 77 : static void increment(MultiPass&) {} 78 : 79 : template <typename MultiPass> 80 : static void clear_queue(MultiPass&) {} 81 : 82 : template <typename MultiPass> 83 : static bool is_eof(MultiPass const& mp); 84 : 85 : template <typename MultiPass> 86 : static bool equal_to(MultiPass const& mp, MultiPass const& x); 87 : 88 : template <typename MultiPass> 89 : static bool less_than(MultiPass const& mp, MultiPass const& x); 90 : }; 91 : 92 : struct default_checking_policy 93 : { 94 : template <typename MultiPass> 95 : static void destroy(MultiPass&) {} 96 : 97 : void swap(default_checking_policy&) {} 98 : 99 : template <typename MultiPass> 100 0 : static void docheck(MultiPass const&) {} 101 : 102 : template <typename MultiPass> 103 : static void clear_queue(MultiPass&) {} 104 : }; 105 : 106 : }}} 107 : 108 : #endif