00001 #ifndef QPID_MESSAGING_MESSAGE_H
00002 #define QPID_MESSAGING_MESSAGE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "qpid/messaging/ImportExport.h"
00025
00026 #include "qpid/messaging/Duration.h"
00027 #include "qpid/types/Exception.h"
00028 #include "qpid/types/Variant.h"
00029
00030 #include <string>
00031
00032 namespace qpid {
00033 namespace messaging {
00034
00035 class Address;
00036 class Codec;
00037 struct MessageImpl;
00038
00042 class Message
00043 {
00044 public:
00045 QPID_MESSAGING_EXTERN Message(const std::string& bytes = std::string());
00046 QPID_MESSAGING_EXTERN Message(const char*, size_t);
00047 QPID_MESSAGING_EXTERN Message(const Message&);
00048 QPID_MESSAGING_EXTERN ~Message();
00049
00050 QPID_MESSAGING_EXTERN Message& operator=(const Message&);
00051
00052 QPID_MESSAGING_EXTERN void setReplyTo(const Address&);
00053 QPID_MESSAGING_EXTERN const Address& getReplyTo() const;
00054
00055 QPID_MESSAGING_EXTERN void setSubject(const std::string&);
00056 QPID_MESSAGING_EXTERN const std::string& getSubject() const;
00057
00058 QPID_MESSAGING_EXTERN void setContentType(const std::string&);
00059 QPID_MESSAGING_EXTERN const std::string& getContentType() const;
00060
00061 QPID_MESSAGING_EXTERN void setMessageId(const std::string&);
00062 QPID_MESSAGING_EXTERN const std::string& getMessageId() const;
00063
00064 QPID_MESSAGING_EXTERN void setUserId(const std::string&);
00065 QPID_MESSAGING_EXTERN const std::string& getUserId() const;
00066
00067 QPID_MESSAGING_EXTERN void setCorrelationId(const std::string&);
00068 QPID_MESSAGING_EXTERN const std::string& getCorrelationId() const;
00069
00070 QPID_MESSAGING_EXTERN void setPriority(uint8_t);
00071 QPID_MESSAGING_EXTERN uint8_t getPriority() const;
00072
00076 QPID_MESSAGING_EXTERN void setTtl(Duration ttl);
00080 QPID_MESSAGING_EXTERN Duration getTtl() const;
00081
00082 QPID_MESSAGING_EXTERN void setDurable(bool durable);
00083 QPID_MESSAGING_EXTERN bool getDurable() const;
00084
00085 QPID_MESSAGING_EXTERN bool getRedelivered() const;
00086 QPID_MESSAGING_EXTERN void setRedelivered(bool);
00087
00088 QPID_MESSAGING_EXTERN const qpid::types::Variant::Map& getProperties() const;
00089 QPID_MESSAGING_EXTERN qpid::types::Variant::Map& getProperties();
00090
00091 QPID_MESSAGING_EXTERN void setContent(const std::string&);
00095 QPID_MESSAGING_EXTERN void setContent(const char* chars, size_t count);
00096
00098 QPID_MESSAGING_EXTERN std::string getContent() const;
00100 QPID_MESSAGING_EXTERN const char* getContentPtr() const;
00102 QPID_MESSAGING_EXTERN size_t getContentSize() const;
00103 private:
00104 MessageImpl* impl;
00105 friend struct MessageImplAccess;
00106 };
00107
00108 struct EncodingException : qpid::types::Exception
00109 {
00110 EncodingException(const std::string& msg);
00111 };
00112
00122 QPID_MESSAGING_EXTERN void decode(const Message& message,
00123 qpid::types::Variant::Map& map,
00124 const std::string& encoding = std::string());
00134 QPID_MESSAGING_EXTERN void decode(const Message& message,
00135 qpid::types::Variant::List& list,
00136 const std::string& encoding = std::string());
00146 QPID_MESSAGING_EXTERN void encode(const qpid::types::Variant::Map& map,
00147 Message& message,
00148 const std::string& encoding = std::string());
00158 QPID_MESSAGING_EXTERN void encode(const qpid::types::Variant::List& list,
00159 Message& message,
00160 const std::string& encoding = std::string());
00161
00162 }}
00163
00164 #endif