1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
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(BOOST_SPIRIT_SUCCESS_HANDLER_FEBRUARY_25_2011_1051AM)
8 #define BOOST_SPIRIT_SUCCESS_HANDLER_FEBRUARY_25_2011_1051AM
14 #include <boost/spirit/home/qi/nonterminal/rule.hpp>
15 #include <boost/function.hpp>
17 namespace boost { namespace spirit { namespace qi
20 typename Iterator, typename Context
21 , typename Skipper, typename F
23 struct success_handler
26 bool(Iterator& first, Iterator const& last
28 , Skipper const& skipper
32 success_handler(function_type subject_, F f_)
39 Iterator& first, Iterator const& last
40 , Context& context, Skipper const& skipper) const
43 bool r = subject(i, last, context, skipper);
52 skip_over(first, last, skipper);
53 params args(first, last, i);
61 function_type subject;
66 typename Iterator, typename T0, typename T1, typename T2
68 void on_success(rule<Iterator, T0, T1, T2>& r, F f)
70 typedef rule<Iterator, T0, T1, T2> rule_type;
75 , typename rule_type::context_type
76 , typename rule_type::skipper_type
79 r.f = success_handler(r.f, f);