PageRenderTime 58ms CodeModel.GetById 28ms app.highlight 24ms RepoModel.GetById 2ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/spirit/home/support/iterators/detail/multi_pass.hpp

http://hadesmem.googlecode.com/
C++ Header | 132 lines | 83 code | 31 blank | 18 comment | 0 complexity | 87857f650459e530b6f06eaf821d32c2 MD5 | raw file
  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/iterator.hpp>
 13#include <boost/mpl/bool.hpp>
 14#include <iterator>
 15#include <algorithm> 
 16
 17///////////////////////////////////////////////////////////////////////////////
 18namespace boost { namespace spirit { namespace detail
 19{
 20#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
 21    ///////////////////////////////////////////////////////////////////////////
 22    //  Meta-function to generate a std::iterator<> base class for multi_pass. 
 23    //  This is used mainly to improve conformance of compilers not supporting 
 24    //  PTS and thus relying on inheritance to recognize an iterator.
 25    //
 26    //  We are using boost::iterator<> because it offers an automatic 
 27    //  workaround for broken std::iterator<> implementations.
 28    ///////////////////////////////////////////////////////////////////////////
 29    template <typename T, typename InputPolicy>
 30    struct iterator_base_creator
 31    {
 32        typedef typename InputPolicy::BOOST_NESTED_TEMPLATE unique<T> input_type;
 33
 34        typedef boost::iterator <
 35            std::forward_iterator_tag
 36          , typename input_type::value_type
 37          , typename input_type::difference_type
 38          , typename input_type::pointer
 39          , typename input_type::reference
 40        > type;
 41    };
 42#endif
 43
 44    ///////////////////////////////////////////////////////////////////////////
 45    //  Default implementations of the different policies to be used with a 
 46    //  multi_pass iterator
 47    ///////////////////////////////////////////////////////////////////////////
 48    struct default_input_policy
 49    {
 50        default_input_policy() {}
 51
 52        template <typename Functor>
 53        default_input_policy(Functor const&) {}
 54
 55        template <typename MultiPass>
 56        static void destroy(MultiPass&) {}
 57
 58        void swap(default_input_policy&) {}
 59
 60        template <typename MultiPass, typename TokenType>
 61        static void advance_input(MultiPass& mp);
 62
 63        template <typename MultiPass>
 64        static typename MultiPass::reference get_input(MultiPass& mp);
 65
 66        template <typename MultiPass>
 67        static bool input_at_eof(MultiPass const& mp);
 68
 69        template <typename MultiPass, typename TokenType>
 70        static bool input_is_valid(MultiPass& mp, TokenType& curtok);
 71    };
 72
 73    struct default_ownership_policy
 74    {
 75        template <typename MultiPass>
 76        static void destroy(MultiPass&) {}
 77
 78        void swap(default_ownership_policy&) {}
 79
 80        template <typename MultiPass>
 81        static void clone(MultiPass&) {}
 82
 83        template <typename MultiPass>
 84        static bool release(MultiPass& mp);
 85
 86        template <typename MultiPass>
 87        static bool is_unique(MultiPass const& mp);
 88    };
 89
 90    struct default_storage_policy
 91    {
 92        template <typename MultiPass>
 93        static void destroy(MultiPass&) {}
 94
 95        void swap(default_storage_policy&) {}
 96
 97        template <typename MultiPass>
 98        static typename MultiPass::reference dereference(MultiPass const& mp);
 99
100        template <typename MultiPass>
101        static void increment(MultiPass&) {}
102
103        template <typename MultiPass>
104        static void clear_queue(MultiPass&) {}
105
106        template <typename MultiPass>
107        static bool is_eof(MultiPass const& mp);
108
109        template <typename MultiPass>
110        static bool equal_to(MultiPass const& mp, MultiPass const& x);
111
112        template <typename MultiPass>
113        static bool less_than(MultiPass const& mp, MultiPass const& x);
114    };
115
116    struct default_checking_policy
117    {
118        template <typename MultiPass>
119        static void destroy(MultiPass&) {}
120
121        void swap(default_checking_policy&) {}
122
123        template <typename MultiPass>
124        static void docheck(MultiPass const&) {}
125
126        template <typename MultiPass>
127        static void clear_queue(MultiPass&) {}
128    };
129
130}}}
131
132#endif