summaryrefslogtreecommitdiff
path: root/cpp/include
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2010-03-31 16:17:17 +0000
committerGordon Sim <gsim@apache.org>2010-03-31 16:17:17 +0000
commitf6f1900eb98cc1773a88a3ec309afa646438a384 (patch)
tree68e50e7aa1819afd283d73700965b539355a779d /cpp/include
parent887281838e4bf7825189ce3b0a8d7509789e6a08 (diff)
downloadqpid-python-f6f1900eb98cc1773a88a3ec309afa646438a384.tar.gz
QPID-664: made changes suggested by Alan Conway, also moved 0-10 map/list codecs to common lib
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@929606 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/include')
-rw-r--r--cpp/include/qpid/amqp_0_10/Codecs.h (renamed from cpp/include/qpid/client/amqp0_10/Codecs.h)43
-rw-r--r--cpp/include/qpid/messaging/Address.h22
-rw-r--r--cpp/include/qpid/messaging/Codec.h46
-rw-r--r--cpp/include/qpid/messaging/Connection.h11
-rw-r--r--cpp/include/qpid/messaging/ListContent.h91
-rw-r--r--cpp/include/qpid/messaging/ListView.h67
-rw-r--r--cpp/include/qpid/messaging/MapContent.h91
-rw-r--r--cpp/include/qpid/messaging/MapView.h70
-rw-r--r--cpp/include/qpid/messaging/Message.h61
-rw-r--r--cpp/include/qpid/messaging/Receiver.h8
-rw-r--r--cpp/include/qpid/messaging/Sender.h5
-rw-r--r--cpp/include/qpid/messaging/Session.h8
-rw-r--r--cpp/include/qpid/types/Variant.h5
13 files changed, 122 insertions, 406 deletions
diff --git a/cpp/include/qpid/client/amqp0_10/Codecs.h b/cpp/include/qpid/amqp_0_10/Codecs.h
index 097cf5877f..669b485807 100644
--- a/cpp/include/qpid/client/amqp0_10/Codecs.h
+++ b/cpp/include/qpid/amqp_0_10/Codecs.h
@@ -1,5 +1,5 @@
-#ifndef QPID_CLIENT_AMQP0_10_CODECS_H
-#define QPID_CLIENT_AMQP0_10_CODECS_H
+#ifndef QPID_AMQP_0_10_CODECS_H
+#define QPID_AMQP_0_10_CODECS_H
/*
*
@@ -21,23 +21,23 @@
* under the License.
*
*/
-#include "qpid/messaging/Codec.h"
-
-namespace qpid {
-namespace client {
-namespace amqp0_10 {
+#include "qpid/types/Variant.h"
+namespace qpid {
+namespace framing {
+class FieldTable;
+}
+namespace amqp_0_10 {
/**
* Codec for encoding/decoding a map of Variants using the AMQP 0-10
* map encoding.
*/
-class MapCodec : public qpid::messaging::Codec
+class MapCodec
{
public:
- void encode(const qpid::types::Variant&, std::string&);
- void decode(const std::string&, qpid::types::Variant&);
-
+ static void encode(const qpid::types::Variant::Map&, std::string&);
+ static void decode(const std::string&, qpid::types::Variant::Map&);
static const std::string contentType;
private:
};
@@ -46,16 +46,25 @@ class MapCodec : public qpid::messaging::Codec
* Codec for encoding/decoding a list of Variants using the AMQP 0-10
* list encoding.
*/
-class ListCodec : public qpid::messaging::Codec
+class ListCodec
{
public:
- void encode(const qpid::types::Variant&, std::string&);
- void decode(const std::string&, qpid::types::Variant&);
-
+ static void encode(const qpid::types::Variant::List&, std::string&);
+ static void decode(const std::string&, qpid::types::Variant::List&);
static const std::string contentType;
private:
};
-}}} // namespace qpid::client::amqp0_10
+/**
+ * @internal
+ *
+ * Conversion functions between qpid::types:Variant::Map and the
+ * deprecated qpid::framing::FieldTable.
+ *
+ */
+void translate(const qpid::types::Variant::Map& from, qpid::framing::FieldTable& to);
+void translate(const qpid::framing::FieldTable& from, qpid::types::Variant::Map& to);
+
+}} // namespace qpid::amqp_0_10
-#endif /*!QPID_CLIENT_AMQP0_10_CODECS_H*/
+#endif /*!QPID_AMQP_0_10_CODECS_H*/
diff --git a/cpp/include/qpid/messaging/Address.h b/cpp/include/qpid/messaging/Address.h
index 307e0cfa8d..34a186c9ce 100644
--- a/cpp/include/qpid/messaging/Address.h
+++ b/cpp/include/qpid/messaging/Address.h
@@ -30,11 +30,18 @@
namespace qpid {
namespace messaging {
+/**
+ * Thrown when a syntactically correct address cannot be resolved or
+ * used.
+ */
struct InvalidAddress : public qpid::Exception
{
InvalidAddress(const std::string& msg);
};
+/**
+ * Thrown when an address string with inalid sytanx is used.
+ */
struct MalformedAddress : public qpid::Exception
{
MalformedAddress(const std::string& msg);
@@ -117,6 +124,8 @@ class AddressImpl;
* merely browse the messages. Valid values are 'consume' and
* 'browse'</td></tr>
* </table>
+ *
+ * An address has value semantics.
*/
class Address
{
@@ -132,17 +141,22 @@ class Address
QPID_CLIENT_EXTERN void setName(const std::string&);
QPID_CLIENT_EXTERN const std::string& getSubject() const;
QPID_CLIENT_EXTERN void setSubject(const std::string&);
- QPID_CLIENT_EXTERN bool hasSubject() const;
QPID_CLIENT_EXTERN const qpid::types::Variant::Map& getOptions() const;
QPID_CLIENT_EXTERN qpid::types::Variant::Map& getOptions();
QPID_CLIENT_EXTERN void setOptions(const qpid::types::Variant::Map&);
QPID_CLIENT_EXTERN std::string getType() const;
+ /**
+ * The type of and addressed node influences how receivers and
+ * senders are constructed for it. It also affects how a reply-to
+ * address is encoded. If the type is not specified in the address
+ * itself, it will be automatically determined by querying the
+ * broker. The type can be explicitly set to prevent this if
+ * needed.
+ */
QPID_CLIENT_EXTERN void setType(const std::string&);
- QPID_CLIENT_EXTERN const qpid::types::Variant& getOption(const std::string& key) const;
-
- QPID_CLIENT_EXTERN std::string toStr() const;
+ QPID_CLIENT_EXTERN std::string str() const;
QPID_CLIENT_EXTERN operator bool() const;
QPID_CLIENT_EXTERN bool operator !() const;
private:
diff --git a/cpp/include/qpid/messaging/Codec.h b/cpp/include/qpid/messaging/Codec.h
deleted file mode 100644
index a69baa5af1..0000000000
--- a/cpp/include/qpid/messaging/Codec.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef QPID_MESSAGING_CODEC_H
-#define QPID_MESSAGING_CODEC_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <string>
-#include "qpid/messaging/ImportExport.h"
-
-namespace qpid {
-namespace types{
-class Variant;
-}
-namespace messaging {
-
-/**
- *
- */
-class Codec
-{
- public:
- QPID_CLIENT_EXTERN virtual ~Codec() {}
- virtual void encode(const qpid::types::Variant&, std::string&) = 0;
- virtual void decode(const std::string&, qpid::types::Variant&) = 0;
- private:
-};
-}} // namespace qpid::messaging
-
-#endif /*!QPID_MESSAGING_CODEC_H*/
diff --git a/cpp/include/qpid/messaging/Connection.h b/cpp/include/qpid/messaging/Connection.h
index 24fb9650d8..8b0f9e98e3 100644
--- a/cpp/include/qpid/messaging/Connection.h
+++ b/cpp/include/qpid/messaging/Connection.h
@@ -75,6 +75,12 @@ class Connection : public qpid::messaging::Handle<ConnectionImpl>
* is reached.
*/
QPID_CLIENT_EXTERN Connection(const qpid::types::Variant::Map& options = qpid::types::Variant::Map());
+ /**
+ * Creates a connection using an option string of the form
+ * {name=value,name2=value2...}, see above for options supported.
+ *
+ * @exception InvalidOptionString if the string does not match the correct syntax
+ */
QPID_CLIENT_EXTERN Connection(const std::string& options);
QPID_CLIENT_EXTERN ~Connection();
QPID_CLIENT_EXTERN Connection& operator=(const Connection&);
@@ -86,9 +92,8 @@ class Connection : public qpid::messaging::Handle<ConnectionImpl>
* allowed to go out of scope.
*/
QPID_CLIENT_EXTERN void close();
- QPID_CLIENT_EXTERN Session newSession(bool transactional, const std::string& name = std::string());
- QPID_CLIENT_EXTERN Session newSession(const std::string& name = std::string());
- QPID_CLIENT_EXTERN Session newSession(const char* name);
+ QPID_CLIENT_EXTERN Session createTransactionalSession(const std::string& name = std::string());
+ QPID_CLIENT_EXTERN Session createSession(const std::string& name = std::string());
QPID_CLIENT_EXTERN Session getSession(const std::string& name) const;
private:
diff --git a/cpp/include/qpid/messaging/ListContent.h b/cpp/include/qpid/messaging/ListContent.h
deleted file mode 100644
index 1e7d34af54..0000000000
--- a/cpp/include/qpid/messaging/ListContent.h
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef QPID_MESSAGING_LISTCONTENT_H
-#define QPID_MESSAGING_LISTCONTENT_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/messaging/ImportExport.h"
-#include "qpid/types/Variant.h"
-
-namespace qpid {
-namespace messaging {
-
-class ListContentImpl;
-class Message;
-
-/**
- * Allows message content to be manipulated as a list.
- */
-class ListContent
-{
- public:
- typedef qpid::types::Variant::List::iterator iterator;
- typedef qpid::types::Variant::List::reverse_iterator reverse_iterator;
- typedef qpid::types::Variant::List::const_iterator const_iterator;
- typedef qpid::types::Variant::List::const_reverse_iterator const_reverse_iterator;
-
- QPID_CLIENT_EXTERN ListContent(Message&);
- QPID_CLIENT_EXTERN ListContent(Message&, const qpid::types::Variant::List&);
- QPID_CLIENT_EXTERN ~ListContent();
-
- QPID_CLIENT_EXTERN const_iterator begin() const;
- QPID_CLIENT_EXTERN iterator begin();
- QPID_CLIENT_EXTERN const_iterator end() const;
- QPID_CLIENT_EXTERN iterator end();
- QPID_CLIENT_EXTERN const_reverse_iterator rbegin() const;
- QPID_CLIENT_EXTERN reverse_iterator rbegin();
- QPID_CLIENT_EXTERN const_reverse_iterator rend() const;
- QPID_CLIENT_EXTERN reverse_iterator rend();
-
- QPID_CLIENT_EXTERN bool empty() const;
- QPID_CLIENT_EXTERN size_t size() const;
-
- QPID_CLIENT_EXTERN const qpid::types::Variant& front() const;
- QPID_CLIENT_EXTERN qpid::types::Variant& front();
- QPID_CLIENT_EXTERN const qpid::types::Variant& back() const;
- QPID_CLIENT_EXTERN qpid::types::Variant& back();
-
- QPID_CLIENT_EXTERN void push_front(const qpid::types::Variant&);
- QPID_CLIENT_EXTERN void push_back(const qpid::types::Variant&);
-
- QPID_CLIENT_EXTERN void pop_front();
- QPID_CLIENT_EXTERN void pop_back();
-
- QPID_CLIENT_EXTERN iterator insert(iterator position, const qpid::types::Variant&);
- QPID_CLIENT_EXTERN void insert(iterator position, size_t n, const qpid::types::Variant&);
- QPID_CLIENT_EXTERN iterator erase(iterator position);
- QPID_CLIENT_EXTERN iterator erase(iterator first, iterator last);
- QPID_CLIENT_EXTERN void clear();
-
- QPID_CLIENT_EXTERN void encode();
-
- QPID_CLIENT_EXTERN const qpid::types::Variant::List& asList() const;
- QPID_CLIENT_EXTERN qpid::types::Variant::List& asList();
- private:
- ListContentImpl* impl;
-
- QPID_CLIENT_EXTERN ListContent& operator=(const ListContent&);
-};
-
-QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const ListContent& m);
-
-}} // namespace qpid::messaging
-
-#endif /*!QPID_MESSAGING_LISTCONTENT_H*/
diff --git a/cpp/include/qpid/messaging/ListView.h b/cpp/include/qpid/messaging/ListView.h
deleted file mode 100644
index dce82a657c..0000000000
--- a/cpp/include/qpid/messaging/ListView.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef QPID_MESSAGING_LISTVIEW_H
-#define QPID_MESSAGING_LISTVIEW_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/messaging/ImportExport.h"
-#include "qpid/types/Variant.h"
-
-namespace qpid {
-namespace messaging {
-
-class ListViewImpl;
-class Message;
-
-/**
- * Provides a view of message content as a list
- */
-class ListView
-{
- public:
- typedef qpid::types::Variant::List::const_iterator const_iterator;
- typedef qpid::types::Variant::List::const_reverse_iterator const_reverse_iterator;
-
- QPID_CLIENT_EXTERN ListView(const Message&);
- QPID_CLIENT_EXTERN ~ListView();
- QPID_CLIENT_EXTERN ListView& operator=(const ListView&);
-
- QPID_CLIENT_EXTERN const_iterator begin() const;
- QPID_CLIENT_EXTERN const_iterator end() const;
- QPID_CLIENT_EXTERN const_reverse_iterator rbegin() const;
- QPID_CLIENT_EXTERN const_reverse_iterator rend() const;
-
- QPID_CLIENT_EXTERN bool empty() const;
- QPID_CLIENT_EXTERN size_t size() const;
-
- QPID_CLIENT_EXTERN const qpid::types::Variant& front() const;
- QPID_CLIENT_EXTERN const qpid::types::Variant& back() const;
-
- QPID_CLIENT_EXTERN const qpid::types::Variant::List& asList() const;
- private:
- ListViewImpl* impl;
-};
-
-QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const ListView& m);
-
-}} // namespace qpid::messaging
-
-#endif /*!QPID_MESSAGING_LISTVIEW_H*/
diff --git a/cpp/include/qpid/messaging/MapContent.h b/cpp/include/qpid/messaging/MapContent.h
deleted file mode 100644
index 863eaed786..0000000000
--- a/cpp/include/qpid/messaging/MapContent.h
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef QPID_MESSAGING_MAPCONTENT_H
-#define QPID_MESSAGING_MAPCONTENT_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/messaging/ImportExport.h"
-#include "qpid/types/Variant.h"
-#include <map>
-#include <string>
-
-namespace qpid {
-namespace messaging {
-
-class MapContentImpl;
-class Message;
-
-/**
- * Allows message content to be manipulated as a map
- */
-class MapContent
-{
- public:
- typedef std::string key_type;
- typedef std::pair<std::string, qpid::types::Variant> value_type;
- typedef std::map<key_type, qpid::types::Variant>::const_iterator const_iterator;
- typedef std::map<key_type, qpid::types::Variant>::iterator iterator;
- typedef std::map<key_type, qpid::types::Variant>::const_reverse_iterator const_reverse_iterator;
- typedef std::map<key_type, qpid::types::Variant>::reverse_iterator reverse_iterator;
-
- QPID_CLIENT_EXTERN MapContent(Message&);
- QPID_CLIENT_EXTERN MapContent(Message&, const qpid::types::Variant::Map&);
- QPID_CLIENT_EXTERN ~MapContent();
-
- QPID_CLIENT_EXTERN const_iterator begin() const;
- QPID_CLIENT_EXTERN const_iterator end() const;
- QPID_CLIENT_EXTERN const_reverse_iterator rbegin() const;
- QPID_CLIENT_EXTERN const_reverse_iterator rend() const;
- QPID_CLIENT_EXTERN iterator begin();
- QPID_CLIENT_EXTERN iterator end();
- QPID_CLIENT_EXTERN reverse_iterator rbegin();
- QPID_CLIENT_EXTERN reverse_iterator rend();
-
- QPID_CLIENT_EXTERN bool empty() const;
- QPID_CLIENT_EXTERN size_t size() const;
-
- QPID_CLIENT_EXTERN const_iterator find(const key_type&) const;
- QPID_CLIENT_EXTERN iterator find(const key_type&);
- QPID_CLIENT_EXTERN const qpid::types::Variant& operator[](const key_type&) const;
- QPID_CLIENT_EXTERN qpid::types::Variant& operator[](const key_type&);
-
- QPID_CLIENT_EXTERN std::pair<iterator,bool> insert(const value_type&);
- QPID_CLIENT_EXTERN iterator insert(iterator position, const value_type&);
- QPID_CLIENT_EXTERN void erase(iterator position);
- QPID_CLIENT_EXTERN void erase(iterator first, iterator last);
- QPID_CLIENT_EXTERN size_t erase(const key_type&);
- QPID_CLIENT_EXTERN void clear();
-
- QPID_CLIENT_EXTERN void encode();
-
- QPID_CLIENT_EXTERN const std::map<key_type, qpid::types::Variant>& asMap() const;
- QPID_CLIENT_EXTERN std::map<key_type, qpid::types::Variant>& asMap();
- private:
- MapContentImpl* impl;
-
- QPID_CLIENT_EXTERN MapContent& operator=(const MapContent&);
-};
-
-QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const MapContent& m);
-
-}} // namespace qpid::messaging
-
-#endif /*!QPID_MESSAGING_MAPCONTENT_H*/
diff --git a/cpp/include/qpid/messaging/MapView.h b/cpp/include/qpid/messaging/MapView.h
deleted file mode 100644
index e359a9d929..0000000000
--- a/cpp/include/qpid/messaging/MapView.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef QPID_MESSAGING_MAPVIEW_H
-#define QPID_MESSAGING_MAPVIEW_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/messaging/ImportExport.h"
-#include "qpid/types/Variant.h"
-#include <map>
-#include <string>
-
-namespace qpid {
-namespace messaging {
-
-class MapViewImpl;
-class Message;
-
-/**
- * Provides a view of message content as a list
- */
-class MapView
-{
- public:
- typedef std::string key_type;
- typedef std::pair<key_type, qpid::types::Variant> value_type;
- typedef std::map<key_type, qpid::types::Variant>::const_iterator const_iterator;
- typedef std::map<key_type, qpid::types::Variant>::const_reverse_iterator const_reverse_iterator;
-
- QPID_CLIENT_EXTERN MapView(const Message&);
- QPID_CLIENT_EXTERN ~MapView();
- QPID_CLIENT_EXTERN MapView& operator=(const MapView&);
-
- QPID_CLIENT_EXTERN const_iterator begin() const;
- QPID_CLIENT_EXTERN const_iterator end() const;
- QPID_CLIENT_EXTERN const_reverse_iterator rbegin() const;
- QPID_CLIENT_EXTERN const_reverse_iterator rend() const;
-
- QPID_CLIENT_EXTERN bool empty() const;
- QPID_CLIENT_EXTERN size_t size() const;
-
- QPID_CLIENT_EXTERN const_iterator find(const key_type&) const;
- QPID_CLIENT_EXTERN const qpid::types::Variant& operator[](const key_type&) const;
-
- QPID_CLIENT_EXTERN const std::map<key_type, qpid::types::Variant>& asMap() const;
- private:
- MapViewImpl* impl;
-};
-
-QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const MapView& m);
-
-}} // namespace qpid::messaging
-
-#endif /*!QPID_MESSAGING_MAPVIEW_H*/
diff --git a/cpp/include/qpid/messaging/Message.h b/cpp/include/qpid/messaging/Message.h
index d7b2622d08..ce7691edc1 100644
--- a/cpp/include/qpid/messaging/Message.h
+++ b/cpp/include/qpid/messaging/Message.h
@@ -23,6 +23,7 @@
*/
#include <string>
+#include "qpid/Exception.h"
#include "qpid/messaging/Duration.h"
#include "qpid/types/Variant.h"
#include "qpid/messaging/ImportExport.h"
@@ -86,17 +87,69 @@ class Message
QPID_CLIENT_EXTERN const qpid::types::Variant::Map& getProperties() const;
QPID_CLIENT_EXTERN qpid::types::Variant::Map& getProperties();
- QPID_CLIENT_EXTERN const std::string& getContent() const;
- QPID_CLIENT_EXTERN std::string& getContent();
-
QPID_CLIENT_EXTERN void setContent(const std::string&);
+ /**
+ * Note that chars are copied.
+ */
QPID_CLIENT_EXTERN void setContent(const char* chars, size_t count);
- QPID_CLIENT_EXTERN void getContent(std::pair<const char*, size_t>& content) const;
+ /** Get the content as a std::string */
+ QPID_CLIENT_EXTERN std::string getContent() const;
+ /** Get a const pointer to the start of the content data. */
+ QPID_CLIENT_EXTERN const char* getContentPtr() const;
+ /** Get the size of content in bytes. */
+ QPID_CLIENT_EXTERN size_t getContentSize() const;
private:
MessageImpl* impl;
friend struct MessageImplAccess;
};
+
+struct EncodingException : qpid::Exception
+{
+ EncodingException(const std::string& msg);
+};
+
+/**
+ * Decodes message content into a Variant::Map.
+ *
+ * @param message the message whose content should be decoded
+ * @param map the map into which the message contents will be decoded
+ * @param encoding if specified, the encoding to use - this overrides
+ * any encoding specified by the content-type of the message
+ * @exception EncodingException
+ */
+void decode(const Message& message, qpid::types::Variant::Map& map, const std::string& encoding = std::string());
+/**
+ * Decodes message content into a Variant::List.
+ *
+ * @param message the message whose content should be decoded
+ * @param list the list into which the message contents will be decoded
+ * @param encoding if specified, the encoding to use - this overrides
+ * any encoding specified by the content-type of the message
+ * @exception EncodingException
+ */
+void decode(const Message& message, qpid::types::Variant::List& list, const std::string& encoding = std::string());
+/**
+ * Encodes a Variant::Map into a message.
+ *
+ * @param map the map to be encoded
+ * @param message the message whose content should be set to the encoded map
+ * @param encoding if specified, the encoding to use - this overrides
+ * any encoding specified by the content-type of the message
+ * @exception EncodingException
+ */
+void encode(const qpid::types::Variant::Map& map, Message& message, const std::string& encoding = std::string());
+/**
+ * Encodes a Variant::List into a message.
+ *
+ * @param list the list to be encoded
+ * @param message the message whose content should be set to the encoded list
+ * @param encoding if specified, the encoding to use - this overrides
+ * any encoding specified by the content-type of the message
+ * @exception EncodingException
+ */
+void encode(const qpid::types::Variant::List& list, Message& message, const std::string& encoding = std::string());
+
}} // namespace qpid::messaging
#endif /*!QPID_MESSAGING_MESSAGE_H*/
diff --git a/cpp/include/qpid/messaging/Receiver.h b/cpp/include/qpid/messaging/Receiver.h
index 48b0b78754..d89813acfc 100644
--- a/cpp/include/qpid/messaging/Receiver.h
+++ b/cpp/include/qpid/messaging/Receiver.h
@@ -59,7 +59,7 @@ class Receiver : public qpid::messaging::Handle<ReceiverImpl>
* for up to the specified timeout for a message to become
* available.
*
- *@exception NoMessageAvailable if there is no message to give
+ * @exception NoMessageAvailable if there is no message to give
* after waiting for the specified timeout.
*/
QPID_CLIENT_EXTERN Message get(Duration timeout=Duration::FOREVER);
@@ -78,7 +78,7 @@ class Receiver : public qpid::messaging::Handle<ReceiverImpl>
* that there is no message for the subscription this receiver is
* serving before throwing an exception.
*
- *@exception NoMessageAvailable if there is no message to give
+ * @exception NoMessageAvailable if there is no message to give
* after waiting for the specified timeout.
*/
QPID_CLIENT_EXTERN Message fetch(Duration timeout=Duration::FOREVER);
@@ -99,14 +99,14 @@ class Receiver : public qpid::messaging::Handle<ReceiverImpl>
* Returns the number of messages received and waiting to be
* fetched.
*/
- QPID_CLIENT_EXTERN uint32_t available();
+ QPID_CLIENT_EXTERN uint32_t getAvailable();
/**
* Returns a count of the number of messages received on this
* receiver that have been acknowledged, but for which that
* acknowledgement has not yet been confirmed as processed by the
* server.
*/
- QPID_CLIENT_EXTERN uint32_t pendingAck();
+ QPID_CLIENT_EXTERN uint32_t getPendingAck();
/**
* Cancels this receiver.
diff --git a/cpp/include/qpid/messaging/Sender.h b/cpp/include/qpid/messaging/Sender.h
index b7dd015a55..66a7b1fe37 100644
--- a/cpp/include/qpid/messaging/Sender.h
+++ b/cpp/include/qpid/messaging/Sender.h
@@ -44,6 +44,9 @@ class Sender : public qpid::messaging::Handle<SenderImpl>
QPID_CLIENT_EXTERN ~Sender();
QPID_CLIENT_EXTERN Sender& operator=(const Sender&);
+ /**
+ * Sends a message; will block if the pending == capacity
+ */
QPID_CLIENT_EXTERN void send(const Message& message);
QPID_CLIENT_EXTERN void close();
@@ -62,7 +65,7 @@ class Sender : public qpid::messaging::Handle<SenderImpl>
* Returns the number of sent messages pending confirmation of
* receipt by the broker. (These are the 'in-doubt' messages).
*/
- QPID_CLIENT_EXTERN uint32_t pending();
+ QPID_CLIENT_EXTERN uint32_t getPending();
/**
* Returns the name of this sender.
diff --git a/cpp/include/qpid/messaging/Session.h b/cpp/include/qpid/messaging/Session.h
index eaecb69260..75bbe409ff 100644
--- a/cpp/include/qpid/messaging/Session.h
+++ b/cpp/include/qpid/messaging/Session.h
@@ -87,13 +87,13 @@ class Session : public qpid::messaging::Handle<SessionImpl>
* Returns the total number of messages received and waiting to be
* fetched by all Receivers belonging to this session.
*/
- QPID_CLIENT_EXTERN uint32_t available();
+ QPID_CLIENT_EXTERN uint32_t getAvailable();
/**
* Returns a count of the number of messages received this session
* that have been acknowledged, but for which that acknowledgement
* has not yet been confirmed as processed by the server.
*/
- QPID_CLIENT_EXTERN uint32_t pendingAck();
+ QPID_CLIENT_EXTERN uint32_t getPendingAck();
/**
* Retrieves the receiver for the next available message. If there
* are no available messages at present the call will block for up
@@ -108,8 +108,8 @@ class Session : public qpid::messaging::Handle<SessionImpl>
* are no available messages at present the call will block for up
* to the specified timeout waiting for one to arrive.
*
- *@exception Receiver::NoMessageAvailable if no message became available in
- * time.
+ * @exception Receiver::NoMessageAvailable if no message became
+ * available in time.
*/
QPID_CLIENT_EXTERN Receiver nextReceiver(Duration timeout=Duration::FOREVER);
diff --git a/cpp/include/qpid/types/Variant.h b/cpp/include/qpid/types/Variant.h
index f57adcd31e..91e37242d0 100644
--- a/cpp/include/qpid/types/Variant.h
+++ b/cpp/include/qpid/types/Variant.h
@@ -138,7 +138,7 @@ class Variant
QPID_COMMON_EXTERN operator int64_t() const;
QPID_COMMON_EXTERN operator float() const;
QPID_COMMON_EXTERN operator double() const;
- QPID_COMMON_EXTERN operator const char*() const;
+ QPID_COMMON_EXTERN operator std::string() const;
QPID_COMMON_EXTERN operator Uuid() const;
QPID_COMMON_EXTERN const Map& asMap() const;
@@ -166,9 +166,6 @@ QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& out, const Variant& va
QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& out, const Variant::Map& map);
QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& out, const Variant::List& list);
QPID_COMMON_EXTERN bool operator==(const Variant& a, const Variant& b);
-
-typedef Variant::Map VariantMap;
-
}} // namespace qpid::types
#endif /*!QPID_TYPES_VARIANT_H*/