refactor Message

message now provides an "isValid" property, data is implicitly shared now
This commit is contained in:
Matt Broadstone 2014-06-19 10:00:52 -04:00
parent 64c371ebb0
commit bf21ebc246
2 changed files with 11 additions and 2 deletions

View File

@ -30,6 +30,13 @@ Message &Message::operator=(const Message &other)
return *this;
}
bool Message::isValid() const
{
return d->deliveryTag != 0 &&
!d->exchangeName.isNull() &&
!d->routingKey.isNull();
}
qlonglong Message::deliveryTag() const
{
return d->deliveryTag;

View File

@ -3,7 +3,7 @@
#include <QByteArray>
#include <QHash>
#include <QExplicitlySharedDataPointer>
#include <QSharedDataPointer>
#include "amqp_frame.h"
#include "amqp_global.h"
@ -20,6 +20,8 @@ public:
Message &operator=(const Message &other);
~Message();
bool isValid() const;
qlonglong deliveryTag() const;
bool redelivered() const;
QString exchangeName() const;
@ -29,7 +31,7 @@ public:
Frame::TableField headers() const;
private:
QExplicitlySharedDataPointer<MessagePrivate> d;
QSharedDataPointer<MessagePrivate> d;
friend class QueuePrivate;
friend class Queue;