1 // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
2 // (C) Copyright 2003-2007 Jonathan Turkanis
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
6 // See http://www.boost.org/libs/iostreams for documentation.
8 #ifndef BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED
9 #define BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED
11 #include <boost/iostreams/detail/broken_overload_resolution/forward.hpp>
13 namespace boost { namespace iostreams {
15 template< typename Device,
17 BOOST_IOSTREAMS_CHAR_TRAITS(
18 BOOST_DEDUCED_TYPENAME char_type_of<Device>::type
22 BOOST_DEDUCED_TYPENAME char_type_of<Device>::type
24 struct stream : detail::stream_base<Device, Tr, Alloc> {
26 typedef typename char_type_of<Device>::type char_type;
28 : mode_of<Device>::type,
30 detail::stream_traits<Device, Tr>::stream_tag
32 BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr)
35 detail::stream_traits<
37 >::stream_type stream_type;
43 open_impl(detail::forward<Device, U0>(), u0);
45 template<typename U0, typename U1>
46 stream(const U0& u0, const U1& u1)
48 open_impl(detail::forward<Device, U0>(), u0, u1);
50 template<typename U0, typename U1, typename U2>
51 stream(const U0& u0, const U1& u1, const U2& u2)
53 open_impl(detail::forward<Device, U0>(), u0, u1, u2);
55 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
59 open_impl(detail::forward<Device, U0>(), u0);
61 template<typename U0, typename U1>
62 stream(U0& u0, const U1& u1)
64 open_impl(detail::forward<Device, U0>(), u0, u1);
66 template<typename U0, typename U1, typename U2>
67 stream(U0& u0, const U1& u1, const U2& u2)
69 open_impl(detail::forward<Device, U0>(), u0, u1, u2);
71 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
73 void open(const U0& u0)
75 open_impl(detail::forward<Device, U0>(), u0);
77 template<typename U0, typename U1>
78 void open(const U0& u0, const U1& u1)
80 open_impl(detail::forward<Device, U0>(), u0, u1);
82 template<typename U0, typename U1, typename U2>
83 void open(const U0& u0, const U1& u1, const U2& u2)
85 open_impl(detail::forward<Device, U0>(), u0, u1, u2);
87 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
91 open_impl(detail::forward<Device, U0>(), u0);
93 template<typename U0, typename U1>
94 void open(U0& u0, const U1& u1)
96 open_impl(detail::forward<Device, U0>(), u0, u1);
98 template<typename U0, typename U1, typename U2>
99 void open(U0& u0, const U1& u1, const U2& u2)
101 open_impl(detail::forward<Device, U0>(), u0, u1, u2);
103 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
104 bool is_open() const { return this->member.is_open(); }
105 void close() { this->member.close(); }
106 bool auto_close() const { return this->member.auto_close(); }
107 void set_auto_close(bool close) { this->member.set_auto_close(close); }
108 bool strict_sync() { return this->member.strict_sync(); }
109 Device& operator*() { return *this->member; }
110 Device* operator->() { return &*this->member; }
112 template<typename U0>
113 void open_impl(mpl::false_, const U0& u0)
116 this->member.open(u0);
118 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
119 template<typename U0>
120 void open_impl(mpl::false_, U0& u0)
123 this->member.open(detail::wrap(u0));
125 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
126 template<typename U0>
127 void open_impl(mpl::true_, const U0& u0)
130 this->member.open(Device(const_cast<U0&>(u0)));
132 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
133 template<typename U0>
134 void open_impl(mpl::true_, U0& u0)
137 this->member.open(Device(u0));
139 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
140 template<typename U0, typename U1>
141 void open_impl(mpl::false_, const U0& u0, const U1& u1)
144 this->member.open(u0, u1);
146 template<typename U0, typename U1>
147 void open_impl(mpl::true_, const U0& u0, const U1& u1)
150 this->member.open(Device(const_cast<U0&>(u0), u1));
152 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
153 template<typename U0, typename U1>
154 void open_impl(mpl::true_, U0& u0, const U1& u1)
157 this->member.open(Device(u0, u1));
159 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
160 template<typename U0, typename U1, typename U2>
161 void open_impl(mpl::false_, const U0& u0, const U1& u1, const U2& u2)
164 this->member.open(u0, u1, u2);
166 template<typename U0, typename U1, typename U2>
167 void open_impl(mpl::true_, const U0& u0, const U1& u1, const U2& u2)
170 this->member.open(Device(const_cast<U0&>(u0), u1, u2));
172 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
173 template<typename U0, typename U1, typename U2>
174 void open_impl(mpl::true_, U0& u0, const U1& u1, const U2& u2)
177 this->member.open(Device(u0, u1, u2));
182 } } // End namespaces iostreams, boost.
184 #endif BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED