Chris@16: // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) Chris@16: // (C) Copyright 2003-2007 Jonathan Turkanis Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) Chris@16: Chris@16: // See http://www.boost.org/libs/iostreams for documentation. Chris@16: Chris@16: #ifndef BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED Chris@16: #define BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { namespace iostreams { Chris@16: Chris@16: template< typename Device, Chris@16: typename Tr = Chris@16: BOOST_IOSTREAMS_CHAR_TRAITS( Chris@16: BOOST_DEDUCED_TYPENAME char_type_of::type Chris@16: ), Chris@16: typename Alloc = Chris@16: std::allocator< Chris@16: BOOST_DEDUCED_TYPENAME char_type_of::type Chris@16: > > Chris@16: struct stream : detail::stream_base { Chris@16: public: Chris@16: typedef typename char_type_of::type char_type; Chris@16: struct category Chris@16: : mode_of::type, Chris@16: closable_tag, Chris@16: detail::stream_traits::stream_tag Chris@16: { }; Chris@16: BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) Chris@16: private: Chris@16: typedef typename Chris@16: detail::stream_traits< Chris@16: Device, Tr Chris@16: >::stream_type stream_type; Chris@16: public: Chris@16: stream() { } Chris@16: template Chris@16: stream(const U0& u0) Chris@16: { Chris@16: open_impl(detail::forward(), u0); Chris@16: } Chris@16: template Chris@16: stream(const U0& u0, const U1& u1) Chris@16: { Chris@16: open_impl(detail::forward(), u0, u1); Chris@16: } Chris@16: template Chris@16: stream(const U0& u0, const U1& u1, const U2& u2) Chris@16: { Chris@16: open_impl(detail::forward(), u0, u1, u2); Chris@16: } Chris@16: #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// Chris@16: template Chris@16: stream(U0& u0) Chris@16: { Chris@16: open_impl(detail::forward(), u0); Chris@16: } Chris@16: template Chris@16: stream(U0& u0, const U1& u1) Chris@16: { Chris@16: open_impl(detail::forward(), u0, u1); Chris@16: } Chris@16: template Chris@16: stream(U0& u0, const U1& u1, const U2& u2) Chris@16: { Chris@16: open_impl(detail::forward(), u0, u1, u2); Chris@16: } Chris@16: #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// Chris@16: template Chris@16: void open(const U0& u0) Chris@16: { Chris@16: open_impl(detail::forward(), u0); Chris@16: } Chris@16: template Chris@16: void open(const U0& u0, const U1& u1) Chris@16: { Chris@16: open_impl(detail::forward(), u0, u1); Chris@16: } Chris@16: template Chris@16: void open(const U0& u0, const U1& u1, const U2& u2) Chris@16: { Chris@16: open_impl(detail::forward(), u0, u1, u2); Chris@16: } Chris@16: #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// Chris@16: template Chris@16: void open(U0& u0) Chris@16: { Chris@16: open_impl(detail::forward(), u0); Chris@16: } Chris@16: template Chris@16: void open(U0& u0, const U1& u1) Chris@16: { Chris@16: open_impl(detail::forward(), u0, u1); Chris@16: } Chris@16: template Chris@16: void open(U0& u0, const U1& u1, const U2& u2) Chris@16: { Chris@16: open_impl(detail::forward(), u0, u1, u2); Chris@16: } Chris@16: #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// Chris@16: bool is_open() const { return this->member.is_open(); } Chris@16: void close() { this->member.close(); } Chris@16: bool auto_close() const { return this->member.auto_close(); } Chris@16: void set_auto_close(bool close) { this->member.set_auto_close(close); } Chris@16: bool strict_sync() { return this->member.strict_sync(); } Chris@16: Device& operator*() { return *this->member; } Chris@16: Device* operator->() { return &*this->member; } Chris@16: private: Chris@16: template Chris@16: void open_impl(mpl::false_, const U0& u0) Chris@16: { Chris@16: this->clear(); Chris@16: this->member.open(u0); Chris@16: } Chris@16: #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// Chris@16: template Chris@16: void open_impl(mpl::false_, U0& u0) Chris@16: { Chris@16: this->clear(); Chris@16: this->member.open(detail::wrap(u0)); Chris@16: } Chris@16: #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// Chris@16: template Chris@16: void open_impl(mpl::true_, const U0& u0) Chris@16: { Chris@16: this->clear(); Chris@16: this->member.open(Device(const_cast(u0))); Chris@16: } Chris@16: #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// Chris@16: template Chris@16: void open_impl(mpl::true_, U0& u0) Chris@16: { Chris@16: this->clear(); Chris@16: this->member.open(Device(u0)); Chris@16: } Chris@16: #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// Chris@16: template Chris@16: void open_impl(mpl::false_, const U0& u0, const U1& u1) Chris@16: { Chris@16: this->clear(); Chris@16: this->member.open(u0, u1); Chris@16: } Chris@16: template Chris@16: void open_impl(mpl::true_, const U0& u0, const U1& u1) Chris@16: { Chris@16: this->clear(); Chris@16: this->member.open(Device(const_cast(u0), u1)); Chris@16: } Chris@16: #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// Chris@16: template Chris@16: void open_impl(mpl::true_, U0& u0, const U1& u1) Chris@16: { Chris@16: this->clear(); Chris@16: this->member.open(Device(u0, u1)); Chris@16: } Chris@16: #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// Chris@16: template Chris@16: void open_impl(mpl::false_, const U0& u0, const U1& u1, const U2& u2) Chris@16: { Chris@16: this->clear(); Chris@16: this->member.open(u0, u1, u2); Chris@16: } Chris@16: template Chris@16: void open_impl(mpl::true_, const U0& u0, const U1& u1, const U2& u2) Chris@16: { Chris@16: this->clear(); Chris@16: this->member.open(Device(const_cast(u0), u1, u2)); Chris@16: } Chris@16: #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// Chris@16: template Chris@16: void open_impl(mpl::true_, U0& u0, const U1& u1, const U2& u2) Chris@16: { Chris@16: this->clear(); Chris@16: this->member.open(Device(u0, u1, u2)); Chris@16: } Chris@16: #endif Chris@16: }; Chris@16: Chris@16: } } // End namespaces iostreams, boost. Chris@16: Chris@16: #endif BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED