/*============================================================================= Copyright (c) 2001-2010 Joel de Guzman Copyright (c) 2001-2010 Hartmut Kaiser http://spirit.sourceforge.net/ 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(BOOST_SPIRIT_ACTION_DISPATCH_APRIL_18_2008_0720AM) #define BOOST_SPIRIT_ACTION_DISPATCH_APRIL_18_2008_0720AM #if defined(_MSC_VER) #pragma once #endif #include #include namespace boost { namespace spirit { namespace traits { template struct action_dispatch { // general handler for everything not explicitly specialized below template bool operator()(F const& f, Attribute& attr, Context& context) { bool pass = true; f(attr, context, pass); return pass; } // handler for phoenix actors // If the component this action has to be invoked for is a tuple, we // wrap any non-fusion tuple into a fusion tuple (done by pass_attribute) // and pass through any fusion tuple. template bool operator()(phoenix::actor const& f , Attribute& attr, Context& context) { bool pass = true; typename pass_attribute::type attr_wrap(attr); f(attr_wrap, context, pass); return pass; } // specializations for plain function pointers taking different number of // arguments template bool operator()(RT(*f)(A0, A1, A2), Attribute& attr, Context& context) { bool pass = true; f(attr, context, pass); return pass; } template bool operator()(RT(*f)(A0, A1), Attribute& attr, Context& context) { f(attr, context); return true; } template bool operator()(RT(*f)(A0), Attribute& attr, Context&) { f(attr); return true; } template bool operator()(RT(*f)(), Attribute&, Context&) { f(); return true; } }; }}} #endif