summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/ClientMessage.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/client/ClientMessage.h')
-rw-r--r--cpp/src/qpid/client/ClientMessage.h66
1 files changed, 24 insertions, 42 deletions
diff --git a/cpp/src/qpid/client/ClientMessage.h b/cpp/src/qpid/client/ClientMessage.h
index 1afe5585a9..5c4eb4e5aa 100644
--- a/cpp/src/qpid/client/ClientMessage.h
+++ b/cpp/src/qpid/client/ClientMessage.h
@@ -22,13 +22,7 @@
*
*/
#include <string>
-#include "qpid/framing/BasicHeaderProperties.h"
-#include "qpid/framing/FrameSet.h"
-#include "qpid/framing/MethodContent.h"
-
-#include "qpid/framing/BasicDeliverBody.h"
-#include "qpid/framing/BasicGetOkBody.h"
-#include "qpid/framing/MessageTransferBody.h"
+#include "qpid/framing/TransferContent.h"
namespace qpid {
namespace client {
@@ -39,49 +33,37 @@ namespace client {
*
* \ingroup clientapi
*/
-// FIXME aconway 2007-04-05: Should be based on MessageTransfer properties not
-// basic header properties.
-class Message : public framing::BasicHeaderProperties, public framing::MethodContent {
- public:
- Message(const std::string& data_=std::string()) : data(data_) {}
-
- const std::string& getData() const { return data; }
- void setData(const std::string& _data) { data = _data; }
-
- std::string getDestination() const { return destination; }
- void setDestination(const std::string& dest) { destination = dest; }
+class Message : public framing::TransferContent
+{
+public:
+ Message(const std::string& data_=std::string()) : TransferContent(data_) {}
- // TODO aconway 2007-03-22: only needed for Basic.deliver support.
- uint64_t getDeliveryTag() const { return deliveryTag; }
- void setDeliveryTag(uint64_t dt) { deliveryTag = dt; }
-
- bool isRedelivered() const { return redelivered; }
- void setRedelivered(bool _redelivered){ redelivered = _redelivered; }
+ std::string getDestination() const
+ {
+ return destination;
+ }
+
+ void setDestination(const std::string& dest)
+ {
+ destination = dest;
+ }
- framing::AMQHeaderBody getHeader() const
+ bool isRedelivered() const
{
- framing::AMQHeaderBody header;
- BasicHeaderProperties* properties = header.get<BasicHeaderProperties>(true);
- BasicHeaderProperties::copy<BasicHeaderProperties, Message>(*properties, *this);
- properties->setContentLength(data.size());
- return header;
+ return hasDeliveryProperties() && getDeliveryProperties().getRedelivered();
}
- //TODO: move this elsewhere (GRS 24/08/2007)
- void populate(framing::FrameSet& frameset)
- {
- const BasicHeaderProperties* properties = frameset.getHeaders()->get<BasicHeaderProperties>();
- if (properties) {
- BasicHeaderProperties::copy<Message, BasicHeaderProperties>(*this, *properties);
- }
- frameset.getContent(data);
+ void setRedelivered(bool redelivered) {
+ getDeliveryProperties().setRedelivered(redelivered);
+ }
+
+ framing::FieldTable& getHeaders()
+ {
+ return getMessageProperties().getApplicationHeaders();
}
- private:
- std::string data;
+private:
std::string destination;
- bool redelivered;
- uint64_t deliveryTag;
};
}}