1 // Copyright (c) 2001-2011 Hartmut Kaiser
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boist.org/LICENSE_1_0.txt)
6 #if !defined(BOOST_SPIRIT_ITERATOR_SINK_MAY_27_2007_0133PM)
7 #define BOOST_SPIRIT_ITERATOR_SINK_MAY_27_2007_0133PM
13 #include <boost/iostreams/stream.hpp>
14 #include <boost/spirit/home/karma/detail/generate_to.hpp>
16 ///////////////////////////////////////////////////////////////////////////////
17 namespace boost { namespace spirit { namespace karma { namespace detail
19 ///////////////////////////////////////////////////////////////////////////
21 typename OutputIterator, typename Char, typename CharEncoding
26 typedef boost::iostreams::sink_tag category;
27 typedef Char char_type;
29 iterator_sink (OutputIterator& sink_)
33 // Write up to n characters from the buffer s to the output sequence,
34 // returning the number of characters written
35 std::streamsize write (Char const* s, std::streamsize n)
37 std::streamsize bytes_written = 0;
39 if (!generate_to(sink, *s, CharEncoding(), Tag()))
49 // silence MSVC warning C4512: assignment operator could not be generated
50 iterator_sink& operator= (iterator_sink const&);