2 * Defines the class template boost::iostreams::detail::filter_adapter,
3 * a convenience base class for filter adapters.
5 * File: boost/iostreams/detail/adapter/filter_adapter.hpp
6 * Date: Mon Nov 26 14:35:48 MST 2007
7 * Copyright: 2007-2008 CodeRage, LLC
8 * Author: Jonathan Turkanis
9 * Contact: turkanis at coderage dot com
11 * Distributed under the Boost Software License, Version 1.0.(See accompanying
12 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
14 * See http://www.boost.org/libs/iostreams for documentation.
17 #ifndef BOOST_IOSTREAMS_DETAIL_FILTER_ADAPTER_HPP_INCLUDED
18 #define BOOST_IOSTREAMS_DETAIL_FILTER_ADAPTER_HPP_INCLUDED
20 #include <boost/iostreams/categories.hpp>
21 #include <boost/iostreams/detail/call_traits.hpp>
22 #include <boost/iostreams/detail/ios.hpp>
23 #include <boost/iostreams/operations.hpp>
24 #include <boost/iostreams/traits.hpp>
25 #include <boost/static_assert.hpp>
27 namespace boost { namespace iostreams { namespace detail {
30 class filter_adapter {
32 typedef typename detail::value_type<T>::type value_type;
33 typedef typename detail::param_type<T>::type param_type;
35 explicit filter_adapter(param_type t) : t_(t) { }
36 T& component() { return t_; }
38 template<typename Device>
39 void close(Device& dev)
41 detail::close_all(t_, dev);
44 template<typename Device>
45 void close(Device& dev, BOOST_IOS::openmode which)
47 iostreams::close(t_, dev, which);
50 template<typename Device>
51 void flush(Device& dev)
53 return iostreams::flush(t_, dev);
56 template<typename Locale> // Avoid dependency on <locale>
57 void imbue(const Locale& loc) { iostreams::imbue(t_, loc); }
59 std::streamsize optimal_buffer_size() const
60 { return iostreams::optimal_buffer_size(t_); }
65 //----------------------------------------------------------------------------//
67 } } } // End namespaces detail, iostreams, boost.
69 #endif // #ifndef BOOST_IOSTREAMS_DETAIL_FILTER_ADAPTER_HPP_INCLUDED