PageRenderTime 32ms CodeModel.GetById 27ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/spirit/home/qi/detail/fail_function.hpp

http://hadesmem.googlecode.com/
C++ Header | 59 lines | 41 code | 9 blank | 9 comment | 0 complexity | f28912a47da45d6f6ab5ab2d27e53475 MD5 | raw file
 1/*=============================================================================
 2    Copyright (c) 2001-2011 Joel de Guzman
 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(SPIRIT_FAIL_FUNCTION_APRIL_22_2006_0159PM)
 8#define SPIRIT_FAIL_FUNCTION_APRIL_22_2006_0159PM
 9
10#if defined(_MSC_VER)
11#pragma once
12#endif
13
14#include <boost/spirit/home/support/unused.hpp>
15
16namespace boost { namespace spirit { namespace qi { namespace detail
17{
18    template <typename Iterator, typename Context, typename Skipper>
19    struct fail_function
20    {
21        typedef Iterator iterator_type;
22        typedef Context context_type;
23
24        fail_function(
25            Iterator& first, Iterator const& last
26          , Context& context, Skipper const& skipper)
27          : first(first)
28          , last(last)
29          , context(context)
30          , skipper(skipper)
31        {
32        }
33
34        template <typename Component, typename Attribute>
35        bool operator()(Component const& component, Attribute& attr) const
36        {
37            // return true if the parser fails
38            return !component.parse(first, last, context, skipper, attr);
39        }
40
41        template <typename Component>
42        bool operator()(Component const& component) const
43        {
44            // return true if the parser fails
45            return !component.parse(first, last, context, skipper, unused);
46        }
47
48        Iterator& first;
49        Iterator const& last;
50        Context& context;
51        Skipper const& skipper;
52
53    private:
54        // silence MSVC warning C4512: assignment operator could not be generated
55        fail_function& operator= (fail_function const&);
56    };
57}}}}
58
59#endif