Qpid C++ Messaging API  0.24
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Message.h
Go to the documentation of this file.
1 #ifndef QPID_MESSAGING_MESSAGE_H
2 #define QPID_MESSAGING_MESSAGE_H
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
25 
27 #include "qpid/types/Exception.h"
28 #include "qpid/types/Variant.h"
29 
30 #include <string>
31 
32 namespace qpid {
33 namespace messaging {
34 
35 class Address;
36 class Codec;
37 class MessageImpl;
38 
43 {
44  public:
45  QPID_MESSAGING_EXTERN Message(const std::string& bytes = std::string());
46  QPID_MESSAGING_EXTERN Message(const char*, size_t);
47  QPID_MESSAGING_EXTERN Message(const Message&);
48  QPID_MESSAGING_EXTERN ~Message();
49 
50  QPID_MESSAGING_EXTERN Message& operator=(const Message&);
51 
52  QPID_MESSAGING_EXTERN void setReplyTo(const Address&);
53  QPID_MESSAGING_EXTERN const Address& getReplyTo() const;
54 
55  QPID_MESSAGING_EXTERN void setSubject(const std::string&);
56  QPID_MESSAGING_EXTERN const std::string& getSubject() const;
57 
63  QPID_MESSAGING_EXTERN void setContentType(const std::string&);
69  QPID_MESSAGING_EXTERN const std::string& getContentType() const;
70 
76  QPID_MESSAGING_EXTERN void setMessageId(const std::string&);
77  QPID_MESSAGING_EXTERN const std::string& getMessageId() const;
78 
85  QPID_MESSAGING_EXTERN void setUserId(const std::string&);
86  QPID_MESSAGING_EXTERN const std::string& getUserId() const;
87 
95  QPID_MESSAGING_EXTERN void setCorrelationId(const std::string&);
96  QPID_MESSAGING_EXTERN const std::string& getCorrelationId() const;
97 
103  QPID_MESSAGING_EXTERN void setPriority(uint8_t);
104  QPID_MESSAGING_EXTERN uint8_t getPriority() const;
105 
111  QPID_MESSAGING_EXTERN void setTtl(Duration ttl);
115  QPID_MESSAGING_EXTERN Duration getTtl() const;
116 
123  QPID_MESSAGING_EXTERN void setDurable(bool durable);
124  QPID_MESSAGING_EXTERN bool getDurable() const;
125 
133  QPID_MESSAGING_EXTERN bool getRedelivered() const;
139  QPID_MESSAGING_EXTERN void setRedelivered(bool);
140 
149  QPID_MESSAGING_EXTERN const qpid::types::Variant::Map& getProperties() const;
151 
158  QPID_MESSAGING_EXTERN void setContent(const std::string&);
163  QPID_MESSAGING_EXTERN void setContent(const char* chars, size_t count);
164 
166  QPID_MESSAGING_EXTERN std::string getContent() const;
173  QPID_MESSAGING_EXTERN const char* getContentPtr() const;
175  QPID_MESSAGING_EXTERN size_t getContentSize() const;
176 
177  QPID_MESSAGING_EXTERN void setProperty(const std::string&, const qpid::types::Variant&);
178  private:
179  MessageImpl* impl;
180  friend struct MessageImplAccess;
181 };
182 
184 {
185  QPID_MESSAGING_EXTERN EncodingException(const std::string& msg);
186 };
187 
197 QPID_MESSAGING_EXTERN void decode(const Message& message,
199  const std::string& encoding = std::string());
209 QPID_MESSAGING_EXTERN void decode(const Message& message,
211  const std::string& encoding = std::string());
222  Message& message,
223  const std::string& encoding = std::string());
234  Message& message,
235  const std::string& encoding = std::string());
236 
237 }} // namespace qpid::messaging
238 
239 #endif