]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/metaparse/v1/one_of_c.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / metaparse / v1 / one_of_c.hpp
1 #ifndef BOOST_METAPARSE_V1_ONE_OF_C_HPP
2 #define BOOST_METAPARSE_V1_ONE_OF_C_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/one_of.hpp>
10 #include <boost/metaparse/v1/lit_c.hpp>
11
12 #include <boost/preprocessor/arithmetic/sub.hpp>
13 #include <boost/preprocessor/cat.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/enum_params_with_a_default.hpp>
18 #include <boost/preprocessor/repetition/repeat.hpp>
19 #include <boost/preprocessor/tuple/eat.hpp>
20
21 #include <climits>
22
23 namespace boost
24 {
25 namespace metaparse
26 {
27 namespace v1
28 {
29 #ifdef BOOST_NO_SCALAR_VALUE
30 # error BOOST_NO_SCALAR_VALUE already defined
31 #endif
32 #define BOOST_NO_SCALAR_VALUE LONG_MAX
33
34 template <
35 BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
36 BOOST_METAPARSE_LIMIT_ONE_OF_SIZE,
37 long C,
38 BOOST_NO_SCALAR_VALUE
39 )
40 >
41 struct one_of_c;
42
43 #ifdef BOOST_METAPARSE_ONE_OF_C_LIT
44 # error BOOST_METAPARSE_ONE_OF_C_LIT already defined
45 #endif
46 #define BOOST_METAPARSE_ONE_OF_C_LIT(z, n, unused) lit_c<BOOST_PP_CAT(C, n)>
47
48 #ifdef BOOST_METAPARSE_ONE_OF_C_CASE
49 # error BOOST_METAPARSE_ONE_OF_C_CASE already defined
50 #endif
51 #define BOOST_METAPARSE_ONE_OF_C_CASE(z, n, unused) \
52 template <BOOST_PP_ENUM_PARAMS(n, long C)> \
53 struct \
54 one_of_c< \
55 BOOST_PP_ENUM_PARAMS(n, C) \
56 BOOST_PP_COMMA_IF(n) \
57 BOOST_PP_ENUM( \
58 BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_ONE_OF_SIZE, n), \
59 BOOST_NO_SCALAR_VALUE BOOST_PP_TUPLE_EAT(3), \
60 ~ \
61 ) \
62 > : \
63 one_of< BOOST_PP_ENUM(n, BOOST_METAPARSE_ONE_OF_C_LIT, ~) > \
64 {};
65
66 BOOST_PP_REPEAT(
67 BOOST_METAPARSE_LIMIT_ONE_OF_SIZE,
68 BOOST_METAPARSE_ONE_OF_C_CASE,
69 ~
70 )
71
72 #undef BOOST_METAPARSE_ONE_OF_C_CASE
73 #undef BOOST_METAPARSE_ONE_OF_C_LIT
74 #undef BOOST_NO_SCALAR_VALUE
75 }
76 }
77 }
78
79 #endif
80