File indexing completed on 2025-01-18 09:38:50
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_IOSTREAMS_DETAIL_FORWARD_HPP_INCLUDED
0009 #define BOOST_IOSTREAMS_DETAIL_FORWARD_HPP_INCLUDED
0010
0011 #if defined(_MSC_VER)
0012 # pragma once
0013 #endif
0014
0015 #include <boost/config.hpp> // BOOST_MSVC, BOOST_NO_SFINAE
0016 #include <boost/detail/workaround.hpp>
0017 #include <boost/iostreams/detail/config/limits.hpp>
0018 #include <boost/iostreams/detail/push_params.hpp>
0019 #include <boost/preprocessor/arithmetic/dec.hpp>
0020 #include <boost/preprocessor/arithmetic/inc.hpp>
0021 #include <boost/preprocessor/punctuation/comma_if.hpp>
0022 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
0023 #include <boost/preprocessor/repetition/enum_params.hpp>
0024 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
0025 #include <boost/preprocessor/tuple/elem.hpp>
0026 #include <boost/type_traits/is_same.hpp>
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 #define BOOST_IOSTREAMS_FORWARD(class, impl, device, params, args) \
0044 class(const device& t params()) \
0045 { this->impl(::boost::iostreams::detail::wrap(t) args()); } \
0046 class(device& t params()) \
0047 { this->impl(::boost::iostreams::detail::wrap(t) args()); } \
0048 class(const ::boost::reference_wrapper<device>& ref params()) \
0049 { this->impl(ref args()); } \
0050 void open(const device& t params()) \
0051 { this->impl(::boost::iostreams::detail::wrap(t) args()); } \
0052 void open(device& t params()) \
0053 { this->impl(::boost::iostreams::detail::wrap(t) args()); } \
0054 void open(const ::boost::reference_wrapper<device>& ref params()) \
0055 { this->impl(ref args()); } \
0056 BOOST_PP_REPEAT_FROM_TO( \
0057 1, BOOST_PP_INC(BOOST_IOSTREAMS_MAX_FORWARDING_ARITY), \
0058 BOOST_IOSTREAMS_FORWARDING_CTOR, (class, impl, device) \
0059 ) \
0060 BOOST_PP_REPEAT_FROM_TO( \
0061 1, BOOST_PP_INC(BOOST_IOSTREAMS_MAX_FORWARDING_ARITY), \
0062 BOOST_IOSTREAMS_FORWARDING_FN, (class, impl, device) \
0063 ) \
0064
0065 #define BOOST_IOSTREAMS_FORWARDING_CTOR(z, n, tuple) \
0066 template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename U)> \
0067 BOOST_PP_TUPLE_ELEM(3, 0, tuple) \
0068 (BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, const U, &u) \
0069 BOOST_IOSTREAMS_DISABLE_IF_SAME(U0, BOOST_PP_TUPLE_ELEM(3, 2, tuple))) \
0070 { this->BOOST_PP_TUPLE_ELEM(3, 1, tuple) \
0071 ( BOOST_PP_TUPLE_ELEM(3, 2, tuple) \
0072 (BOOST_PP_ENUM_PARAMS_Z(z, n, u)) ); } \
0073 template< typename U100 BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \
0074 BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), typename U) > \
0075 BOOST_PP_TUPLE_ELEM(3, 0, tuple) \
0076 ( U100& u100 BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \
0077 BOOST_PP_ENUM_BINARY_PARAMS_Z(z, BOOST_PP_DEC(n), const U, &u) \
0078 BOOST_IOSTREAMS_DISABLE_IF_SAME(U100, BOOST_PP_TUPLE_ELEM(3, 2, tuple))) \
0079 { this->BOOST_PP_TUPLE_ELEM(3, 1, tuple) \
0080 ( BOOST_PP_TUPLE_ELEM(3, 2, tuple) \
0081 ( u100 BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \
0082 BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), u)) ); } \
0083
0084 #define BOOST_IOSTREAMS_FORWARDING_FN(z, n, tuple) \
0085 template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename U)> \
0086 void open(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, const U, &u) \
0087 BOOST_IOSTREAMS_DISABLE_IF_SAME(U0, BOOST_PP_TUPLE_ELEM(3, 2, tuple))) \
0088 { this->BOOST_PP_TUPLE_ELEM(3, 1, tuple) \
0089 ( BOOST_PP_TUPLE_ELEM(3, 2, tuple) \
0090 (BOOST_PP_ENUM_PARAMS_Z(z, n, u)) ); } \
0091 template< typename U100 BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \
0092 BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), typename U) > \
0093 void open \
0094 ( U100& u100 BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \
0095 BOOST_PP_ENUM_BINARY_PARAMS_Z(z, BOOST_PP_DEC(n), const U, &u) \
0096 BOOST_IOSTREAMS_DISABLE_IF_SAME(U100, BOOST_PP_TUPLE_ELEM(3, 2, tuple))) \
0097 { this->BOOST_PP_TUPLE_ELEM(3, 1, tuple) \
0098 ( u100 BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \
0099 BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), u) ); } \
0100
0101
0102
0103
0104 #if !defined(BOOST_NO_SFINAE) && \
0105 !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
0106 # define BOOST_IOSTREAMS_DISABLE_IF_SAME(device, param) \
0107 , typename boost::disable_if< boost::is_same<device, param> >::type* = 0 \
0108
0109 #else
0110 # define BOOST_IOSTREAMS_DISABLE_IF_SAME(device, param)
0111 #endif
0112
0113 #endif