File indexing completed on 2025-01-18 09:47:40
0001
0002 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
0003 #ifndef BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
0004 #define BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
0005
0006 #include <boost/phoenix/support/iterate.hpp>
0007
0008 #include <boost/phoenix/statement/detail/preprocessed/switch.hpp>
0009
0010 #endif
0011 #else
0012
0013 #if !BOOST_PHOENIX_IS_ITERATING
0014
0015 #ifndef BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
0016 #define BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
0017
0018 #include <boost/phoenix/support/iterate.hpp>
0019
0020 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
0021 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/switch_" BOOST_PHOENIX_LIMIT_STR ".hpp")
0022 #endif
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
0033 #pragma wave option(preserve: 1)
0034 #endif
0035
0036 #define BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R(Z, N, DATA) \
0037 typedef \
0038 typename fusion::result_of::deref< \
0039 typename fusion::result_of::advance_c< \
0040 flat_view_begin \
0041 , N \
0042 >::type \
0043 >::type \
0044 BOOST_PP_CAT(case, N); \
0045 typedef \
0046 typename proto::detail::uncvref< \
0047 typename proto::result_of::value< \
0048 typename proto::result_of::child_c< \
0049 BOOST_PP_CAT(case, N) \
0050 , 0 \
0051 >::type \
0052 >::type \
0053 >::type \
0054 BOOST_PP_CAT(case_label, N); \
0055
0056
0057 #define BOOST_PHOENIX_SWITCH_EVAL_R(Z, N, DATA) \
0058 case BOOST_PP_CAT(case_label, N)::value : \
0059 boost::phoenix::eval( \
0060 proto::child_c<1>( \
0061 fusion::deref( \
0062 fusion::advance_c<N>(fusion::begin(flat_view)) \
0063 ) \
0064 ) \
0065 , ctx \
0066 ); \
0067 break; \
0068
0069
0070 #define BOOST_PHOENIX_ITERATION_PARAMS \
0071 (3, (2, BOOST_PHOENIX_LIMIT, \
0072 <boost/phoenix/statement/detail/switch.hpp>))
0073 #include BOOST_PHOENIX_ITERATE()
0074
0075 #undef BOOST_PHOENIX_SWITCH_EVAL_R
0076 #undef BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF
0077
0078 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
0079 #pragma wave option(output: null)
0080 #endif
0081
0082 #endif
0083
0084 #else
0085 template <typename Context, typename Cond, typename Cases>
0086 result_type
0087 evaluate(
0088 Context const & ctx
0089 , Cond const & cond
0090 , Cases const & cases
0091 , mpl::int_<BOOST_PHOENIX_ITERATION>
0092 , mpl::false_
0093 ) const
0094 {
0095 typedef
0096 typename proto::result_of::flatten<Cases const&>::type
0097 flat_view_type;
0098
0099 typedef
0100 typename fusion::result_of::begin<flat_view_type>::type
0101 flat_view_begin;
0102
0103 flat_view_type flat_view(proto::flatten(cases));
0104
0105 BOOST_PP_REPEAT(
0106 BOOST_PHOENIX_ITERATION
0107 , BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R
0108 , BOOST_PHOENIX_ITERATION
0109 )
0110
0111 switch(boost::phoenix::eval(cond, ctx))
0112 {
0113 BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_SWITCH_EVAL_R, _)
0114 }
0115 }
0116
0117 template <typename Context, typename Cond, typename Cases>
0118 result_type
0119 evaluate(
0120 Context const & ctx
0121 , Cond const & cond
0122 , Cases const & cases
0123 , mpl::int_<BOOST_PHOENIX_ITERATION>
0124 , mpl::true_
0125 ) const
0126 {
0127 typedef
0128 typename proto::result_of::flatten<Cases const&>::type
0129 flat_view_type;
0130
0131 typedef
0132 typename fusion::result_of::begin<flat_view_type>::type
0133 flat_view_begin;
0134
0135 flat_view_type flat_view(proto::flatten(cases));
0136
0137 BOOST_PP_REPEAT(
0138 BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
0139 , BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R
0140 , BOOST_PHOENIX_ITERATION
0141 )
0142
0143 switch(boost::phoenix::eval(cond, ctx))
0144 {
0145 BOOST_PP_REPEAT(
0146 BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
0147 , BOOST_PHOENIX_SWITCH_EVAL_R, _
0148 )
0149 default:
0150 boost::phoenix::eval(
0151 proto::child_c<0>(
0152 fusion::deref(
0153 fusion::advance_c<
0154 BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
0155 >(fusion::begin(flat_view))
0156 )
0157 )
0158 , ctx
0159 );
0160 }
0161 }
0162
0163 #endif
0164
0165 #endif