catch_push_back.hpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 Expr>
  40. struct catch_push_back<TryCatch, Exception, 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. , Expr
  48. >::type
  49. catch_expr;
  50. typedef phoenix::expression::try_catch<
  51. BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_CATCH_PUSH_BACK_R0, _)
  52. , catch_expr> gen_type;
  53. typedef typename gen_type::type type;
  54. static type
  55. make(
  56. TryCatch const& try_catch
  57. , Expr const& catch_
  58. )
  59. {
  60. return
  61. gen_type::make(
  62. BOOST_PP_REPEAT(
  63. BOOST_PHOENIX_ITERATION
  64. , BOOST_PHOENIX_CATCH_PUSH_BACK_R1
  65. , _
  66. )
  67. , proto::make_expr<
  68. phoenix::tag::catch_
  69. , proto::basic_default_domain
  70. >(catch_exception<Exception>(), catch_)
  71. );
  72. }
  73. };
  74. template <typename TryCatch, typename Expr>
  75. struct catch_all_push_back<TryCatch, Expr, BOOST_PHOENIX_ITERATION>
  76. {
  77. typedef
  78. typename proto::result_of::make_expr<
  79. phoenix::tag::catch_all
  80. , proto::basic_default_domain
  81. , Expr
  82. >::type
  83. catch_expr;
  84. typedef phoenix::expression::try_catch<
  85. BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_CATCH_PUSH_BACK_R0, _)
  86. , catch_expr> gen_type;
  87. typedef typename gen_type::type type;
  88. static type
  89. make(
  90. TryCatch const& try_catch
  91. , Expr const& catch_
  92. )
  93. {
  94. return
  95. gen_type::make(
  96. BOOST_PP_REPEAT(
  97. BOOST_PHOENIX_ITERATION
  98. , BOOST_PHOENIX_CATCH_PUSH_BACK_R1
  99. , _
  100. )
  101. , proto::make_expr<
  102. phoenix::tag::catch_all
  103. , proto::basic_default_domain
  104. >(catch_)
  105. );
  106. }
  107. };
  108. #endif