// Copyright (c) 2001-2011 Hartmut Kaiser // Copyright (c) 2001-2011 Joel de Guzman // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #if !defined(SPIRIT_KARMA_AND_PREDICATE_MAR_22_2009_0412PM) #define SPIRIT_KARMA_AND_PREDICATE_MAR_22_2009_0412PM #if defined(_MSC_VER) #pragma once #endif #include #include #include #include #include #include #include #include namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////// // Enablers /////////////////////////////////////////////////////////////////////////// template <> struct use_operator // enables &g : mpl::true_ {}; }} namespace boost { namespace spirit { namespace karma { template struct and_predicate : unary_generator > { typedef Subject subject_type; typedef mpl::int_< generator_properties::disabling | subject_type::properties::value > properties; template struct attribute : traits::attribute_of {}; and_predicate(Subject const& subject) : subject(subject) {} template < typename OutputIterator, typename Context, typename Delimiter , typename Attribute> bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d , Attribute const& attr) const { // inhibits output detail::disable_output disable(sink); return subject.generate(sink, ctx, d, attr); } template info what(Context& context) const { return info("and-predicate", subject.what(context)); } Subject subject; }; /////////////////////////////////////////////////////////////////////////// // Generator generators: make_xxx function (objects) /////////////////////////////////////////////////////////////////////////// template struct make_composite : make_unary_composite {}; }}} namespace boost { namespace spirit { namespace traits { /////////////////////////////////////////////////////////////////////////// template struct has_semantic_action > : unary_has_semantic_action {}; /////////////////////////////////////////////////////////////////////////// template struct handles_container, Attribute , Context, Iterator> : unary_handles_container {}; }}} #endif