1 #ifndef BOOST_METAPARSE_V1_CPP98_IMPL_SIZE_HPP 2 #define BOOST_METAPARSE_V1_CPP98_IMPL_SIZE_HPP 3 4 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 // Distributed under the Boost Software License, Version 1.0. 6 // (See accompanying file LICENSE_1_0.txt or copy at 7 // http://www.boost.org/LICENSE_1_0.txt) 8 9 #include <boost/metaparse/v1/cpp98/fwd/string.hpp> 10 11 #include <boost/mpl/int.hpp> 12 13 #include <boost/preprocessor/arithmetic/sub.hpp> 14 #include <boost/preprocessor/punctuation/comma_if.hpp> 15 #include <boost/preprocessor/repetition/enum.hpp> 16 #include <boost/preprocessor/repetition/enum_params.hpp> 17 #include <boost/preprocessor/repetition/repeat.hpp> 18 #include <boost/preprocessor/tuple/eat.hpp> 19 20 namespace boost 21 { 22 namespace metaparse 23 { 24 namespace v1 25 { 26 namespace impl 27 { 28 template <class S> 29 struct size; 30 31 #ifdef BOOST_METAPARSE_STRING_CASE 32 # error BOOST_METAPARSE_STRING_CASE 33 #endif 34 #define BOOST_METAPARSE_STRING_CASE(z, n, unused) \ 35 template <BOOST_PP_ENUM_PARAMS(n, int C)> \ 36 struct \ 37 size< \ 38 string< \ 39 BOOST_PP_ENUM_PARAMS(n, C) BOOST_PP_COMMA_IF(n) \ 40 BOOST_PP_ENUM( \ 41 BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_STRING_SIZE, n), \ 42 BOOST_NO_CHAR BOOST_PP_TUPLE_EAT(3), \ 43 ~ \ 44 ) \ 45 > \ 46 > : \ 47 boost::mpl::int_<n> \ 48 {}; 49 50 BOOST_PP_REPEAT( 51 BOOST_METAPARSE_LIMIT_STRING_SIZE, 52 BOOST_METAPARSE_STRING_CASE, 53 ~ 54 ) 55 56 #undef BOOST_METAPARSE_STRING_CASE 57 } 58 } 59 } 60 } 61 62 #endif 63 64