qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject [2/3] qpid-proton git commit: PROTON-1153: [C++ binding] Change message member names: - address -> to (retaining address as an alias) - application_properties -> properties
Date Fri, 15 Apr 2016 21:23:43 GMT
PROTON-1153: [C++ binding] Change message member names:
- address -> to (retaining address as an alias)
- application_properties -> properties


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/9be087df
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/9be087df
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/9be087df

Branch: refs/heads/master
Commit: 9be087df797229fb025d6d9cdd96ca1051d15596
Parents: e826d85
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Fri Apr 15 16:53:06 2016 -0400
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Fri Apr 15 16:53:06 2016 -0400

----------------------------------------------------------------------
 examples/cpp/engine/server.cpp                  |  2 +-
 examples/cpp/server.cpp                         |  2 +-
 examples/cpp/server_direct.cpp                  |  2 +-
 .../bindings/cpp/include/proton/message.hpp     |  8 ++++++--
 proton-c/bindings/cpp/src/message.cpp           | 17 +++++++++++++----
 proton-c/bindings/cpp/src/message_test.cpp      | 20 ++++++++++----------
 6 files changed, 32 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9be087df/examples/cpp/engine/server.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/server.cpp b/examples/cpp/engine/server.cpp
index 336dbb3..31f3599 100644
--- a/examples/cpp/engine/server.cpp
+++ b/examples/cpp/engine/server.cpp
@@ -62,7 +62,7 @@ class server : public proton::handler {
         std::cout << "Received " << m.body() << std::endl;
         std::string reply_to = m.reply_to();
         proton::message reply;
-        reply.address(reply_to);
+        reply.to(reply_to);
         reply.body(to_upper(proton::get<std::string>(m.body())));
         reply.correlation_id(m.correlation_id());
         if (!senders[reply_to])

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9be087df/examples/cpp/server.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/server.cpp b/examples/cpp/server.cpp
index eb4cc7a..370c33b 100644
--- a/examples/cpp/server.cpp
+++ b/examples/cpp/server.cpp
@@ -66,7 +66,7 @@ class server : public proton::handler {
         std::string reply_to = m.reply_to();
         proton::message reply;
 
-        reply.address(reply_to);
+        reply.to(reply_to);
         reply.body(to_upper(proton::get<std::string>(m.body())));
         reply.correlation_id(m.correlation_id());
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9be087df/examples/cpp/server_direct.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/server_direct.cpp b/examples/cpp/server_direct.cpp
index 76b8625..a72d246 100644
--- a/examples/cpp/server_direct.cpp
+++ b/examples/cpp/server_direct.cpp
@@ -86,7 +86,7 @@ class server : public proton::handler {
             proton::sender sender = it->second;
             proton::message reply;
 
-            reply.address(reply_to);
+            reply.to(reply_to);
             reply.body(to_upper(proton::get<std::string>(m.body())));
             reply.correlation_id(m.correlation_id());
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9be087df/proton-c/bindings/cpp/include/proton/message.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/message.hpp b/proton-c/bindings/cpp/include/proton/message.hpp
index 2bba148..3bf345a 100644
--- a/proton-c/bindings/cpp/include/proton/message.hpp
+++ b/proton-c/bindings/cpp/include/proton/message.hpp
@@ -108,6 +108,10 @@ class message {
     /// @name Routing
     /// @{
 
+    PN_CPP_EXTERN void to(const std::string &addr);
+    PN_CPP_EXTERN std::string to() const;
+
+    /// These are aliases for to()
     PN_CPP_EXTERN void address(const std::string &addr);
     PN_CPP_EXTERN std::string address() const;
 
@@ -245,8 +249,8 @@ class message {
     /// @{
 
     /// Application properties map, can be modified in place.
-    PN_CPP_EXTERN property_map& application_properties();
-    PN_CPP_EXTERN const property_map& application_properties() const;
+    PN_CPP_EXTERN property_map& properties();
+    PN_CPP_EXTERN const property_map& properties() const;
 
     /// Message annotations map, can be modified in place.
     PN_CPP_EXTERN annotation_map& message_annotations();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9be087df/proton-c/bindings/cpp/src/message.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/message.cpp b/proton-c/bindings/cpp/src/message.cpp
index d1ba2ee..d53ea56 100644
--- a/proton-c/bindings/cpp/src/message.cpp
+++ b/proton-c/bindings/cpp/src/message.cpp
@@ -101,15 +101,24 @@ std::string message::user_id() const {
     return str(pn_message_get_user_id(pn_msg()));
 }
 
-void message::address(const std::string &addr) {
+void message::to(const std::string &addr) {
     check(pn_message_set_address(pn_msg(), addr.c_str()));
 }
 
-std::string message::address() const {
+std::string message::to() const {
     const char* addr = pn_message_get_address(pn_msg());
     return addr ? std::string(addr) : std::string();
 }
 
+void message::address(const std::string &addr) {
+  check(pn_message_set_address(pn_msg(), addr.c_str()));
+}
+
+std::string message::address() const {
+  const char* addr = pn_message_get_address(pn_msg());
+  return addr ? std::string(addr) : std::string();
+}
+
 void message::subject(const std::string &s) {
     check(pn_message_set_subject(pn_msg(), s.c_str()));
 }
@@ -222,11 +231,11 @@ template<class M> M& put_map(pn_message_t* msg, pn_data_t*
(*get)(pn_message_t*)
     return map;
 }
 
-message::property_map& message::application_properties() {
+message::property_map& message::properties() {
     return get_map(pn_msg(), pn_message_properties, application_properties_);
 }
 
-const message::property_map& message::application_properties() const {
+const message::property_map& message::properties() const {
     return get_map(pn_msg(), pn_message_properties, application_properties_);
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9be087df/proton-c/bindings/cpp/src/message_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/message_test.cpp b/proton-c/bindings/cpp/src/message_test.cpp
index bfdbb06..d999970 100644
--- a/proton-c/bindings/cpp/src/message_test.cpp
+++ b/proton-c/bindings/cpp/src/message_test.cpp
@@ -45,7 +45,7 @@ void test_message_properties() {
 
     CHECK_MESSAGE_ID(id);
     CHECK_STR(user_id);
-    CHECK_STR(address);
+    CHECK_STR(to);
     CHECK_STR(subject);
     CHECK_STR(reply_to);
     CHECK_MESSAGE_ID(correlation_id);
@@ -62,7 +62,7 @@ void test_message_properties() {
     ASSERT_EQUAL("hello", get<std::string>(m2.body()));
     ASSERT_EQUAL(message_id("id"), m2.id());
     ASSERT_EQUAL("user_id", m2.user_id());
-    ASSERT_EQUAL("address", m2.address());
+    ASSERT_EQUAL("to", m2.to());
     ASSERT_EQUAL("subject", m2.subject());
     ASSERT_EQUAL("reply_to", m2.reply_to());
     ASSERT_EQUAL(message_id("correlation_id"), m2.correlation_id());
@@ -77,7 +77,7 @@ void test_message_properties() {
     ASSERT_EQUAL("hello", get<std::string>(m2.body()));
     ASSERT_EQUAL(message_id("id"), m2.id());
     ASSERT_EQUAL("user_id", m2.user_id());
-    ASSERT_EQUAL("address", m2.address());
+    ASSERT_EQUAL("to", m2.to());
     ASSERT_EQUAL("subject", m2.subject());
     ASSERT_EQUAL("reply_to", m2.reply_to());
     ASSERT_EQUAL(message_id("correlation_id"), m2.correlation_id());
@@ -105,32 +105,32 @@ void test_message_body() {
 void test_message_maps() {
     message m;
 
-    ASSERT(m.application_properties().empty());
+    ASSERT(m.properties().empty());
     ASSERT(m.message_annotations().empty());
     ASSERT(m.delivery_annotations().empty());
 
-    m.application_properties()["foo"] = 12;
+    m.properties()["foo"] = 12;
     m.delivery_annotations()["bar"] = "xyz";
 
     m.message_annotations()[23] = "23";
-    ASSERT_EQUAL(m.application_properties()["foo"], scalar(12));
+    ASSERT_EQUAL(m.properties()["foo"], scalar(12));
     ASSERT_EQUAL(m.delivery_annotations()["bar"], scalar("xyz"));
     ASSERT_EQUAL(m.message_annotations()[23], scalar("23"));
 
     message m2(m);
     message::annotation_map& amap = m2.delivery_annotations();
 
-    ASSERT_EQUAL(m2.application_properties()["foo"], scalar(12));
+    ASSERT_EQUAL(m2.properties()["foo"], scalar(12));
     ASSERT_EQUAL(m2.delivery_annotations()["bar"], scalar("xyz"));
     ASSERT_EQUAL(m2.message_annotations()[23], scalar("23"));
 
-    m.application_properties()["foo"] = "newfoo";
+    m.properties()["foo"] = "newfoo";
     m.delivery_annotations()[24] = 1000;
     m.message_annotations().erase(23);
 
     m2 = m;
-    ASSERT_EQUAL(1, m2.application_properties().size());
-    ASSERT_EQUAL(m2.application_properties()["foo"], scalar("newfoo"));
+    ASSERT_EQUAL(1, m2.properties().size());
+    ASSERT_EQUAL(m2.properties()["foo"], scalar("newfoo"));
     ASSERT_EQUAL(2, m2.delivery_annotations().size());
     ASSERT_EQUAL(m2.delivery_annotations()["bar"], scalar("xyz"));
     ASSERT_EQUAL(m2.delivery_annotations()[24], scalar(1000));


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message