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
)
27 std::streamsize
write(const char* s
, std::streamsize n
)
29 size_t oldsize
= stream
.size();
30 stream
.resize(oldsize
+ n
);
31 memcpy(&stream
[oldsize
], s
, n
);
33 size_t lf
= stream
.size();
34 for(size_t i
= 0; i
< stream
.size(); i
++)
35 if(stream
[i
] == '\n') {
39 if(lf
== stream
.size())
41 std::string
foo(stream
.begin(), stream
.begin() + lf
);
43 if(lf
+ 1 < stream
.size())
44 memmove(&stream
[0], &stream
[lf
+ 1], stream
.size() - lf
- 1);
45 stream
.resize(stream
.size() - lf
- 1);
50 std::vector
<char> stream
;
55 std::ostream
& window::out() throw(std::bad_alloc
)
57 static std::ostream
* cached
= NULL
;
59 cached
= new boost::iostreams::stream
<window_output
>(this);