2 #include <boost/iostreams/categories.hpp>
3 #include <boost/iostreams/copy.hpp>
4 #include <boost/iostreams/stream.hpp>
5 #include <boost/iostreams/stream_buffer.hpp>
6 #include <boost/iostreams/filter/symmetric.hpp>
7 #include <boost/iostreams/filter/zlib.hpp>
8 #include <boost/iostreams/filtering_stream.hpp>
9 #include <boost/iostreams/device/back_inserter.hpp>
16 typedef char char_type
;
17 typedef boost::iostreams::sink_tag category
;
18 window_output(window
* win
)
26 std::streamsize
write(const char* s
, std::streamsize n
)
28 size_t oldsize
= stream
.size();
29 stream
.resize(oldsize
+ n
);
30 memcpy(&stream
[oldsize
], s
, n
);
32 size_t lf
= stream
.size();
33 for(size_t i
= 0; i
< stream
.size(); i
++)
34 if(stream
[i
] == '\n') {
38 if(lf
== stream
.size())
40 std::string
foo(stream
.begin(), stream
.begin() + lf
);
42 if(lf
+ 1 < stream
.size())
43 memmove(&stream
[0], &stream
[lf
+ 1], stream
.size() - lf
- 1);
44 stream
.resize(stream
.size() - lf
- 1);
49 std::vector
<char> stream
;
53 std::ostream
& window::out() throw(std::bad_alloc
)
55 static std::ostream
* cached
= NULL
;
58 cached
= new boost::iostreams::stream
<window_output
>(win
);