Chris@16
|
1
|
Chris@16
|
2 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
Chris@16
|
3 #ifndef BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
|
Chris@16
|
4 #define BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
|
Chris@16
|
5
|
Chris@16
|
6 #include <boost/phoenix/support/iterate.hpp>
|
Chris@16
|
7
|
Chris@16
|
8 #include <boost/phoenix/statement/detail/preprocessed/switch.hpp>
|
Chris@16
|
9
|
Chris@16
|
10 #endif
|
Chris@16
|
11 #else
|
Chris@16
|
12
|
Chris@16
|
13 #if !BOOST_PHOENIX_IS_ITERATING
|
Chris@16
|
14
|
Chris@16
|
15 #ifndef BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
|
Chris@16
|
16 #define BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/phoenix/support/iterate.hpp>
|
Chris@16
|
19
|
Chris@16
|
20 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
21 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/switch_" BOOST_PHOENIX_LIMIT_STR ".hpp")
|
Chris@16
|
22 #endif
|
Chris@16
|
23
|
Chris@16
|
24 /*==============================================================================
|
Chris@16
|
25 Copyright (c) 2005-2010 Joel de Guzman
|
Chris@16
|
26 Copyright (c) 2010 Thomas Heller
|
Chris@16
|
27
|
Chris@16
|
28 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
29 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
30 ==============================================================================*/
|
Chris@16
|
31
|
Chris@16
|
32 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
33 #pragma wave option(preserve: 1)
|
Chris@16
|
34 #endif
|
Chris@16
|
35
|
Chris@16
|
36 #define BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R(Z, N, DATA) \
|
Chris@16
|
37 typedef \
|
Chris@16
|
38 typename fusion::result_of::deref< \
|
Chris@16
|
39 typename fusion::result_of::advance_c< \
|
Chris@16
|
40 flat_view_begin \
|
Chris@16
|
41 , N \
|
Chris@16
|
42 >::type \
|
Chris@16
|
43 >::type \
|
Chris@16
|
44 BOOST_PP_CAT(case, N); \
|
Chris@16
|
45 typedef \
|
Chris@16
|
46 typename proto::detail::uncvref< \
|
Chris@16
|
47 typename proto::result_of::value< \
|
Chris@16
|
48 typename proto::result_of::child_c< \
|
Chris@16
|
49 BOOST_PP_CAT(case, N) \
|
Chris@16
|
50 , 0 \
|
Chris@16
|
51 >::type \
|
Chris@16
|
52 >::type \
|
Chris@16
|
53 >::type \
|
Chris@16
|
54 BOOST_PP_CAT(case_label, N); \
|
Chris@16
|
55 /**/
|
Chris@16
|
56
|
Chris@16
|
57 #define BOOST_PHOENIX_SWITCH_EVAL_R(Z, N, DATA) \
|
Chris@16
|
58 case BOOST_PP_CAT(case_label, N)::value : \
|
Chris@16
|
59 boost::phoenix::eval( \
|
Chris@16
|
60 proto::child_c<1>( \
|
Chris@16
|
61 fusion::deref( \
|
Chris@16
|
62 fusion::advance_c<N>(fusion::begin(flat_view)) \
|
Chris@16
|
63 ) \
|
Chris@16
|
64 ) \
|
Chris@16
|
65 , ctx \
|
Chris@16
|
66 ); \
|
Chris@16
|
67 break; \
|
Chris@16
|
68 /**/
|
Chris@16
|
69
|
Chris@16
|
70 #define BOOST_PHOENIX_ITERATION_PARAMS \
|
Chris@16
|
71 (3, (2, BOOST_PHOENIX_LIMIT, \
|
Chris@16
|
72 <boost/phoenix/statement/detail/switch.hpp>))
|
Chris@16
|
73 #include BOOST_PHOENIX_ITERATE()
|
Chris@16
|
74
|
Chris@16
|
75 #undef BOOST_PHOENIX_SWITCH_EVAL_R
|
Chris@16
|
76 #undef BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF
|
Chris@16
|
77
|
Chris@16
|
78 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
79 #pragma wave option(output: null)
|
Chris@16
|
80 #endif
|
Chris@16
|
81
|
Chris@16
|
82 #endif
|
Chris@16
|
83
|
Chris@16
|
84 #else
|
Chris@16
|
85 template <typename Context, typename Cond, typename Cases>
|
Chris@16
|
86 result_type
|
Chris@16
|
87 evaluate(
|
Chris@16
|
88 Context const & ctx
|
Chris@16
|
89 , Cond const & cond
|
Chris@16
|
90 , Cases const & cases
|
Chris@16
|
91 , mpl::int_<BOOST_PHOENIX_ITERATION>
|
Chris@16
|
92 , mpl::false_
|
Chris@16
|
93 ) const
|
Chris@16
|
94 {
|
Chris@16
|
95 typedef
|
Chris@16
|
96 typename proto::result_of::flatten<Cases const&>::type
|
Chris@16
|
97 flat_view_type;
|
Chris@16
|
98
|
Chris@16
|
99 typedef
|
Chris@16
|
100 typename fusion::result_of::begin<flat_view_type>::type
|
Chris@16
|
101 flat_view_begin;
|
Chris@16
|
102
|
Chris@16
|
103 flat_view_type flat_view(proto::flatten(cases));
|
Chris@16
|
104
|
Chris@16
|
105 BOOST_PP_REPEAT(
|
Chris@16
|
106 BOOST_PHOENIX_ITERATION
|
Chris@16
|
107 , BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R
|
Chris@16
|
108 , BOOST_PHOENIX_ITERATION
|
Chris@16
|
109 )
|
Chris@16
|
110
|
Chris@16
|
111 switch(boost::phoenix::eval(cond, ctx))
|
Chris@16
|
112 {
|
Chris@16
|
113 BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_SWITCH_EVAL_R, _)
|
Chris@16
|
114 }
|
Chris@16
|
115 }
|
Chris@16
|
116
|
Chris@16
|
117 template <typename Context, typename Cond, typename Cases>
|
Chris@16
|
118 result_type
|
Chris@16
|
119 evaluate(
|
Chris@16
|
120 Context const & ctx
|
Chris@16
|
121 , Cond const & cond
|
Chris@16
|
122 , Cases const & cases
|
Chris@16
|
123 , mpl::int_<BOOST_PHOENIX_ITERATION>
|
Chris@16
|
124 , mpl::true_
|
Chris@16
|
125 ) const
|
Chris@16
|
126 {
|
Chris@16
|
127 typedef
|
Chris@16
|
128 typename proto::result_of::flatten<Cases const&>::type
|
Chris@16
|
129 flat_view_type;
|
Chris@16
|
130
|
Chris@16
|
131 typedef
|
Chris@16
|
132 typename fusion::result_of::begin<flat_view_type>::type
|
Chris@16
|
133 flat_view_begin;
|
Chris@16
|
134
|
Chris@16
|
135 flat_view_type flat_view(proto::flatten(cases));
|
Chris@16
|
136
|
Chris@16
|
137 BOOST_PP_REPEAT(
|
Chris@16
|
138 BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
|
Chris@16
|
139 , BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R
|
Chris@16
|
140 , BOOST_PHOENIX_ITERATION
|
Chris@16
|
141 )
|
Chris@16
|
142
|
Chris@16
|
143 switch(boost::phoenix::eval(cond, ctx))
|
Chris@16
|
144 {
|
Chris@16
|
145 BOOST_PP_REPEAT(
|
Chris@16
|
146 BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
|
Chris@16
|
147 , BOOST_PHOENIX_SWITCH_EVAL_R, _
|
Chris@16
|
148 )
|
Chris@16
|
149 default:
|
Chris@16
|
150 boost::phoenix::eval(
|
Chris@16
|
151 proto::child_c<0>(
|
Chris@16
|
152 fusion::deref(
|
Chris@16
|
153 fusion::advance_c<
|
Chris@16
|
154 BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
|
Chris@16
|
155 >(fusion::begin(flat_view))
|
Chris@16
|
156 )
|
Chris@16
|
157 )
|
Chris@16
|
158 , ctx
|
Chris@16
|
159 );
|
Chris@16
|
160 }
|
Chris@16
|
161 }
|
Chris@16
|
162
|
Chris@16
|
163 #endif
|
Chris@16
|
164
|
Chris@16
|
165 #endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|