TorAn
29th January 2012, 18:44
I have to use QIODevice in overloaded operators << and >> where std::i(o)streams are passed-in as arguments.
I'll appreciate the advice (or code :) ) for the wrapper that will allow me to initialize QIODevice instance with standard streams.
Example of what I am trying to accomplish:
std::ostream& operator << (std::ostream& s, const myClass& a)
{
int i = 5;
s << i;
QIODevice device; // somehow wrap stream "s" to be QIODevice instance.
QXmlStreamWriter writer(&device);
writer.writeStartDocument("1.0");
..
return s;
}
I'll appreciate the advice (or code :) ) for the wrapper that will allow me to initialize QIODevice instance with standard streams.
Example of what I am trying to accomplish:
std::ostream& operator << (std::ostream& s, const myClass& a)
{
int i = 5;
s << i;
QIODevice device; // somehow wrap stream "s" to be QIODevice instance.
QXmlStreamWriter writer(&device);
writer.writeStartDocument("1.0");
..
return s;
}