File indexing completed on 2025-01-18 09:38:48
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED
0009 #define BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED
0010
0011 #include <boost/iostreams/detail/broken_overload_resolution/forward.hpp>
0012
0013 namespace boost { namespace iostreams {
0014
0015 template< typename Device,
0016 typename Tr =
0017 BOOST_IOSTREAMS_CHAR_TRAITS(
0018 BOOST_DEDUCED_TYPENAME char_type_of<Device>::type
0019 ),
0020 typename Alloc =
0021 std::allocator<
0022 BOOST_DEDUCED_TYPENAME char_type_of<Device>::type
0023 > >
0024 struct stream : detail::stream_base<Device, Tr, Alloc> {
0025 public:
0026 typedef typename char_type_of<Device>::type char_type;
0027 struct category
0028 : mode_of<Device>::type,
0029 closable_tag,
0030 detail::stream_traits<Device, Tr>::stream_tag
0031 { };
0032 BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr)
0033 private:
0034 typedef typename
0035 detail::stream_traits<
0036 Device, Tr
0037 >::stream_type stream_type;
0038 public:
0039 stream() { }
0040 template<typename U0>
0041 stream(const U0& u0)
0042 {
0043 open_impl(detail::forward<Device, U0>(), u0);
0044 }
0045 template<typename U0, typename U1>
0046 stream(const U0& u0, const U1& u1)
0047 {
0048 open_impl(detail::forward<Device, U0>(), u0, u1);
0049 }
0050 template<typename U0, typename U1, typename U2>
0051 stream(const U0& u0, const U1& u1, const U2& u2)
0052 {
0053 open_impl(detail::forward<Device, U0>(), u0, u1, u2);
0054 }
0055 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0056 template<typename U0>
0057 stream(U0& u0)
0058 {
0059 open_impl(detail::forward<Device, U0>(), u0);
0060 }
0061 template<typename U0, typename U1>
0062 stream(U0& u0, const U1& u1)
0063 {
0064 open_impl(detail::forward<Device, U0>(), u0, u1);
0065 }
0066 template<typename U0, typename U1, typename U2>
0067 stream(U0& u0, const U1& u1, const U2& u2)
0068 {
0069 open_impl(detail::forward<Device, U0>(), u0, u1, u2);
0070 }
0071 #endif
0072 template<typename U0>
0073 void open(const U0& u0)
0074 {
0075 open_impl(detail::forward<Device, U0>(), u0);
0076 }
0077 template<typename U0, typename U1>
0078 void open(const U0& u0, const U1& u1)
0079 {
0080 open_impl(detail::forward<Device, U0>(), u0, u1);
0081 }
0082 template<typename U0, typename U1, typename U2>
0083 void open(const U0& u0, const U1& u1, const U2& u2)
0084 {
0085 open_impl(detail::forward<Device, U0>(), u0, u1, u2);
0086 }
0087 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0088 template<typename U0>
0089 void open(U0& u0)
0090 {
0091 open_impl(detail::forward<Device, U0>(), u0);
0092 }
0093 template<typename U0, typename U1>
0094 void open(U0& u0, const U1& u1)
0095 {
0096 open_impl(detail::forward<Device, U0>(), u0, u1);
0097 }
0098 template<typename U0, typename U1, typename U2>
0099 void open(U0& u0, const U1& u1, const U2& u2)
0100 {
0101 open_impl(detail::forward<Device, U0>(), u0, u1, u2);
0102 }
0103 #endif
0104 bool is_open() const { return this->member.is_open(); }
0105 void close() { this->member.close(); }
0106 bool auto_close() const { return this->member.auto_close(); }
0107 void set_auto_close(bool close) { this->member.set_auto_close(close); }
0108 bool strict_sync() { return this->member.strict_sync(); }
0109 Device& operator*() { return *this->member; }
0110 Device* operator->() { return &*this->member; }
0111 private:
0112 template<typename U0>
0113 void open_impl(mpl::false_, const U0& u0)
0114 {
0115 this->clear();
0116 this->member.open(u0);
0117 }
0118 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0119 template<typename U0>
0120 void open_impl(mpl::false_, U0& u0)
0121 {
0122 this->clear();
0123 this->member.open(detail::wrap(u0));
0124 }
0125 #endif
0126 template<typename U0>
0127 void open_impl(mpl::true_, const U0& u0)
0128 {
0129 this->clear();
0130 this->member.open(Device(const_cast<U0&>(u0)));
0131 }
0132 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0133 template<typename U0>
0134 void open_impl(mpl::true_, U0& u0)
0135 {
0136 this->clear();
0137 this->member.open(Device(u0));
0138 }
0139 #endif
0140 template<typename U0, typename U1>
0141 void open_impl(mpl::false_, const U0& u0, const U1& u1)
0142 {
0143 this->clear();
0144 this->member.open(u0, u1);
0145 }
0146 template<typename U0, typename U1>
0147 void open_impl(mpl::true_, const U0& u0, const U1& u1)
0148 {
0149 this->clear();
0150 this->member.open(Device(const_cast<U0&>(u0), u1));
0151 }
0152 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0153 template<typename U0, typename U1>
0154 void open_impl(mpl::true_, U0& u0, const U1& u1)
0155 {
0156 this->clear();
0157 this->member.open(Device(u0, u1));
0158 }
0159 #endif
0160 template<typename U0, typename U1, typename U2>
0161 void open_impl(mpl::false_, const U0& u0, const U1& u1, const U2& u2)
0162 {
0163 this->clear();
0164 this->member.open(u0, u1, u2);
0165 }
0166 template<typename U0, typename U1, typename U2>
0167 void open_impl(mpl::true_, const U0& u0, const U1& u1, const U2& u2)
0168 {
0169 this->clear();
0170 this->member.open(Device(const_cast<U0&>(u0), u1, u2));
0171 }
0172 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0173 template<typename U0, typename U1, typename U2>
0174 void open_impl(mpl::true_, U0& u0, const U1& u1, const U2& u2)
0175 {
0176 this->clear();
0177 this->member.open(Device(u0, u1, u2));
0178 }
0179 #endif
0180 };
0181
0182 } }
0183
0184 #endif BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED