]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/spirit/home/karma/operator/not_predicate.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / spirit / home / karma / operator / not_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_NOT_PREDICATE_MAR_21_2009_1132AM)
8 #define SPIRIT_KARMA_NOT_PREDICATE_MAR_21_2009_1132AM
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::logical_not> // enables !g
30 : mpl::true_ {};
31 }}
32
33 namespace boost { namespace spirit { namespace karma
34 {
35 template <typename Subject>
36 struct not_predicate : unary_generator<not_predicate<Subject> >
37 {
38 typedef Subject subject_type;
39
40 typedef mpl::int_<
41 generator_properties::disabling | subject_type::properties::value
42 > properties;
43
44 template <typename Context, typename Iterator>
45 struct attribute
46 : traits::attribute_of<subject_type, Context, Iterator>
47 {};
48
49 not_predicate(Subject const& subject)
50 : subject(subject) {}
51
52 template <
53 typename OutputIterator, typename Context, typename Delimiter
54 , typename Attribute>
55 bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
56 , Attribute const& attr) const
57 {
58 // inhibits output
59 detail::disable_output<OutputIterator> disable(sink);
60 return !subject.generate(sink, ctx, d, attr);
61 }
62
63 template <typename Context>
64 info what(Context& context) const
65 {
66 return info("not-predicate", subject.what(context));
67 }
68
69 Subject subject;
70 };
71
72 ///////////////////////////////////////////////////////////////////////////
73 // Generator generators: make_xxx function (objects)
74 ///////////////////////////////////////////////////////////////////////////
75 template <typename Elements, typename Modifiers>
76 struct make_composite<proto::tag::logical_not, Elements, Modifiers>
77 : make_unary_composite<Elements, not_predicate> {};
78
79 }}}
80
81 namespace boost { namespace spirit { namespace traits
82 {
83 ///////////////////////////////////////////////////////////////////////////
84 template <typename Subject>
85 struct has_semantic_action<karma::not_predicate<Subject> >
86 : unary_has_semantic_action<Subject> {};
87
88 ///////////////////////////////////////////////////////////////////////////
89 template <typename Subject, typename Attribute, typename Context
90 , typename Iterator>
91 struct handles_container<karma::not_predicate<Subject>, Attribute
92 , Context, Iterator>
93 : unary_handles_container<Subject, Attribute, Context, Iterator> {};
94 }}}
95
96 #endif