]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/include/boost/spirit/home/karma/operator/and_predicate.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / spirit / include / boost / spirit / home / karma / operator / and_predicate.hpp
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
7 #if !defined(SPIRIT_KARMA_AND_PREDICATE_MAR_22_2009_0412PM)
8 #define SPIRIT_KARMA_AND_PREDICATE_MAR_22_2009_0412PM
9
10 #if defined(_MSC_VER)
11 #pragma once
12 #endif
13
14 #include <boost/spirit/home/karma/domain.hpp>
15 #include <boost/spirit/home/karma/meta_compiler.hpp>
16 #include <boost/spirit/home/karma/generator.hpp>
17 #include <boost/spirit/home/karma/detail/output_iterator.hpp>
18 #include <boost/spirit/home/karma/detail/attributes.hpp>
19 #include <boost/spirit/home/support/info.hpp>
20 #include <boost/spirit/home/support/has_semantic_action.hpp>
21 #include <boost/spirit/home/support/handles_container.hpp>
22
23 namespace boost { namespace spirit
24 {
25 ///////////////////////////////////////////////////////////////////////////
26 // Enablers
27 ///////////////////////////////////////////////////////////////////////////
28 template <>
29 struct use_operator<karma::domain, proto::tag::address_of> // enables &g
30 : mpl::true_ {};
31 }}
32
33 namespace boost { namespace spirit { namespace karma
34 {
35 template <typename Subject>
36 struct and_predicate : unary_generator<and_predicate<Subject> >
37 {
38 typedef Subject subject_type;
39 typedef mpl::int_<
40 generator_properties::disabling | subject_type::properties::value
41 > properties;
42
43 template <typename Context, typename Iterator>
44 struct attribute
45 : traits::attribute_of<subject_type, Context, Iterator>
46 {};
47
48 and_predicate(Subject const& subject)
49 : subject(subject) {}
50
51 template <
52 typename OutputIterator, typename Context, typename Delimiter
53 , typename Attribute>
54 bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
55 , Attribute const& attr) const
56 {
57 // inhibits output
58 detail::disable_output<OutputIterator> disable(sink);
59 return subject.generate(sink, ctx, d, attr);
60 }
61
62 template <typename Context>
63 info what(Context& context) const
64 {
65 return info("and-predicate", subject.what(context));
66 }
67
68 Subject subject;
69 };
70
71 ///////////////////////////////////////////////////////////////////////////
72 // Generator generators: make_xxx function (objects)
73 ///////////////////////////////////////////////////////////////////////////
74 template <typename Elements, typename Modifiers>
75 struct make_composite<proto::tag::address_of, Elements, Modifiers>
76 : make_unary_composite<Elements, and_predicate> {};
77
78 }}}
79
80 namespace boost { namespace spirit { namespace traits
81 {
82 ///////////////////////////////////////////////////////////////////////////
83 template <typename Subject>
84 struct has_semantic_action<karma::and_predicate<Subject> >
85 : unary_has_semantic_action<Subject> {};
86
87 ///////////////////////////////////////////////////////////////////////////
88 template <typename Subject, typename Attribute, typename Context
89 , typename Iterator>
90 struct handles_container<karma::and_predicate<Subject>, Attribute
91 , Context, Iterator>
92 : unary_handles_container<Subject, Attribute, Context, Iterator> {};
93 }}}
94
95 #endif