]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright (c) 2001-2011 Hartmut Kaiser |
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 | ||
f67539c2 TL |
7 | #ifndef BOOST_SPIRIT_KARMA_DETAIL_FAIL_FUNCTION_HPP |
8 | #define BOOST_SPIRIT_KARMA_DETAIL_FAIL_FUNCTION_HPP | |
7c673cae FG |
9 | |
10 | #if defined(_MSC_VER) | |
11 | #pragma once | |
12 | #endif | |
13 | ||
14 | #include <boost/spirit/home/support/unused.hpp> | |
15 | #include <boost/config.hpp> | |
16 | ||
17 | namespace boost { namespace spirit { namespace karma { namespace detail | |
18 | { | |
19 | template <typename OutputIterator, typename Context, typename Delimiter> | |
20 | struct fail_function | |
21 | { | |
22 | typedef Context context_type; | |
23 | ||
24 | fail_function(OutputIterator& sink_, Context& context_ | |
25 | , Delimiter const& delim_) | |
26 | : sink(sink_), ctx(context_), delim(delim_) | |
27 | {} | |
28 | ||
29 | template <typename Component, typename Attribute> | |
30 | bool operator()(Component const& component, Attribute const& attr) const | |
31 | { | |
32 | #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600)) | |
1e59de90 | 33 | (void)component; // suppresses warning: C4100: 'component' : unreferenced formal parameter |
7c673cae FG |
34 | #endif |
35 | // return true if any of the generators fail | |
36 | return !component.generate(sink, ctx, delim, attr); | |
37 | } | |
38 | ||
39 | template <typename Component> | |
40 | bool operator()(Component const& component) const | |
41 | { | |
42 | #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600)) | |
1e59de90 | 43 | (void)component; // suppresses warning: C4100: 'component' : unreferenced formal parameter |
7c673cae FG |
44 | #endif |
45 | // return true if any of the generators fail | |
46 | return !component.generate(sink, ctx, delim, unused); | |
47 | } | |
48 | ||
49 | OutputIterator& sink; | |
50 | Context& ctx; | |
51 | Delimiter const& delim; | |
52 | ||
7c673cae | 53 | // silence MSVC warning C4512: assignment operator could not be generated |
92f5a8d4 | 54 | BOOST_DELETED_FUNCTION(fail_function& operator= (fail_function const&)) |
7c673cae FG |
55 | }; |
56 | ||
57 | }}}} | |
58 | ||
59 | #endif |