sequence_base_id.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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_SEQUENCE_BASE_ID_MAR_15_2009_1243PM)
  7. #define SPIRIT_SEQUENCE_BASE_ID_MAR_15_2009_1243PM
  8. #if defined(_MSC_VER)
  9. #pragma once
  10. #endif
  11. #include <boost/mpl/has_xxx.hpp>
  12. #include <boost/utility/enable_if.hpp>
  13. #include <boost/spirit/home/support/attributes.hpp>
  14. namespace boost { namespace spirit { namespace traits
  15. {
  16. namespace detail
  17. {
  18. BOOST_MPL_HAS_XXX_TRAIT_DEF(sequence_base_id)
  19. }
  20. // We specialize this for sequences (see support/attributes.hpp).
  21. // For sequences, we only wrap the attribute in a tuple IFF
  22. // it is not already a fusion tuple.
  23. //
  24. // Note: in the comment above, "sequence" is a spirit sequence
  25. // component (parser or generator), and a tuple is a fusion sequence
  26. // (to avoid terminology confusion).
  27. template <typename Derived, typename Attribute>
  28. struct pass_attribute<Derived, Attribute,
  29. typename enable_if<detail::has_sequence_base_id<Derived> >::type>
  30. : wrap_if_not_tuple<Attribute> {};
  31. }}}
  32. #endif