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