/src/contrib/boost/spirit/home/qi/detail/unused_skipper.hpp

http://pythonocc.googlecode.com/ · C++ Header · 50 lines · 31 code · 9 blank · 10 comment · 0 complexity · 9e3a4aa57729038b0243d868f4727a5c MD5 · raw file

  1. // Copyright (c) 2001-2010 Hartmut Kaiser
  2. //
  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. #if !defined(BOOST_SPIRIT_QI_UNUSED_SKIPPER_JUL_25_2009_0921AM)
  6. #define BOOST_SPIRIT_QI_UNUSED_SKIPPER_JUL_25_2009_0921AM
  7. #if defined(_MSC_VER)
  8. #pragma once
  9. #endif
  10. #include <boost/spirit/home/support/unused.hpp>
  11. namespace boost { namespace spirit { namespace qi { namespace detail
  12. {
  13. template <typename Skipper>
  14. struct unused_skipper : unused_type
  15. {
  16. unused_skipper(Skipper const& skipper)
  17. : skipper(skipper) {}
  18. Skipper const& skipper;
  19. private:
  20. // silence MSVC warning C4512: assignment operator could not be generated
  21. unused_skipper& operator= (unused_skipper const&);
  22. };
  23. // If a surrounding lexeme[] directive was specified, the current
  24. // skipper is of the type unused_skipper. In this case we
  25. // re-activate the skipper which was active before the skip[]
  26. // directive.
  27. template <typename Skipper>
  28. inline Skipper const&
  29. get_skipper(unused_skipper<Skipper> const& u)
  30. {
  31. return u.skipper;
  32. }
  33. // If no surrounding lexeme[] directive was specified we keep what we got.
  34. template <typename Skipper>
  35. inline Skipper const&
  36. get_skipper(Skipper const& u)
  37. {
  38. return u;
  39. }
  40. }}}}
  41. #endif