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(SPIRIT_PERMUTE_FUNCTION_MARCH_13_2007_1129AM)
8 #define SPIRIT_PERMUTE_FUNCTION_MARCH_13_2007_1129AM
14 #include <boost/spirit/home/support/unused.hpp>
15 #include <boost/optional.hpp>
17 namespace boost { namespace spirit { namespace qi { namespace detail
19 template <typename Iterator, typename Context, typename Skipper>
20 struct permute_function
23 Iterator& first_, Iterator const& last_
24 , Context& context_, Skipper const& skipper_)
32 template <typename Component, typename Attribute>
33 bool operator()(Component const& component, Attribute& attr)
35 // return true if the parser succeeds and the slot is not yet taken
36 if (!*taken && component.parse(first, last, context, skipper, attr))
46 template <typename Component, typename Attribute>
47 bool operator()(Component const& component, boost::optional<Attribute>& attr)
49 // return true if the parser succeeds and the slot is not yet taken
51 if (!*taken && component.parse(first, last, context, skipper, val))
62 template <typename Component>
63 bool operator()(Component const& component)
65 // return true if the parser succeeds and the slot is not yet taken
66 if (!*taken && component.parse(first, last, context, skipper, unused))
79 Skipper const& skipper;
83 // silence MSVC warning C4512: assignment operator could not be generated
84 permute_function& operator= (permute_function const&);