Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:48

0001 // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
0002 // (C) Copyright 2003-2007 Jonathan Turkanis
0003 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0004 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
0005 
0006 // See http://www.boost.org/libs/iostreams for documentation.
0007 
0008 #ifndef BOOST_IOSTREAMS_DETAIL_OUTPUT_ITERATOR_ADAPTER_HPP_INCLUDED
0009 #define BOOST_IOSTREAMS_DETAIL_OUTPUT_ITERATOR_ADAPTER_HPP_INCLUDED
0010 
0011 #if defined(_MSC_VER)
0012 # pragma once
0013 #endif              
0014 
0015 #include <algorithm>                      // copy.
0016 #include <iosfwd>                         // streamsize.
0017 #include <boost/iostreams/categories.hpp> // tags.
0018 #include <boost/static_assert.hpp>
0019 #include <boost/type_traits/is_convertible.hpp>
0020 
0021 namespace boost { namespace iostreams { namespace detail {
0022 
0023 template<typename Mode, typename Ch, typename OutIt>
0024 class output_iterator_adapter {
0025 public:
0026     BOOST_STATIC_ASSERT((is_convertible<Mode, output>::value));
0027     typedef Ch        char_type;
0028     typedef sink_tag  category;
0029     explicit output_iterator_adapter(OutIt out) : out_(out) { }
0030     std::streamsize write(const char_type* s, std::streamsize n) 
0031     { 
0032         std::copy(s, s + n, out_); 
0033         return n; 
0034     }
0035 private:
0036     OutIt out_;
0037 };
0038 
0039 } } } // End namespaces detail, iostreams, boost.
0040 
0041 #endif // #ifndef BOOST_IOSTREAMS_DETAIL_OUTPUT_ITERATOR_ADAPTER_HPP_INCLUDED //-----//