Chris@16
|
1 // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
|
Chris@16
|
2 // (C) Copyright 2003-2007 Jonathan Turkanis
|
Chris@16
|
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
|
Chris@16
|
5
|
Chris@16
|
6 // See http://www.boost.org/libs/iostreams for documentation.
|
Chris@16
|
7
|
Chris@16
|
8 #ifndef BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED
|
Chris@16
|
9 #define BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED
|
Chris@16
|
10
|
Chris@16
|
11 #include <boost/iostreams/detail/broken_overload_resolution/forward.hpp>
|
Chris@16
|
12
|
Chris@16
|
13 namespace boost { namespace iostreams {
|
Chris@16
|
14
|
Chris@16
|
15 template< typename Device,
|
Chris@16
|
16 typename Tr =
|
Chris@16
|
17 BOOST_IOSTREAMS_CHAR_TRAITS(
|
Chris@16
|
18 BOOST_DEDUCED_TYPENAME char_type_of<Device>::type
|
Chris@16
|
19 ),
|
Chris@16
|
20 typename Alloc =
|
Chris@16
|
21 std::allocator<
|
Chris@16
|
22 BOOST_DEDUCED_TYPENAME char_type_of<Device>::type
|
Chris@16
|
23 > >
|
Chris@16
|
24 struct stream : detail::stream_base<Device, Tr, Alloc> {
|
Chris@16
|
25 public:
|
Chris@16
|
26 typedef typename char_type_of<Device>::type char_type;
|
Chris@16
|
27 struct category
|
Chris@16
|
28 : mode_of<Device>::type,
|
Chris@16
|
29 closable_tag,
|
Chris@16
|
30 detail::stream_traits<Device, Tr>::stream_tag
|
Chris@16
|
31 { };
|
Chris@16
|
32 BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr)
|
Chris@16
|
33 private:
|
Chris@16
|
34 typedef typename
|
Chris@16
|
35 detail::stream_traits<
|
Chris@16
|
36 Device, Tr
|
Chris@16
|
37 >::stream_type stream_type;
|
Chris@16
|
38 public:
|
Chris@16
|
39 stream() { }
|
Chris@16
|
40 template<typename U0>
|
Chris@16
|
41 stream(const U0& u0)
|
Chris@16
|
42 {
|
Chris@16
|
43 open_impl(detail::forward<Device, U0>(), u0);
|
Chris@16
|
44 }
|
Chris@16
|
45 template<typename U0, typename U1>
|
Chris@16
|
46 stream(const U0& u0, const U1& u1)
|
Chris@16
|
47 {
|
Chris@16
|
48 open_impl(detail::forward<Device, U0>(), u0, u1);
|
Chris@16
|
49 }
|
Chris@16
|
50 template<typename U0, typename U1, typename U2>
|
Chris@16
|
51 stream(const U0& u0, const U1& u1, const U2& u2)
|
Chris@16
|
52 {
|
Chris@16
|
53 open_impl(detail::forward<Device, U0>(), u0, u1, u2);
|
Chris@16
|
54 }
|
Chris@16
|
55 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
|
Chris@16
|
56 template<typename U0>
|
Chris@16
|
57 stream(U0& u0)
|
Chris@16
|
58 {
|
Chris@16
|
59 open_impl(detail::forward<Device, U0>(), u0);
|
Chris@16
|
60 }
|
Chris@16
|
61 template<typename U0, typename U1>
|
Chris@16
|
62 stream(U0& u0, const U1& u1)
|
Chris@16
|
63 {
|
Chris@16
|
64 open_impl(detail::forward<Device, U0>(), u0, u1);
|
Chris@16
|
65 }
|
Chris@16
|
66 template<typename U0, typename U1, typename U2>
|
Chris@16
|
67 stream(U0& u0, const U1& u1, const U2& u2)
|
Chris@16
|
68 {
|
Chris@16
|
69 open_impl(detail::forward<Device, U0>(), u0, u1, u2);
|
Chris@16
|
70 }
|
Chris@16
|
71 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
|
Chris@16
|
72 template<typename U0>
|
Chris@16
|
73 void open(const U0& u0)
|
Chris@16
|
74 {
|
Chris@16
|
75 open_impl(detail::forward<Device, U0>(), u0);
|
Chris@16
|
76 }
|
Chris@16
|
77 template<typename U0, typename U1>
|
Chris@16
|
78 void open(const U0& u0, const U1& u1)
|
Chris@16
|
79 {
|
Chris@16
|
80 open_impl(detail::forward<Device, U0>(), u0, u1);
|
Chris@16
|
81 }
|
Chris@16
|
82 template<typename U0, typename U1, typename U2>
|
Chris@16
|
83 void open(const U0& u0, const U1& u1, const U2& u2)
|
Chris@16
|
84 {
|
Chris@16
|
85 open_impl(detail::forward<Device, U0>(), u0, u1, u2);
|
Chris@16
|
86 }
|
Chris@16
|
87 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
|
Chris@16
|
88 template<typename U0>
|
Chris@16
|
89 void open(U0& u0)
|
Chris@16
|
90 {
|
Chris@16
|
91 open_impl(detail::forward<Device, U0>(), u0);
|
Chris@16
|
92 }
|
Chris@16
|
93 template<typename U0, typename U1>
|
Chris@16
|
94 void open(U0& u0, const U1& u1)
|
Chris@16
|
95 {
|
Chris@16
|
96 open_impl(detail::forward<Device, U0>(), u0, u1);
|
Chris@16
|
97 }
|
Chris@16
|
98 template<typename U0, typename U1, typename U2>
|
Chris@16
|
99 void open(U0& u0, const U1& u1, const U2& u2)
|
Chris@16
|
100 {
|
Chris@16
|
101 open_impl(detail::forward<Device, U0>(), u0, u1, u2);
|
Chris@16
|
102 }
|
Chris@16
|
103 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
|
Chris@16
|
104 bool is_open() const { return this->member.is_open(); }
|
Chris@16
|
105 void close() { this->member.close(); }
|
Chris@16
|
106 bool auto_close() const { return this->member.auto_close(); }
|
Chris@16
|
107 void set_auto_close(bool close) { this->member.set_auto_close(close); }
|
Chris@16
|
108 bool strict_sync() { return this->member.strict_sync(); }
|
Chris@16
|
109 Device& operator*() { return *this->member; }
|
Chris@16
|
110 Device* operator->() { return &*this->member; }
|
Chris@16
|
111 private:
|
Chris@16
|
112 template<typename U0>
|
Chris@16
|
113 void open_impl(mpl::false_, const U0& u0)
|
Chris@16
|
114 {
|
Chris@16
|
115 this->clear();
|
Chris@16
|
116 this->member.open(u0);
|
Chris@16
|
117 }
|
Chris@16
|
118 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
|
Chris@16
|
119 template<typename U0>
|
Chris@16
|
120 void open_impl(mpl::false_, U0& u0)
|
Chris@16
|
121 {
|
Chris@16
|
122 this->clear();
|
Chris@16
|
123 this->member.open(detail::wrap(u0));
|
Chris@16
|
124 }
|
Chris@16
|
125 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
|
Chris@16
|
126 template<typename U0>
|
Chris@16
|
127 void open_impl(mpl::true_, const U0& u0)
|
Chris@16
|
128 {
|
Chris@16
|
129 this->clear();
|
Chris@16
|
130 this->member.open(Device(const_cast<U0&>(u0)));
|
Chris@16
|
131 }
|
Chris@16
|
132 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
|
Chris@16
|
133 template<typename U0>
|
Chris@16
|
134 void open_impl(mpl::true_, U0& u0)
|
Chris@16
|
135 {
|
Chris@16
|
136 this->clear();
|
Chris@16
|
137 this->member.open(Device(u0));
|
Chris@16
|
138 }
|
Chris@16
|
139 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
|
Chris@16
|
140 template<typename U0, typename U1>
|
Chris@16
|
141 void open_impl(mpl::false_, const U0& u0, const U1& u1)
|
Chris@16
|
142 {
|
Chris@16
|
143 this->clear();
|
Chris@16
|
144 this->member.open(u0, u1);
|
Chris@16
|
145 }
|
Chris@16
|
146 template<typename U0, typename U1>
|
Chris@16
|
147 void open_impl(mpl::true_, const U0& u0, const U1& u1)
|
Chris@16
|
148 {
|
Chris@16
|
149 this->clear();
|
Chris@16
|
150 this->member.open(Device(const_cast<U0&>(u0), u1));
|
Chris@16
|
151 }
|
Chris@16
|
152 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
|
Chris@16
|
153 template<typename U0, typename U1>
|
Chris@16
|
154 void open_impl(mpl::true_, U0& u0, const U1& u1)
|
Chris@16
|
155 {
|
Chris@16
|
156 this->clear();
|
Chris@16
|
157 this->member.open(Device(u0, u1));
|
Chris@16
|
158 }
|
Chris@16
|
159 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
|
Chris@16
|
160 template<typename U0, typename U1, typename U2>
|
Chris@16
|
161 void open_impl(mpl::false_, const U0& u0, const U1& u1, const U2& u2)
|
Chris@16
|
162 {
|
Chris@16
|
163 this->clear();
|
Chris@16
|
164 this->member.open(u0, u1, u2);
|
Chris@16
|
165 }
|
Chris@16
|
166 template<typename U0, typename U1, typename U2>
|
Chris@16
|
167 void open_impl(mpl::true_, const U0& u0, const U1& u1, const U2& u2)
|
Chris@16
|
168 {
|
Chris@16
|
169 this->clear();
|
Chris@16
|
170 this->member.open(Device(const_cast<U0&>(u0), u1, u2));
|
Chris@16
|
171 }
|
Chris@16
|
172 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
|
Chris@16
|
173 template<typename U0, typename U1, typename U2>
|
Chris@16
|
174 void open_impl(mpl::true_, U0& u0, const U1& u1, const U2& u2)
|
Chris@16
|
175 {
|
Chris@16
|
176 this->clear();
|
Chris@16
|
177 this->member.open(Device(u0, u1, u2));
|
Chris@16
|
178 }
|
Chris@16
|
179 #endif
|
Chris@16
|
180 };
|
Chris@16
|
181
|
Chris@16
|
182 } } // End namespaces iostreams, boost.
|
Chris@16
|
183
|
Chris@16
|
184 #endif BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED
|