Simplified redirection of iostreams. More...
#include <vul_redirector.h>
Public Member Functions | |
vul_redirector (vcl_ostream &s) | |
Attach redirector to vcl_ostream s, so that all future output to s goes through this->putchunk. | |
virtual | ~vul_redirector () |
Destroy redirector, restore stream to original. | |
virtual vcl_streamsize | putchunk (char const *buf, vcl_streamsize n) |
The filter function. | |
Protected Member Functions | |
vcl_streamsize | put_passthru (char const *buf, vcl_streamsize n) |
Put characters to original stream. | |
int | sync_passthru () |
Sync original stream. | |
Private Attributes | |
vul_redirector_data * | p |
Simplified redirection of iostreams.
To implement your own, derive a class from vul_redirector, and implement `putchunk'.
Definition at line 26 of file vul_redirector.h.
vul_redirector::vul_redirector | ( | vcl_ostream & | s | ) |
Attach redirector to vcl_ostream s, so that all future output to s goes through this->putchunk.
Definition at line 97 of file vul_redirector.cxx.
vul_redirector::~vul_redirector | ( | ) | [virtual] |
Destroy redirector, restore stream to original.
Definition at line 112 of file vul_redirector.cxx.
vcl_streamsize vul_redirector::put_passthru | ( | char const * | buf, |
vcl_streamsize | n | ||
) | [protected] |
Put characters to original stream.
Useful for derived classes which wish to filter a stream.
Definition at line 140 of file vul_redirector.cxx.
vcl_streamsize vul_redirector::putchunk | ( | char const * | buf, |
vcl_streamsize | n | ||
) | [virtual] |
The filter function.
Default action is just to pass text on the old stream.
Called with `n' characters in `buf', do with as you like.
Definition at line 146 of file vul_redirector.cxx.
int vul_redirector::sync_passthru | ( | ) | [protected] |
Sync original stream.
Definition at line 125 of file vul_redirector.cxx.
vul_redirector_data* vul_redirector::p [private] |
Definition at line 48 of file vul_redirector.h.