// (C) Copyright Jonathan Turkanis 2005. // 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. #ifndef BOOST_IOSTREAMS_DETAIL_BASIC_ADAPTER_HPP_INCLUDED #define BOOST_IOSTREAMS_DETAIL_BASIC_ADAPTER_HPP_INCLUDED #include #include #include #include #include #include namespace boost { namespace iostreams { namespace detail { template class basic_adapter { private: typedef typename detail::value_type::type value_type; typedef typename detail::param_type::type param_type; public: explicit basic_adapter(param_type t) : t_(t) { } T& component() { return t_; } void close(BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out) { BOOST_STATIC_ASSERT(is_device::value); iostreams::close(t_, which); } template void close( Device& dev, BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out ) { BOOST_STATIC_ASSERT(is_filter::value); iostreams::close(t_, dev, which); } bool flush() { BOOST_STATIC_ASSERT(is_device::value); return iostreams::flush(t_); } template void flush(Device& dev) { BOOST_STATIC_ASSERT(is_filter::value); return iostreams::flush(t_, dev); } template // Avoid dependency on void imbue(const Locale& loc) { iostreams::imbue(t_, loc); } std::streamsize optimal_buffer_size() const { return iostreams::optimal_buffer_size(t_); } public: value_type t_; }; //----------------------------------------------------------------------------// } } } // End namespaces detail, iostreams, boost. #endif // #ifndef BOOST_IOSTREAMS_DETAIL_BASIC_ADAPTER_HPP_INCLUDED