I
Ioannis Papadopoulos
I would like to extend the functionality of all streams in C++ so I
can do some fancy stuff like redirecting the streams on the fly.
I don't want to reimplement the whole stream support in C++ and I
would like to keep as much as possible that is already existing.
However, the only thing that my user would like to see is the
following
#include "myiostream.hpp"
int main() {
my::cout << "Hello World" << std::endl;
}
cout will redirect anything from files to sockets and this redirection
will be handled by a runtime system without used intervention.
My first attempt was to extend ostream and istream and reimplement
some of the functions. But clearly it isn't what I'm looking for,
since I have also to reimplement all other functions such as endl().
I think the way to go is to reimplement basic_streambuf and filebuf.
Am I in the right direction or should I start from lower layers
(ios_base) ? Note that I do not want to remove the support for
whatever currently exists.
Thanks
can do some fancy stuff like redirecting the streams on the fly.
I don't want to reimplement the whole stream support in C++ and I
would like to keep as much as possible that is already existing.
However, the only thing that my user would like to see is the
following
#include "myiostream.hpp"
int main() {
my::cout << "Hello World" << std::endl;
}
cout will redirect anything from files to sockets and this redirection
will be handled by a runtime system without used intervention.
My first attempt was to extend ostream and istream and reimplement
some of the functions. But clearly it isn't what I'm looking for,
since I have also to reimplement all other functions such as endl().
I think the way to go is to reimplement basic_streambuf and filebuf.
Am I in the right direction or should I start from lower layers
(ios_base) ? Note that I do not want to remove the support for
whatever currently exists.
Thanks