From: Marcus Eggenberger Date: Sun, 12 Oct 2008 14:48:19 +0000 (+0200) Subject: added debug operator: QDebug operator<<(QDebug dbg, const Message &msg); X-Git-Tag: 0.3.1~190 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=dc0533961824e174efa6dae3ea4c2e25a5d5503a;hp=8c785cc905a648fd48838c99387da21a97ff6819 added debug operator: QDebug operator<<(QDebug dbg, const Message &msg); --- diff --git a/src/common/message.cpp b/src/common/message.cpp index 124a291a..45517cff 100644 --- a/src/common/message.cpp +++ b/src/common/message.cpp @@ -70,3 +70,11 @@ QDataStream &operator>>(QDataStream &in, Message &msg) { return in; } +QDebug operator<<(QDebug dbg, const Message &msg) { + dbg.nospace() << qPrintable(QString("Message(MsgId:")) << msg.msgId() + << qPrintable(QString(",")) << msg.timestamp() + << qPrintable(QString(", Type:")) << msg.type() + << qPrintable(QString(", Flags:")) << msg.flags() << qPrintable(QString(")")) + << msg.sender() << ":" << msg.contents(); + return dbg; +} diff --git a/src/common/message.h b/src/common/message.h index 90a6a168..6f740282 100644 --- a/src/common/message.h +++ b/src/common/message.h @@ -90,12 +90,12 @@ private: QString _formattedTimestamp, _formattedSender, _formattedText; // cache - friend QDataStream &operator>>(QDataStream &in, Message &msg); }; QDataStream &operator<<(QDataStream &out, const Message &msg); QDataStream &operator>>(QDataStream &in, Message &msg); +QDebug operator<<(QDebug dbg, const Message &msg); Q_DECLARE_METATYPE(Message) Q_DECLARE_OPERATORS_FOR_FLAGS(Message::Flags)