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 #ifndef BOOST_SPIRIT_SUPPORT_DETAIL_WHAT_FUNCTION_HPP 8 #define BOOST_SPIRIT_SUPPORT_DETAIL_WHAT_FUNCTION_HPP 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 { what_functionboost::spirit::detail::what_function23 what_function(info& what_, Context& context_) 24 : what(what_), context(context_) 25 { 26 what.value = std::list<info>(); 27 } 28 29 template <typename Component> operator ()boost::spirit::detail::what_function30 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> >(what.value). 36 push_back(component.what(context)); 37 } 38 39 info& what; 40 Context& context; 41 42 // silence MSVC warning C4512: assignment operator could not be generated 43 BOOST_DELETED_FUNCTION(what_function& operator= (what_function const&)) 44 }; 45 }}} 46 47 #endif 48