annotate DEPENDENCIES/generic/include/boost/iostreams/detail/adapter/device_adapter.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /*
Chris@16 2 * Defines the class template boost::iostreams::detail::device_adapter,
Chris@16 3 * a convenience base class for device 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 *
Chris@16 8 * Copyright: 2007-2008 CodeRage, LLC
Chris@16 9 * Author: Jonathan Turkanis
Chris@16 10 * Contact: turkanis at coderage dot com
Chris@16 11 *
Chris@16 12 * Distributed under the Boost Software License, Version 1.0.(See accompanying
Chris@16 13 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
Chris@16 14 *
Chris@16 15 * See http://www.boost.org/libs/iostreams for documentation.
Chris@16 16 */
Chris@16 17
Chris@16 18 #ifndef BOOST_IOSTREAMS_DETAIL_DEVICE_ADAPTER_HPP_INCLUDED
Chris@16 19 #define BOOST_IOSTREAMS_DETAIL_DEVICE_ADAPTER_HPP_INCLUDED
Chris@16 20
Chris@16 21 #include <boost/iostreams/categories.hpp>
Chris@16 22 #include <boost/iostreams/detail/call_traits.hpp>
Chris@16 23 #include <boost/iostreams/detail/ios.hpp>
Chris@16 24 #include <boost/iostreams/operations.hpp>
Chris@16 25 #include <boost/iostreams/traits.hpp>
Chris@16 26 #include <boost/static_assert.hpp>
Chris@16 27
Chris@16 28 namespace boost { namespace iostreams { namespace detail {
Chris@16 29
Chris@16 30 template<typename T>
Chris@16 31 class device_adapter {
Chris@16 32 private:
Chris@16 33 typedef typename detail::value_type<T>::type value_type;
Chris@16 34 typedef typename detail::param_type<T>::type param_type;
Chris@16 35 public:
Chris@16 36 explicit device_adapter(param_type t) : t_(t) { }
Chris@16 37 T& component() { return t_; }
Chris@16 38
Chris@16 39 void close()
Chris@16 40 {
Chris@16 41 detail::close_all(t_);
Chris@16 42 }
Chris@16 43
Chris@16 44 void close(BOOST_IOS::openmode which)
Chris@16 45 {
Chris@16 46 iostreams::close(t_, which);
Chris@16 47 }
Chris@16 48
Chris@16 49 bool flush()
Chris@16 50 {
Chris@16 51 return iostreams::flush(t_);
Chris@16 52 }
Chris@16 53
Chris@16 54 template<typename Locale> // Avoid dependency on <locale>
Chris@16 55 void imbue(const Locale& loc) { iostreams::imbue(t_, loc); }
Chris@16 56
Chris@16 57 std::streamsize optimal_buffer_size() const
Chris@16 58 { return iostreams::optimal_buffer_size(t_); }
Chris@16 59 public:
Chris@16 60 value_type t_;
Chris@16 61 };
Chris@16 62
Chris@16 63 //----------------------------------------------------------------------------//
Chris@16 64
Chris@16 65 } } } // End namespaces detail, iostreams, boost.
Chris@16 66
Chris@16 67 #endif // #ifndef BOOST_IOSTREAMS_DETAIL_DEVICE_ADAPTER_HPP_INCLUDED