/Src/Dependencies/Boost/boost/spirit/home/support/detail/what_function.hpp

http://hadesmem.googlecode.com/ · C++ Header · 48 lines · 34 code · 7 blank · 7 comment · 0 complexity · 45faf195790c97551a3387c5d0aa6fb0 MD5 · raw file

  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. =============================================================================*/
  6. #if !defined(SPIRIT_WHAT_FUNCTION_APRIL_22_2007_0236PM)
  7. #define SPIRIT_WHAT_FUNCTION_APRIL_22_2007_0236PM
  8. #if defined(_MSC_VER)
  9. #pragma once
  10. #endif
  11. #include <string>
  12. #include <boost/spirit/home/support/info.hpp>
  13. #include <boost/detail/workaround.hpp>
  14. namespace boost { namespace spirit { namespace detail
  15. {
  16. template <typename Context>
  17. struct what_function
  18. {
  19. what_function(info& what, Context& context)
  20. : what(what), context(context)
  21. {
  22. what.value = std::list<info>();
  23. }
  24. template <typename Component>
  25. void operator()(Component const& component) const
  26. {
  27. #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
  28. component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
  29. #endif
  30. boost::get<std::list<info> >(what.value).
  31. push_back(component.what(context));
  32. }
  33. info& what;
  34. Context& context;
  35. private:
  36. // silence MSVC warning C4512: assignment operator could not be generated
  37. what_function& operator= (what_function const&);
  38. };
  39. }}}
  40. #endif