2 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
3 #ifndef BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
4 #define BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
6 #include <boost/phoenix/support/iterate.hpp>
8 #include <boost/phoenix/statement/detail/preprocessed/switch.hpp>
13 #if !BOOST_PHOENIX_IS_ITERATING
15 #ifndef BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
16 #define BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
18 #include <boost/phoenix/support/iterate.hpp>
20 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
21 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/switch_" BOOST_PHOENIX_LIMIT_STR ".hpp")
24 /*==============================================================================
25 Copyright (c) 2005-2010 Joel de Guzman
26 Copyright (c) 2010 Thomas Heller
28 Distributed under the Boost Software License, Version 1.0. (See accompanying
29 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
30 ==============================================================================*/
32 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
33 #pragma wave option(preserve: 1)
36 #define BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R(Z, N, DATA) \
38 typename fusion::result_of::deref< \
39 typename fusion::result_of::advance_c< \
44 BOOST_PP_CAT(case, N); \
46 typename proto::detail::uncvref< \
47 typename proto::result_of::value< \
48 typename proto::result_of::child_c< \
49 BOOST_PP_CAT(case, N) \
54 BOOST_PP_CAT(case_label, N); \
57 #define BOOST_PHOENIX_SWITCH_EVAL_R(Z, N, DATA) \
58 case BOOST_PP_CAT(case_label, N)::value : \
59 boost::phoenix::eval( \
62 fusion::advance_c<N>(fusion::begin(flat_view)) \
70 #define BOOST_PHOENIX_ITERATION_PARAMS \
71 (3, (2, BOOST_PHOENIX_LIMIT, \
72 <boost/phoenix/statement/detail/switch.hpp>))
73 #include BOOST_PHOENIX_ITERATE()
75 #undef BOOST_PHOENIX_SWITCH_EVAL_R
76 #undef BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF
78 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
79 #pragma wave option(output: null)
85 template <typename Context, typename Cond, typename Cases>
91 , mpl::int_<BOOST_PHOENIX_ITERATION>
96 typename proto::result_of::flatten<Cases const&>::type
100 typename fusion::result_of::begin<flat_view_type>::type
103 flat_view_type flat_view(proto::flatten(cases));
106 BOOST_PHOENIX_ITERATION
107 , BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R
108 , BOOST_PHOENIX_ITERATION
111 switch(boost::phoenix::eval(cond, ctx))
113 BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_SWITCH_EVAL_R, _)
117 template <typename Context, typename Cond, typename Cases>
122 , Cases const & cases
123 , mpl::int_<BOOST_PHOENIX_ITERATION>
128 typename proto::result_of::flatten<Cases const&>::type
132 typename fusion::result_of::begin<flat_view_type>::type
135 flat_view_type flat_view(proto::flatten(cases));
138 BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
139 , BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R
140 , BOOST_PHOENIX_ITERATION
143 switch(boost::phoenix::eval(cond, ctx))
146 BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
147 , BOOST_PHOENIX_SWITCH_EVAL_R, _
150 boost::phoenix::eval(
154 BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
155 >(fusion::begin(flat_view))
165 #endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES