added debug operator: QDebug operator<<(QDebug dbg, const Message &msg);
authorMarcus Eggenberger <egs@quassel-irc.org>
Sun, 12 Oct 2008 14:48:19 +0000 (16:48 +0200)
committerMarcus Eggenberger <egs@quassel-irc.org>
Sun, 12 Oct 2008 14:48:19 +0000 (16:48 +0200)
src/common/message.cpp
src/common/message.h

index 124a291..45517cf 100644 (file)
@@ -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;
+}
index 90a6a16..6f74028 100644 (file)
@@ -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)