Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
qpid/messaging/Message.h
Go to the documentation of this file.
00001 #ifndef QPID_MESSAGING_MESSAGE_H
00002 #define QPID_MESSAGING_MESSAGE_H
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  * 
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  * 
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
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 class MessageImpl;
00038 
00042 class QPID_MESSAGING_CLASS_EXTERN Message
00043 {
00044   public:
00045     QPID_MESSAGING_EXTERN Message(qpid::types::Variant&);
00046     QPID_MESSAGING_EXTERN Message(const std::string& bytes = std::string());
00047     QPID_MESSAGING_EXTERN Message(const char*, size_t);
00048     QPID_MESSAGING_EXTERN Message(const Message&);
00049     QPID_MESSAGING_EXTERN ~Message();
00050 
00051     QPID_MESSAGING_EXTERN Message& operator=(const Message&);
00052 
00053     QPID_MESSAGING_EXTERN void setReplyTo(const Address&);
00054     QPID_MESSAGING_EXTERN const Address& getReplyTo() const;
00055 
00056     QPID_MESSAGING_EXTERN void setSubject(const std::string&);
00057     QPID_MESSAGING_EXTERN const std::string& getSubject() const;
00058 
00064     QPID_MESSAGING_EXTERN void setContentType(const std::string&);
00070     QPID_MESSAGING_EXTERN const std::string& getContentType() const;
00071 
00077     QPID_MESSAGING_EXTERN void setMessageId(const std::string&);
00078     QPID_MESSAGING_EXTERN const std::string& getMessageId() const;
00079 
00086     QPID_MESSAGING_EXTERN void setUserId(const std::string&);
00087     QPID_MESSAGING_EXTERN const std::string& getUserId() const;
00088 
00096     QPID_MESSAGING_EXTERN void setCorrelationId(const std::string&);
00097     QPID_MESSAGING_EXTERN const std::string& getCorrelationId() const;
00098 
00104     QPID_MESSAGING_EXTERN void setPriority(uint8_t);
00105     QPID_MESSAGING_EXTERN uint8_t getPriority() const;
00106 
00112     QPID_MESSAGING_EXTERN void setTtl(Duration ttl);
00116     QPID_MESSAGING_EXTERN Duration getTtl() const;
00117 
00124     QPID_MESSAGING_EXTERN void setDurable(bool durable);
00125     QPID_MESSAGING_EXTERN bool getDurable() const;
00126 
00134     QPID_MESSAGING_EXTERN bool getRedelivered() const;
00140     QPID_MESSAGING_EXTERN void setRedelivered(bool);
00141 
00150     QPID_MESSAGING_EXTERN const qpid::types::Variant::Map& getProperties() const;
00151     QPID_MESSAGING_EXTERN qpid::types::Variant::Map& getProperties();
00152     QPID_MESSAGING_EXTERN void setProperties(const qpid::types::Variant::Map&);
00153 
00160     QPID_MESSAGING_EXTERN void setContent(const std::string&);
00165     QPID_MESSAGING_EXTERN void setContent(const char* chars, size_t count);
00166 
00168     QPID_MESSAGING_EXTERN std::string getContent() const;
00170     QPID_MESSAGING_EXTERN std::string getContentBytes() const;
00172     QPID_MESSAGING_EXTERN void setContentBytes(const std::string&);
00178     QPID_MESSAGING_EXTERN qpid::types::Variant& getContentObject();
00184     QPID_MESSAGING_EXTERN const qpid::types::Variant& getContentObject() const;
00189     QPID_MESSAGING_EXTERN void setContentObject(const qpid::types::Variant&);
00196     QPID_MESSAGING_EXTERN const char* getContentPtr() const;
00198     QPID_MESSAGING_EXTERN size_t getContentSize() const;
00199 
00200     QPID_MESSAGING_EXTERN void setProperty(const std::string&, const qpid::types::Variant&);
00201   private:
00202     MessageImpl* impl;
00203     friend struct MessageImplAccess;
00204 };
00205 
00206 struct QPID_MESSAGING_CLASS_EXTERN EncodingException : qpid::types::Exception
00207 {
00208     QPID_MESSAGING_EXTERN EncodingException(const std::string& msg);
00209 };
00210 
00220 QPID_MESSAGING_EXTERN void decode(const Message& message,
00221                                   qpid::types::Variant::Map& map,
00222                                   const std::string& encoding = std::string());
00232 QPID_MESSAGING_EXTERN void decode(const Message& message,
00233                                   qpid::types::Variant::List& list,
00234                                   const std::string& encoding = std::string());
00244 QPID_MESSAGING_EXTERN void encode(const qpid::types::Variant::Map& map,
00245                                   Message& message,
00246                                   const std::string& encoding = std::string());
00256 QPID_MESSAGING_EXTERN void encode(const qpid::types::Variant::List& list,
00257                                   Message& message,
00258                                   const std::string& encoding = std::string());
00259 
00260 }} // namespace qpid::messaging
00261 
00262 #endif  

Qpid C++ API Reference
Generated on Wed Dec 30 2015 for Qpid C++ Client API by doxygen 1.7.6.1