at_c.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef BOOST_METAPARSE_V1_CPP98_IMPL_AT_C_HPP
  2. #define BOOST_METAPARSE_V1_CPP98_IMPL_AT_C_HPP
  3. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #include <boost/metaparse/config.hpp>
  8. #include <boost/metaparse/v1/cpp98/fwd/string.hpp>
  9. #include <boost/mpl/char.hpp>
  10. #include <boost/preprocessor/repetition/enum_params.hpp>
  11. #include <boost/preprocessor/repetition/repeat.hpp>
  12. namespace boost
  13. {
  14. namespace metaparse
  15. {
  16. namespace v1
  17. {
  18. namespace impl
  19. {
  20. template <class S, int N>
  21. struct at_c;
  22. #ifdef BOOST_METAPARSE_STRING_CASE
  23. # error BOOST_METAPARSE_STRING_CASE is already defined
  24. #endif
  25. #define BOOST_METAPARSE_STRING_CASE(z, n, unused) \
  26. template < \
  27. BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C) \
  28. > \
  29. struct \
  30. at_c< \
  31. string< \
  32. BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C) \
  33. >, \
  34. n \
  35. > : \
  36. boost::mpl::char_<BOOST_PP_CAT(C, n)> \
  37. {};
  38. BOOST_PP_REPEAT(
  39. BOOST_METAPARSE_LIMIT_STRING_SIZE,
  40. BOOST_METAPARSE_STRING_CASE,
  41. ~
  42. )
  43. #undef BOOST_METAPARSE_STRING_CASE
  44. }
  45. }
  46. }
  47. }
  48. #endif