Hello Frank,
Friday, March 27, 2009, 9:23:55 PM, you wrote:
That's right. Now it is time to work on some improvements.
If you're not working on a multithreaded program use static, there is no
need to re-create stringstream each time you want to use it. And we
don't need tmp, it will slow you down a bit if the compiler
isn't smart enough.
static std::stringstream ss;
static QString tmp;
was.render(ss.str(""));
QTextStream::operator <<(QString::fromStdString(ss.str()));
return *this;
I'm all so not sure if you require QTextStream at all. If you just want to
redirect cout into a file you can do it by redefining cout's rdbuf.
Or you may use stringstream as the output buffer and then write it to a file
or to a screen.
FB> #include "qtextstreamcgi.h"
FB> #include <sstream>
FB> namespace QFrank
FB> {
FB> QTextStreamCGI::QTextStreamCGI(FILE *datei,QIODevice::OpenMode
zugriff):QTextStream(datei,zugriff)
FB> {
FB> }
FB> QTextStreamCGI &QTextStreamCGI:: operator <<(const cgicc::MStreamable &was)
FB> {
FB> std::stringstream ss;
FB> was.render(ss);
FB> QString tmp =QString::fromStdString(ss.str());
FB> QTextStream::operator <<(tmp);
FB> return *this;
FB> }
FB> }
--
www.rol.ru
Best regards,
Igor mailto:[email protected]
_______________________________________________
help-cgicc mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-cgicc