2 * Defines the class template boost::iostreams::detail::device_adapter,
3 * a convenience base class for device adapters.
5 * File: boost/iostreams/detail/adapter/filter_adapter.hpp
6 * Date: Mon Nov 26 14:35:48 MST 2007
8 * Copyright: 2007-2008 CodeRage, LLC
9 * Author: Jonathan Turkanis
10 * Contact: turkanis at coderage dot com
12 * Distributed under the Boost Software License, Version 1.0.(See accompanying
13 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
15 * See http://www.boost.org/libs/iostreams for documentation.
18 #ifndef BOOST_IOSTREAMS_DETAIL_DEVICE_ADAPTER_HPP_INCLUDED
19 #define BOOST_IOSTREAMS_DETAIL_DEVICE_ADAPTER_HPP_INCLUDED
21 #include <boost/iostreams/categories.hpp>
22 #include <boost/iostreams/detail/call_traits.hpp>
23 #include <boost/iostreams/detail/ios.hpp>
24 #include <boost/iostreams/operations.hpp>
25 #include <boost/iostreams/traits.hpp>
26 #include <boost/static_assert.hpp>
28 namespace boost { namespace iostreams { namespace detail {
31 class device_adapter {
33 typedef typename detail::value_type<T>::type value_type;
34 typedef typename detail::param_type<T>::type param_type;
36 explicit device_adapter(param_type t) : t_(t) { }
37 T& component() { return t_; }
41 detail::close_all(t_);
44 void close(BOOST_IOS::openmode which)
46 iostreams::close(t_, which);
51 return iostreams::flush(t_);
54 template<typename Locale> // Avoid dependency on <locale>
55 void imbue(const Locale& loc) { iostreams::imbue(t_, loc); }
57 std::streamsize optimal_buffer_size() const
58 { return iostreams::optimal_buffer_size(t_); }
63 //----------------------------------------------------------------------------//
65 } } } // End namespaces detail, iostreams, boost.
67 #endif // #ifndef BOOST_IOSTREAMS_DETAIL_DEVICE_ADAPTER_HPP_INCLUDED