Alex Dribin <no****@nospam.net> wrote:
Are there ready solutions for auto-wrapping lines in ostream?
Dunno.
I am using ostream for output and want this output to be wrapped at some
position. Of course I can monitor stream pointer position and insert
end-of-lines periodically. Something better than that?
Create a stream buffer whose buffer happens to be the maximum size of your
line. On buffer overflow you just search the buffer up to the first newline
and sent this portion, moving the remainder to the front of the buffer. If
there is no newline, you jsut sent the whole buffer followed by a newline
and emptying the buffer.
This stream buffer is probably a filtering stream buffer and would take
something like maybe 20 lines. Together with a few convenience classes you
will have something like 50 lines.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
Phaidros eaSE - Easy Software Engineering: <http://www.phaidros.com/>