File indexing completed on 2025-12-16 10:09:16
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_SPIRIT_KARMA_OPERATOR_AND_PREDICATE_HPP
0008 #define BOOST_SPIRIT_KARMA_OPERATOR_AND_PREDICATE_HPP
0009
0010 #if defined(_MSC_VER)
0011 #pragma once
0012 #endif
0013
0014 #include <boost/spirit/home/karma/domain.hpp>
0015 #include <boost/spirit/home/karma/meta_compiler.hpp>
0016 #include <boost/spirit/home/karma/generator.hpp>
0017 #include <boost/spirit/home/karma/detail/output_iterator.hpp>
0018 #include <boost/spirit/home/karma/detail/attributes.hpp>
0019 #include <boost/spirit/home/support/info.hpp>
0020 #include <boost/spirit/home/support/has_semantic_action.hpp>
0021 #include <boost/spirit/home/support/handles_container.hpp>
0022 #include <boost/proto/operators.hpp>
0023 #include <boost/proto/tags.hpp>
0024
0025 namespace boost { namespace spirit
0026 {
0027
0028
0029
0030 template <>
0031 struct use_operator<karma::domain, proto::tag::address_of>
0032 : mpl::true_ {};
0033 }}
0034
0035 namespace boost { namespace spirit { namespace karma
0036 {
0037 template <typename Subject>
0038 struct and_predicate : unary_generator<and_predicate<Subject> >
0039 {
0040 typedef Subject subject_type;
0041 typedef mpl::int_<
0042 generator_properties::disabling | subject_type::properties::value
0043 > properties;
0044
0045 template <typename Context, typename Iterator>
0046 struct attribute
0047 : traits::attribute_of<subject_type, Context, Iterator>
0048 {};
0049
0050 and_predicate(Subject const& subject)
0051 : subject(subject) {}
0052
0053 template <
0054 typename OutputIterator, typename Context, typename Delimiter
0055 , typename Attribute>
0056 bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
0057 , Attribute const& attr) const
0058 {
0059
0060 detail::disable_output<OutputIterator> disable(sink);
0061 return subject.generate(sink, ctx, d, attr);
0062 }
0063
0064 template <typename Context>
0065 info what(Context& context) const
0066 {
0067 return info("and-predicate", subject.what(context));
0068 }
0069
0070 Subject subject;
0071 };
0072
0073
0074
0075
0076 template <typename Elements, typename Modifiers>
0077 struct make_composite<proto::tag::address_of, Elements, Modifiers>
0078 : make_unary_composite<Elements, and_predicate> {};
0079
0080 }}}
0081
0082 namespace boost { namespace spirit { namespace traits
0083 {
0084
0085 template <typename Subject>
0086 struct has_semantic_action<karma::and_predicate<Subject> >
0087 : unary_has_semantic_action<Subject> {};
0088
0089
0090 template <typename Subject, typename Attribute, typename Context
0091 , typename Iterator>
0092 struct handles_container<karma::and_predicate<Subject>, Attribute
0093 , Context, Iterator>
0094 : unary_handles_container<Subject, Attribute, Context, Iterator> {};
0095 }}}
0096
0097 #endif