Abstract stream support in printer classes
This patch allows to create new printers based on custom streams.
This is still a WIP, probably some code is redundant.
The change was originated by my need to use QTextStream class, in order to write the stacktrace in a QFile.
This should also start an implementation for the issue #26 .
Why not keeping the printer API, but changing its backend to pick the right printer under the hood?
Printer printer;
printer.print(st, stdout); // uses legacy FILE backend
printer.print(st, std::cout); //Uses new std::ostream compatible backend
Also, I don't see any benefit of adding a printer singleton.
I need to use with Qt QTextStream, in order to dump a stacktrace in a QFile, I cannot use console. Anyway, I assume that hardcoding a stream technology, no matter what is, does not allow this library to be adapter to any other non-STL or non-STDIO context.
Regarding QTextStream, you cannot use STL I/O manipulators, and it does not fit as it is, that's why I tried to create an interface layer, without changing too much (well, I tried).
I was able to perform it with templates, but that required a singleton in my implementation to make everything fit each other. Virtual interfaces could be another approach, but it would have requested more changes IMHO.