catch_push_back.hpp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. #if !BOOST_PHOENIX_IS_ITERATING
  2. #ifndef BOOST_PHOENIX_STATEMENT_DETAIL_CATCH_PUSH_BACK_HPP
  3. #define BOOST_PHOENIX_STATEMENT_DETAIL_CATCH_PUSH_BACK_HPP
  4. #include <boost/phoenix/support/iterate.hpp>
  5. #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  6. #include <boost/phoenix/statement/detail/preprocessed/catch_push_back.hpp>
  7. #else
  8. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  9. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/catch_push_back_" BOOST_PHOENIX_LIMIT_STR ".hpp")
  10. #endif
  11. /*==============================================================================
  12. Copyright (c) 2005-2010 Joel de Guzman
  13. Copyright (c) 2010 Thomas Heller
  14. Distributed under the Boost Software License, Version 1.0. (See accompanying
  15. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  16. ==============================================================================*/
  17. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  18. #pragma wave option(preserve: 1)
  19. #endif
  20. #define BOOST_PHOENIX_CATCH_PUSH_BACK_R0(Z, N, DATA) \
  21. BOOST_PP_COMMA_IF(N) \
  22. typename proto::result_of::child_c<TryCatch, N>::type \
  23. /**/
  24. #define BOOST_PHOENIX_CATCH_PUSH_BACK_R1(Z, N, DATA) \
  25. BOOST_PP_COMMA_IF(N) proto::child_c<N>(try_catch) \
  26. /**/
  27. #define BOOST_PHOENIX_ITERATION_PARAMS \
  28. (3, (2, BOOST_PHOENIX_CATCH_LIMIT, \
  29. <boost/phoenix/statement/detail/catch_push_back.hpp>))
  30. #include BOOST_PHOENIX_ITERATE()
  31. #undef BOOST_PHOENIX_CATCH_PUSH_BACK_R0
  32. #undef BOOST_PHOENIX_CATCH_PUSH_BACK_R1
  33. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  34. #pragma wave option(output: null)
  35. #endif
  36. #endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
  37. #endif
  38. #else
  39. template <typename TryCatch, typename Exception, typename Capture, typename Expr>
  40. struct catch_push_back<TryCatch, Exception, Capture, Expr, BOOST_PHOENIX_ITERATION>
  41. {
  42. typedef
  43. typename proto::result_of::make_expr<
  44. phoenix::tag::catch_
  45. , proto::basic_default_domain
  46. , catch_exception<Exception>
  47. , Capture
  48. , Expr
  49. >::type
  50. catch_expr;
  51. typedef phoenix::expression::try_catch<
  52. BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_CATCH_PUSH_BACK_R0, _)
  53. , catch_expr> gen_type;
  54. typedef typename gen_type::type type;
  55. static type
  56. make(
  57. TryCatch const& try_catch
  58. , Capture const& capture
  59. , Expr const& catch_
  60. )
  61. {
  62. return
  63. gen_type::make(
  64. BOOST_PP_REPEAT(
  65. BOOST_PHOENIX_ITERATION
  66. , BOOST_PHOENIX_CATCH_PUSH_BACK_R1
  67. , _
  68. )
  69. , proto::make_expr<
  70. phoenix::tag::catch_
  71. , proto::basic_default_domain
  72. >(catch_exception<Exception>(), capture, catch_)
  73. );
  74. }
  75. };
  76. template <typename TryCatch, typename Exception, typename Expr>
  77. struct catch_push_back<TryCatch, Exception, void, Expr, BOOST_PHOENIX_ITERATION>
  78. {
  79. typedef
  80. typename proto::result_of::make_expr<
  81. phoenix::tag::catch_
  82. , proto::basic_default_domain
  83. , catch_exception<Exception>
  84. , Expr
  85. >::type
  86. catch_expr;
  87. typedef phoenix::expression::try_catch<
  88. BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_CATCH_PUSH_BACK_R0, _)
  89. , catch_expr> gen_type;
  90. typedef typename gen_type::type type;
  91. static type
  92. make(
  93. TryCatch const& try_catch
  94. , Expr const& catch_
  95. )
  96. {
  97. return
  98. gen_type::make(
  99. BOOST_PP_REPEAT(
  100. BOOST_PHOENIX_ITERATION
  101. , BOOST_PHOENIX_CATCH_PUSH_BACK_R1
  102. , _
  103. )
  104. , proto::make_expr<
  105. phoenix::tag::catch_
  106. , proto::basic_default_domain
  107. >(catch_exception<Exception>(), catch_)
  108. );
  109. }
  110. };
  111. template <typename TryCatch, typename Expr>
  112. struct catch_all_push_back<TryCatch, Expr, BOOST_PHOENIX_ITERATION>
  113. {
  114. typedef
  115. typename proto::result_of::make_expr<
  116. phoenix::tag::catch_all
  117. , proto::basic_default_domain
  118. , Expr
  119. >::type
  120. catch_expr;
  121. typedef phoenix::expression::try_catch<
  122. BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_CATCH_PUSH_BACK_R0, _)
  123. , catch_expr> gen_type;
  124. typedef typename gen_type::type type;
  125. static type
  126. make(
  127. TryCatch const& try_catch
  128. , Expr const& catch_
  129. )
  130. {
  131. return
  132. gen_type::make(
  133. BOOST_PP_REPEAT(
  134. BOOST_PHOENIX_ITERATION
  135. , BOOST_PHOENIX_CATCH_PUSH_BACK_R1
  136. , _
  137. )
  138. , proto::make_expr<
  139. phoenix::tag::catch_all
  140. , proto::basic_default_domain
  141. >(catch_)
  142. );
  143. }
  144. };
  145. #endif