specification.hpp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Copyright Daniel Wallin 2006.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_SPECIFICATION_HPP
  6. #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_SPECIFICATION_HPP
  7. #include <boost/parameter/optional.hpp>
  8. // Helper macros for BOOST_PARAMETER_SPECIFICATION_ELEM_R.
  9. #define BOOST_PARAMETER_QUALIFIED_TAG_optional(tag) \
  10. optional<tag
  11. /**/
  12. #include <boost/parameter/required.hpp>
  13. #define BOOST_PARAMETER_QUALIFIED_TAG_required(tag) \
  14. required<tag
  15. /**/
  16. #include <boost/parameter/deduced.hpp>
  17. #define BOOST_PARAMETER_QUALIFIED_TAG_deduced_optional(tag) \
  18. optional< ::boost::parameter::deduced<tag>
  19. /**/
  20. #define BOOST_PARAMETER_QUALIFIED_TAG_deduced_required(tag) \
  21. required< ::boost::parameter::deduced<tag>
  22. /**/
  23. #include <boost/parameter/aux_/preprocessor/impl/argument_specs.hpp>
  24. #include <boost/parameter/config.hpp>
  25. #include <boost/preprocessor/punctuation/comma_if.hpp>
  26. #include <boost/preprocessor/cat.hpp>
  27. #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
  28. #include <boost/parameter/aux_/use_default.hpp>
  29. #define BOOST_PARAMETER_SPECIFICATION_ELEM_R(r, tag_namespace, i, elem) \
  30. BOOST_PP_COMMA_IF(i) ::boost::parameter::BOOST_PP_CAT( \
  31. BOOST_PARAMETER_QUALIFIED_TAG_ \
  32. , BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
  33. )(tag_namespace::BOOST_PARAMETER_FN_ARG_NAME(elem)) \
  34. , ::boost::parameter::aux::use_default \
  35. >
  36. /**/
  37. #else // !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
  38. #include <boost/parameter/aux_/pp_impl/unwrap_predicate.hpp>
  39. // Expands to each boost::parameter::parameters<> element type.
  40. #define BOOST_PARAMETER_SPECIFICATION_ELEM_R(r, tag_namespace, i, elem) \
  41. BOOST_PP_COMMA_IF(i) ::boost::parameter::BOOST_PP_CAT( \
  42. BOOST_PARAMETER_QUALIFIED_TAG_ \
  43. , BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
  44. )(tag_namespace::BOOST_PARAMETER_FN_ARG_NAME(elem)) \
  45. , typename ::boost::parameter::aux::unwrap_predicate< \
  46. void BOOST_PARAMETER_FN_ARG_PRED(elem) \
  47. >::type \
  48. >
  49. /**/
  50. #endif // Borland workarounds needed.
  51. #include <boost/parameter/parameters.hpp>
  52. #include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
  53. #include <boost/preprocessor/control/if.hpp>
  54. #include <boost/preprocessor/seq/for_each_i.hpp>
  55. // Expands to a boost::parameter::parameters<> specialization for the
  56. // function named base. Used by BOOST_PARAMETER_CONSTRUCTOR_AUX and
  57. // BOOST_PARAMETER_FUNCTION_HEAD for their respective ParameterSpec models.
  58. #define BOOST_PARAMETER_SPECIFICATION(tag_ns, base, split_args, is_const) \
  59. template <typename BoostParameterDummy> \
  60. struct BOOST_PP_CAT( \
  61. BOOST_PP_CAT( \
  62. BOOST_PP_IF( \
  63. is_const \
  64. , boost_param_params_const_ \
  65. , boost_param_params_ \
  66. ) \
  67. , __LINE__ \
  68. ) \
  69. , BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
  70. ) : ::boost::parameter::parameters< \
  71. BOOST_PP_SEQ_FOR_EACH_I( \
  72. BOOST_PARAMETER_SPECIFICATION_ELEM_R, tag_ns, split_args \
  73. ) \
  74. > \
  75. { \
  76. }; \
  77. typedef BOOST_PP_CAT( \
  78. BOOST_PP_CAT( \
  79. BOOST_PP_IF( \
  80. is_const \
  81. , boost_param_params_const_ \
  82. , boost_param_params_ \
  83. ) \
  84. , __LINE__ \
  85. ) \
  86. , BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
  87. )<int>
  88. /**/
  89. #endif // include guard