File indexing completed on 2025-01-18 09:38:48
0001
0002
0003
0004
0005
0006
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 } } }
0040
0041 #endif