Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation |
00001 #ifndef QPID_MESSAGING_ADDRESS_H 00002 #define QPID_MESSAGING_ADDRESS_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 <string> 00025 #include "qpid/Exception.h" 00026 #include "qpid/messaging/Variant.h" 00027 #include "qpid/client/ClientImportExport.h" 00028 #include <ostream> 00029 00030 namespace qpid { 00031 namespace messaging { 00032 00033 struct InvalidAddress : public qpid::Exception 00034 { 00035 InvalidAddress(const std::string& msg); 00036 }; 00037 00038 struct MalformedAddress : public qpid::Exception 00039 { 00040 MalformedAddress(const std::string& msg); 00041 }; 00042 00043 class AddressImpl; 00044 00141 class Address 00142 { 00143 public: 00144 QPID_CLIENT_EXTERN Address(); 00145 QPID_CLIENT_EXTERN Address(const std::string& address); 00146 QPID_CLIENT_EXTERN Address(const std::string& name, const std::string& subject, 00147 const Variant::Map& options, const std::string& type = ""); 00148 QPID_CLIENT_EXTERN Address(const Address& address); 00149 QPID_CLIENT_EXTERN ~Address(); 00150 QPID_CLIENT_EXTERN Address& operator=(const Address&); 00151 QPID_CLIENT_EXTERN const std::string& getName() const; 00152 QPID_CLIENT_EXTERN void setName(const std::string&); 00153 QPID_CLIENT_EXTERN const std::string& getSubject() const; 00154 QPID_CLIENT_EXTERN void setSubject(const std::string&); 00155 QPID_CLIENT_EXTERN bool hasSubject() const; 00156 QPID_CLIENT_EXTERN const Variant::Map& getOptions() const; 00157 QPID_CLIENT_EXTERN Variant::Map& getOptions(); 00158 QPID_CLIENT_EXTERN void setOptions(const Variant::Map&); 00159 00160 QPID_CLIENT_EXTERN std::string getType() const; 00161 QPID_CLIENT_EXTERN void setType(const std::string&); 00162 00163 QPID_CLIENT_EXTERN const Variant& getOption(const std::string& key) const; 00164 00165 QPID_CLIENT_EXTERN std::string toStr() const; 00166 QPID_CLIENT_EXTERN operator bool() const; 00167 QPID_CLIENT_EXTERN bool operator !() const; 00168 private: 00169 AddressImpl* impl; 00170 }; 00171 00172 QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const Address& address); 00173 00174 }} // namespace qpid::messaging 00175 00176 #endif