Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:48

0001 #ifndef BOOST_METAPARSE_V1_CPP98_ONE_OF_C_HPP
0002 #define BOOST_METAPARSE_V1_CPP98_ONE_OF_C_HPP
0003 
0004 // Copyright Abel Sinkovics (abel@sinkovics.hu)  2013.
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 #include <boost/metaparse/v1/one_of.hpp>
0010 #include <boost/metaparse/v1/lit_c.hpp>
0011 #include <boost/metaparse/limit_one_of_size.hpp>
0012 
0013 #include <boost/preprocessor/arithmetic/sub.hpp>
0014 #include <boost/preprocessor/cat.hpp>
0015 #include <boost/preprocessor/punctuation/comma_if.hpp>
0016 #include <boost/preprocessor/repetition/enum.hpp>
0017 #include <boost/preprocessor/repetition/enum_params.hpp>
0018 #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
0019 #include <boost/preprocessor/repetition/repeat.hpp>
0020 #include <boost/preprocessor/tuple/eat.hpp>
0021 
0022 #include <climits>
0023 
0024 namespace boost
0025 {
0026   namespace metaparse
0027   {
0028     namespace v1
0029     {
0030       #ifdef BOOST_NO_SCALAR_VALUE
0031       #  error BOOST_NO_SCALAR_VALUE already defined
0032       #endif
0033       #define BOOST_NO_SCALAR_VALUE LONG_MAX
0034 
0035       template <
0036         BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
0037           BOOST_METAPARSE_LIMIT_ONE_OF_SIZE,
0038           long C,
0039           BOOST_NO_SCALAR_VALUE
0040         )
0041       >
0042       struct one_of_c;
0043 
0044       #ifdef BOOST_METAPARSE_ONE_OF_C_LIT
0045       #  error BOOST_METAPARSE_ONE_OF_C_LIT already defined
0046       #endif
0047       #define BOOST_METAPARSE_ONE_OF_C_LIT(z, n, unused) lit_c<BOOST_PP_CAT(C, n)>
0048 
0049       #ifdef BOOST_METAPARSE_ONE_OF_C_CASE
0050       #  error BOOST_METAPARSE_ONE_OF_C_CASE already defined
0051       #endif
0052       #define BOOST_METAPARSE_ONE_OF_C_CASE(z, n, unused) \
0053         template <BOOST_PP_ENUM_PARAMS(n, long C)> \
0054         struct \
0055           one_of_c< \
0056             BOOST_PP_ENUM_PARAMS(n, C) \
0057             BOOST_PP_COMMA_IF(n) \
0058             BOOST_PP_ENUM( \
0059               BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_ONE_OF_SIZE, n), \
0060               BOOST_NO_SCALAR_VALUE BOOST_PP_TUPLE_EAT(3), \
0061               ~ \
0062             ) \
0063           > : \
0064           one_of< BOOST_PP_ENUM(n, BOOST_METAPARSE_ONE_OF_C_LIT, ~) > \
0065         {};
0066 
0067       BOOST_PP_REPEAT(
0068         BOOST_METAPARSE_LIMIT_ONE_OF_SIZE,
0069         BOOST_METAPARSE_ONE_OF_C_CASE,
0070         ~
0071       )
0072 
0073       #undef BOOST_METAPARSE_ONE_OF_C_CASE
0074       #undef BOOST_METAPARSE_ONE_OF_C_LIT
0075       #undef BOOST_NO_SCALAR_VALUE
0076     }
0077   }
0078 }
0079 
0080 #endif
0081