Chris@16
|
1 // Copyright (c) 2001-2011 Hartmut Kaiser
|
Chris@16
|
2 // Copyright (c) 2001-2011 Joel de Guzman
|
Chris@16
|
3 //
|
Chris@16
|
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6
|
Chris@16
|
7 #if !defined(SPIRIT_KARMA_SEQUENCE_FEB_28_2007_0249PM)
|
Chris@16
|
8 #define SPIRIT_KARMA_SEQUENCE_FEB_28_2007_0249PM
|
Chris@16
|
9
|
Chris@16
|
10 #if defined(_MSC_VER)
|
Chris@16
|
11 #pragma once
|
Chris@16
|
12 #endif
|
Chris@16
|
13
|
Chris@16
|
14 #include <boost/spirit/home/support/unused.hpp>
|
Chris@16
|
15 #include <boost/config.hpp>
|
Chris@16
|
16
|
Chris@16
|
17 namespace boost { namespace spirit { namespace karma { namespace detail
|
Chris@16
|
18 {
|
Chris@16
|
19 template <typename OutputIterator, typename Context, typename Delimiter>
|
Chris@16
|
20 struct fail_function
|
Chris@16
|
21 {
|
Chris@16
|
22 typedef Context context_type;
|
Chris@16
|
23
|
Chris@16
|
24 fail_function(OutputIterator& sink_, Context& context_
|
Chris@16
|
25 , Delimiter const& delim_)
|
Chris@16
|
26 : sink(sink_), ctx(context_), delim(delim_)
|
Chris@16
|
27 {}
|
Chris@16
|
28
|
Chris@16
|
29 template <typename Component, typename Attribute>
|
Chris@16
|
30 bool operator()(Component const& component, Attribute const& attr) const
|
Chris@16
|
31 {
|
Chris@16
|
32 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
Chris@16
|
33 component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
Chris@16
|
34 #endif
|
Chris@16
|
35 // return true if any of the generators fail
|
Chris@16
|
36 return !component.generate(sink, ctx, delim, attr);
|
Chris@16
|
37 }
|
Chris@16
|
38
|
Chris@16
|
39 template <typename Component>
|
Chris@16
|
40 bool operator()(Component const& component) const
|
Chris@16
|
41 {
|
Chris@16
|
42 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
Chris@16
|
43 component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
Chris@16
|
44 #endif
|
Chris@16
|
45 // return true if any of the generators fail
|
Chris@16
|
46 return !component.generate(sink, ctx, delim, unused);
|
Chris@16
|
47 }
|
Chris@16
|
48
|
Chris@16
|
49 OutputIterator& sink;
|
Chris@16
|
50 Context& ctx;
|
Chris@16
|
51 Delimiter const& delim;
|
Chris@16
|
52
|
Chris@16
|
53 private:
|
Chris@16
|
54 // silence MSVC warning C4512: assignment operator could not be generated
|
Chris@16
|
55 fail_function& operator= (fail_function const&);
|
Chris@16
|
56 };
|
Chris@16
|
57
|
Chris@16
|
58 }}}}
|
Chris@16
|
59
|
Chris@16
|
60 #endif
|