I need override >> and << operators of QDataStream. There's my code:
QDataStream &operator <<(QDataStream &out, const SScenarioEntry Entry)
{
out.writeRawData(Entry.EntryName, sizeof(Entry.EntryName));
out << Entry.Number;
out << Entry.Type;
out.writeRawData(Entry.RequestString, sizeof(Entry.RequestString));
out.writeRawData(Entry.AnswerString, sizeof(Entry.AnswerString));
out.writeRawData(Entry.AdditionalParams, sizeof(Entry.AdditionalParams));
out << Entry.Timeout;
return out;
}
QDataStream &operator >>(QDataStream &in, SScenarioEntry Entry)
{
in.readRawData(Entry.EntryName, sizeof(Entry.EntryName));
in >> Entry.Number;
in >> Entry.Type;
in.readRawData(Entry.RequestString, sizeof(Entry.RequestString));
in.readRawData(Entry.AnswerString, sizeof(Entry.AnswerString));
in.readRawData(Entry.AdditionalParams, sizeof(Entry.AdditionalParams));
in >> Entry.Timeout;
return in;
}
After successfull compiling, I get some misunderstandable errors like this:
first define here
In function `Z7qt_noopv':
multiple definition of `operator>>(QDataStream&, scnent)`
I have 2 questions:
- How must I define the << and >> operators for correct working;
- If this code is correct, how to fix linking errors.
Tnx for answers.