| 1 | /*============================================================================= |
| 2 | Copyright (c) 2001-2011 Joel de Guzman |
| 3 | |
| 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_WHAT_FUNCTION_APRIL_22_2007_0236PM) |
| 8 | #define SPIRIT_WHAT_FUNCTION_APRIL_22_2007_0236PM |
| 9 | |
| 10 | #if defined(_MSC_VER) |
| 11 | #pragma once |
| 12 | #endif |
| 13 | |
| 14 | #include <string> |
| 15 | #include <boost/spirit/home/support/info.hpp> |
| 16 | #include <boost/detail/workaround.hpp> |
| 17 | |
| 18 | namespace boost { namespace spirit { namespace detail |
| 19 | { |
| 20 | template <typename Context> |
| 21 | struct what_function |
| 22 | { |
| 23 | what_function(info& what_, Context& context_) |
| 24 | : what(what_), context(context_) |
| 25 | { |
| 26 | what.value = std::list<info>(); |
| 27 | } |
| 28 | |
| 29 | template <typename Component> |
| 30 | void operator()(Component const& component) const |
| 31 | { |
| 32 | #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600)) |
| 33 | component; // suppresses warning: C4100: 'component' : unreferenced formal parameter |
| 34 | #endif |
| 35 | boost::get<std::list<info> >(operand&: what.value). |
| 36 | push_back(component.what(context)); |
| 37 | } |
| 38 | |
| 39 | info& what; |
| 40 | Context& context; |
| 41 | |
| 42 | private: |
| 43 | // silence MSVC warning C4512: assignment operator could not be generated |
| 44 | what_function& operator= (what_function const&); |
| 45 | }; |
| 46 | }}} |
| 47 | |
| 48 | #endif |
| 49 | |