PageRenderTime 12ms CodeModel.GetById 7ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/iostreams/detail/adapter/device_adapter.hpp

http://hadesmem.googlecode.com/
C++ Header | 67 lines | 38 code | 12 blank | 17 comment | 0 complexity | 73023d4b046f7793943837c8e99c5d3a MD5 | raw file
 1/*
 2 * Defines the class template boost::iostreams::detail::device_adapter,
 3 * a convenience base class for device adapters.
 4 *
 5 * File:        boost/iostreams/detail/adapter/filter_adapter.hpp
 6 * Date:        Mon Nov 26 14:35:48 MST 2007
 7 * 
 8 * Copyright:   2007-2008 CodeRage, LLC
 9 * Author:      Jonathan Turkanis
10 * Contact:     turkanis at coderage dot com
11 *
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.)
14 * 
15 * See http://www.boost.org/libs/iostreams for documentation.
16 */
17
18#ifndef BOOST_IOSTREAMS_DETAIL_DEVICE_ADAPTER_HPP_INCLUDED
19#define BOOST_IOSTREAMS_DETAIL_DEVICE_ADAPTER_HPP_INCLUDED
20
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>
27
28namespace boost { namespace iostreams { namespace detail {
29
30template<typename T>
31class device_adapter {
32private:
33    typedef typename detail::value_type<T>::type value_type;
34    typedef typename detail::param_type<T>::type param_type;
35public:
36    explicit device_adapter(param_type t) : t_(t) { }
37    T& component() { return t_; }
38
39    void close() 
40    {
41        detail::close_all(t_);
42    }
43
44    void close(BOOST_IOS::openmode which) 
45    { 
46        iostreams::close(t_, which); 
47    }
48
49    bool flush() 
50    { 
51        return iostreams::flush(t_); 
52    }
53
54    template<typename Locale> // Avoid dependency on <locale>
55    void imbue(const Locale& loc) { iostreams::imbue(t_, loc); }
56
57    std::streamsize optimal_buffer_size() const 
58    { return iostreams::optimal_buffer_size(t_); }
59public:
60    value_type t_;
61};
62
63//----------------------------------------------------------------------------//
64
65} } } // End namespaces detail, iostreams, boost.
66
67#endif // #ifndef BOOST_IOSTREAMS_DETAIL_DEVICE_ADAPTER_HPP_INCLUDED