locals.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2001-2011 Hartmut Kaiser
  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(BOOST_SPIRIT_LOCALS_APRIL_03_2007_0506PM)
  8. #define BOOST_SPIRIT_LOCALS_APRIL_03_2007_0506PM
  9. #if defined(_MSC_VER)
  10. #pragma once
  11. #endif
  12. #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
  13. #include <boost/preprocessor/repetition/enum_params.hpp>
  14. #include <boost/mpl/vector.hpp>
  15. #include <boost/mpl/bool.hpp>
  16. #if !defined(BOOST_SPIRIT_MAX_LOCALS_SIZE)
  17. # define BOOST_SPIRIT_MAX_LOCALS_SIZE 10
  18. #else
  19. # if BOOST_SPIRIT_MAX_LOCALS_SIZE < 3
  20. # undef BOOST_SPIRIT_MAX_LOCALS_SIZE
  21. # define BOOST_SPIRIT_MAX_LOCALS_SIZE 10
  22. # endif
  23. #endif
  24. namespace boost { namespace spirit
  25. {
  26. ///////////////////////////////////////////////////////////////////////////
  27. template <
  28. BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
  29. BOOST_SPIRIT_MAX_LOCALS_SIZE, typename T, mpl::na)
  30. >
  31. struct locals
  32. : mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_SPIRIT_MAX_LOCALS_SIZE, T)> {};
  33. ///////////////////////////////////////////////////////////////////////////
  34. namespace detail
  35. {
  36. template <typename T>
  37. struct is_locals
  38. : mpl::false_
  39. {};
  40. template <BOOST_PP_ENUM_PARAMS(BOOST_SPIRIT_MAX_LOCALS_SIZE, typename T)>
  41. struct is_locals<locals<BOOST_PP_ENUM_PARAMS(BOOST_SPIRIT_MAX_LOCALS_SIZE, T)> >
  42. : mpl::true_
  43. {};
  44. }
  45. }}
  46. #endif