diff --git a/include/boost/iostreams/detail/broken_overload_resolution/stream_facade.hpp b/include/boost/iostreams/detail/broken_overload_resolution/stream_facade.hpp new file mode 100755 index 0000000..97053fe --- /dev/null +++ b/include/boost/iostreams/detail/broken_overload_resolution/stream_facade.hpp @@ -0,0 +1,177 @@ +// (C) Copyright Jonathan Turkanis 2003. +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) + +// See http://www.boost.org/libs/iostreams for documentation. + +// No include guards -- file included by boost/iostreams/stream_facade.hpp +// within include guards. + +#include // BOOST_STATIC_CONSANT. +#include +#include +#include +#include + +namespace boost { namespace iostreams { + +template< typename Device, + typename Tr = + std::char_traits< + BOOST_DEDUCED_TYPENAME io_char::type + >, + typename Alloc = + std::allocator< + BOOST_DEDUCED_TYPENAME io_char::type + > > +struct stream_facade : detail::stream_facade_base { +public: + typedef BOOST_IOSTREAMS_CHAR_TYPE(Device) char_type; + BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) +private: + typedef typename + detail::stream_facade_traits< + Device, Tr + >::stream_type stream_type; + typedef Device policy_type; + template + struct forward_impl { + BOOST_STATIC_CONSTANT(bool, value = + ( !is_same< + const U&, + typename detail::param_type::type + >::value && + !is_same< + const U&, + const reference_wrapper + >::value )); + }; + template + struct forward : mpl::bool_::value> { }; +public: + stream_facade() { } + + template + stream_facade(const U0& u0) + { + open_impl(forward(), u0); + } + template + stream_facade(const U0& u0, const U1& u1) + { + open_impl(forward(), u0, u1); + } + template + stream_facade(const U0& u0, const U1& u1, const U2& u2) + { + open_impl(forward(), u0, u1, u2); + } + template + stream_facade(U0& u0) + { + open_impl(forward(), u0); + } + template + stream_facade(U0& u0, const U1& u1) + { + open_impl(forward(), u0, u1); + } + template + stream_facade(U0& u0, const U1& u1, const U2& u2) + { + open_impl(forward(), u0, u1, u2); + } + template + void open(const U0& u0) + { + open_impl(forward(), u0); + } + template + void open(const U0& u0, const U1& u1) + { + open_impl(forward(), u0, u1); + } + template + void open(const U0& u0, const U1& u1, const U2& u2) + { + open_impl(forward(), u0, u1, u2); + } + template + void open(U0& u0) + { + open_impl(forward(), u0); + } + template + void open(U0& u0, const U1& u1) + { + open_impl(forward(), u0, u1); + } + template + void open(U0& u0, const U1& u1, const U2& u2) + { + open_impl(forward(), u0, u1, u2); + } + bool is_open() const { return this->member.is_open(); } + void close() { this->member.close(); } + void set_buffer_size(std::streamsize size) + { this->member.set_buffer_size(size); } + Device& operator*() { return *this->member; } + Device* operator->() { return &*this->member; } +private: + template + void open_impl(mpl::false_, const U0& u0) + { + this->clear(); + this->member.open(u0); + } + template + void open_impl(mpl::false_, U0& u0) + { + this->clear(); + this->member.open(detail::wrap(u0)); + } + template + void open_impl(mpl::true_, const U0& u0) + { + this->clear(); + this->member.open(Device(u0)); + } + template + void open_impl(mpl::false_, const U0& u0, const U1& u1) + { + this->clear(); + this->member.open(u0, u1); + } + template + void open_impl(mpl::false_, U0& u0, const U1& u1) + { + this->clear(); + this->member.open(detail::wrap(u0), u1); + } + template + void open_impl(mpl::true_, const U0& u0, const U1& u1) + { + this->clear(); + this->member.open(Device(u0, u1)); + } + template + void open_impl(mpl::false_, const U0& u0, const U1& u1, const U2& u2) + { + this->clear(); + this->member.open(u0, u1, u2); + } + template + void open_impl(mpl::false_, U0& u0, const U1& u1, const U2& u2) + { + this->clear(); + this->member.open(detail::wrap(u0), u1, u2); + } + template + void open_impl(mpl::true_, const U0& u0, const U1& u1, const U2& u2) + { + this->clear(); + this->member.open(Device(u0, u1, u2)); + } +}; + +} } // End namespaces iostreams, boost. diff --git a/include/boost/iostreams/detail/broken_overload_resolution/streambuf_facade.hpp b/include/boost/iostreams/detail/broken_overload_resolution/streambuf_facade.hpp new file mode 100755 index 0000000..e3bc35f --- /dev/null +++ b/include/boost/iostreams/detail/broken_overload_resolution/streambuf_facade.hpp @@ -0,0 +1,167 @@ +// (C) Copyright Jonathan Turkanis 2003. +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) + +// See http://www.boost.org/libs/iostreams for documentation. + +// No include guards -- file included by boost/iostreams/streambuf_facade.hpp +// within include guards. + +#include // MSVC. + +#include // allocator. +#include +#include +#include + +namespace boost { namespace iostreams { + +template< typename T, + typename Tr = + std::char_traits< + BOOST_DEDUCED_TYPENAME io_char::type + >, + typename Alloc = std::allocator, + typename Mode = BOOST_DEDUCED_TYPENAME io_mode::type > +class streambuf_facade + : public detail::streambuf_facade_traits::type +{ +private: + BOOST_STATIC_ASSERT((is_convertible::value)); + typedef typename + detail::streambuf_facade_traits< + T, Tr, Alloc, Mode + >::type base_type; + typedef T policy_type; + template + struct forward_impl { + BOOST_STATIC_CONSTANT(bool, value = + ( !is_same< + const U&, + typename detail::param_type::type + >::value && + !is_same< + const U&, + const reference_wrapper + >::value )); + }; + template + struct forward : mpl::bool_::value> { }; +public: + typedef BOOST_IOSTREAMS_CHAR_TYPE(T) char_type; + BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) + streambuf_facade() { } + template + streambuf_facade(const U0& u0) + { + open_impl(forward(), u0); + } + template + streambuf_facade(const U0& u0, const U1& u1) + { + open_impl(forward(), u0, u1); + } + template + streambuf_facade(const U0& u0, const U1& u1, const U2& u2) + { + open_impl(forward(), u0, u1, u2); + } + template + streambuf_facade(U0& u0) + { + open_impl(forward(), u0); + } + template + streambuf_facade(U0& u0, const U1& u1) + { + open_impl(forward(), u0, u1); + } + template + streambuf_facade(U0& u0, const U1& u1, const U2& u2) + { + open_impl(forward(), u0, u1, u2); + } + template + void open(const U0& u0) + { + open_impl(forward(), u0); + } + template + void open(const U0& u0, const U1& u1) + { + open_impl(forward(), u0, u1); + } + template + void open(const U0& u0, const U1& u1, const U2& u2) + { + open_impl(forward(), u0, u1, u2); + } + template + void open(U0& u0) + { + open_impl(forward(), u0); + } + template + void open(U0& u0, const U1& u1) + { + open_impl(forward(), u0, u1); + } + template + void open(U0& u0, const U1& u1, const U2& u2) + { + open_impl(forward(), u0, u1, u2); + } +private: + template + void open_impl(mpl::false_, const U0& u0) + { + base_type::open(u0, -1, -1); + } + template + void open_impl(mpl::false_, U0& u0) + { + base_type::open(detail::wrap(u0), -1, -1); + } + template + void open_impl(mpl::true_, const U0& u0) + { + base_type::open(Device(u0), -1, -1); + } + template + void open_impl(mpl::false_, const U0& u0, const U1& u1) + { + base_type::open(u0, u1, -1); + } + template + void open_impl(mpl::false_, U0& u0, const U1& u1) + { + base_type::open(detail::wrap(u0), u1, -1); + } + template + void open_impl(mpl::true_, const U0& u0, const U1& u1) + { + base_type::open(Device(u0, u1), -1, -1); + } + template + void open_impl(mpl::false_, const U0& u0, const U1& u1, const U2& u2) + { + base_type::open(u0, u1, u2); + } + template + void open_impl(mpl::false_, U0& u0, const U1& u1, const U2& u2) + { + base_type::open(detail::wrap(u0), u1, u2); + } + template + void open_impl(mpl::true_, const U0& u0, const U1& u1, const U2& u2) + { + base_type::open(Device(u0, u1, u2), -1, -1); + } + void check_open() + { + if (this->is_open()) + throw std::ios_base::failure("already open"); + } +}; + +} } // End namespaces iostreams, boost. diff --git a/include/boost/iostreams/detail/config/overload_resolution.hpp b/include/boost/iostreams/detail/config/overload_resolution.hpp new file mode 100755 index 0000000..4211569 --- /dev/null +++ b/include/boost/iostreams/detail/config/overload_resolution.hpp @@ -0,0 +1,25 @@ +// (C) Copyright Jonathan Turkanis 2003. +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) + +// See http://www.boost.org/libs/iostreams for documentation. + +// Adapted from and from +// http://www.boost.org/more/separate_compilation.html, by John Maddock. + +#ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_BROKEN_OVERLOAD_RESOLUTION_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONFIG_BROKEN_OVERLOAD_RESOLUTION_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include + +#if !defined(BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION) +# if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) +# define BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION +# endif +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_BROKEN_OVERLOAD_RESOLUTION_HPP_INCLUDED