annotate DEPENDENCIES/generic/include/boost/iostreams/detail/adapter/filter_adapter.hpp @ 60:01e6213c3f91

Merge
author Chris Cannam
date Fri, 12 Sep 2014 08:17:00 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /*
Chris@16 2 * Defines the class template boost::iostreams::detail::filter_adapter,
Chris@16 3 * a convenience base class for filter adapters.
Chris@16 4 *
Chris@16 5 * File: boost/iostreams/detail/adapter/filter_adapter.hpp
Chris@16 6 * Date: Mon Nov 26 14:35:48 MST 2007
Chris@16 7 * Copyright: 2007-2008 CodeRage, LLC
Chris@16 8 * Author: Jonathan Turkanis
Chris@16 9 * Contact: turkanis at coderage dot com
Chris@16 10 *
Chris@16 11 * Distributed under the Boost Software License, Version 1.0.(See accompanying
Chris@16 12 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
Chris@16 13 *
Chris@16 14 * See http://www.boost.org/libs/iostreams for documentation.
Chris@16 15 */
Chris@16 16
Chris@16 17 #ifndef BOOST_IOSTREAMS_DETAIL_FILTER_ADAPTER_HPP_INCLUDED
Chris@16 18 #define BOOST_IOSTREAMS_DETAIL_FILTER_ADAPTER_HPP_INCLUDED
Chris@16 19
Chris@16 20 #include <boost/iostreams/categories.hpp>
Chris@16 21 #include <boost/iostreams/detail/call_traits.hpp>
Chris@16 22 #include <boost/iostreams/detail/ios.hpp>
Chris@16 23 #include <boost/iostreams/operations.hpp>
Chris@16 24 #include <boost/iostreams/traits.hpp>
Chris@16 25 #include <boost/static_assert.hpp>
Chris@16 26
Chris@16 27 namespace boost { namespace iostreams { namespace detail {
Chris@16 28
Chris@16 29 template<typename T>
Chris@16 30 class filter_adapter {
Chris@16 31 private:
Chris@16 32 typedef typename detail::value_type<T>::type value_type;
Chris@16 33 typedef typename detail::param_type<T>::type param_type;
Chris@16 34 public:
Chris@16 35 explicit filter_adapter(param_type t) : t_(t) { }
Chris@16 36 T& component() { return t_; }
Chris@16 37
Chris@16 38 template<typename Device>
Chris@16 39 void close(Device& dev)
Chris@16 40 {
Chris@16 41 detail::close_all(t_, dev);
Chris@16 42 }
Chris@16 43
Chris@16 44 template<typename Device>
Chris@16 45 void close(Device& dev, BOOST_IOS::openmode which)
Chris@16 46 {
Chris@16 47 iostreams::close(t_, dev, which);
Chris@16 48 }
Chris@16 49
Chris@16 50 template<typename Device>
Chris@16 51 void flush(Device& dev)
Chris@16 52 {
Chris@16 53 return iostreams::flush(t_, dev);
Chris@16 54 }
Chris@16 55
Chris@16 56 template<typename Locale> // Avoid dependency on <locale>
Chris@16 57 void imbue(const Locale& loc) { iostreams::imbue(t_, loc); }
Chris@16 58
Chris@16 59 std::streamsize optimal_buffer_size() const
Chris@16 60 { return iostreams::optimal_buffer_size(t_); }
Chris@16 61 public:
Chris@16 62 value_type t_;
Chris@16 63 };
Chris@16 64
Chris@16 65 //----------------------------------------------------------------------------//
Chris@16 66
Chris@16 67 } } } // End namespaces detail, iostreams, boost.
Chris@16 68
Chris@16 69 #endif // #ifndef BOOST_IOSTREAMS_DETAIL_FILTER_ADAPTER_HPP_INCLUDED