You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2016/05/13 01:28:43 UTC

qpid-proton git commit: PROTON-1197: [C++ binding] Ensure that symbol export for members is consistent with access - Usually only public members should have exported symbols. - This also pointed out a number of completely unused update functions in the *

Repository: qpid-proton
Updated Branches:
  refs/heads/master be69853b9 -> 772fd54f2


PROTON-1197: [C++ binding] Ensure that symbol export for members is consistent with access
- Usually only public members should have exported symbols.
- This also pointed out a number of completely unused update functions in the *_options
  code that was private.


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

Branch: refs/heads/master
Commit: 772fd54f299251e53b7469df4c415cc5d46d3082
Parents: be69853
Author: Andrew Stitcher <as...@apache.org>
Authored: Fri May 13 02:20:45 2016 +0100
Committer: Andrew Stitcher <as...@apache.org>
Committed: Fri May 13 02:20:45 2016 +0100

----------------------------------------------------------------------
 proton-c/bindings/cpp/include/proton/data.hpp   | 25 ++++++++++---------
 .../cpp/include/proton/session_options.hpp      |  1 -
 .../cpp/include/proton/source_options.hpp       |  1 -
 .../cpp/include/proton/target_options.hpp       |  1 -
 proton-c/bindings/cpp/src/data.cpp              |  2 --
 proton-c/bindings/cpp/src/error_condition.cpp   |  2 +-
 proton-c/bindings/cpp/src/message.cpp           | 10 ++++----
 proton-c/bindings/cpp/src/node_options.cpp      | 26 +-------------------
 proton-c/bindings/cpp/src/proton_bits.hpp       |  4 +++
 proton-c/bindings/cpp/src/session_options.cpp   |  6 -----
 proton-c/bindings/cpp/src/source.cpp            |  2 +-
 proton-c/bindings/cpp/src/terminus.cpp          |  2 +-
 12 files changed, 27 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/772fd54f/proton-c/bindings/cpp/include/proton/data.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/data.hpp b/proton-c/bindings/cpp/include/proton/data.hpp
index 2dadd51..d305693 100644
--- a/proton-c/bindings/cpp/include/proton/data.hpp
+++ b/proton-c/bindings/cpp/include/proton/data.hpp
@@ -42,9 +42,11 @@ namespace codec {
 
 /// Wrapper for a proton data object.
 class data : public internal::object<pn_data_t> {
-  public:
     /// Wrap an existing proton-C data object.
-    data(pn_data_t* d=0) : internal::object<pn_data_t>(d) {}
+    data(pn_data_t* d) : internal::object<pn_data_t>(d) {}
+
+  public:
+    data() : internal::object<pn_data_t>(0) {}
 
     /// Create a new data object.
     PN_CPP_EXTERN static data create();
@@ -67,14 +69,15 @@ class data : public internal::object<pn_data_t> {
     /// Append up to limit items from data object.
     PN_CPP_EXTERN int appendn(data src, int limit);
 
-  protected:
+    PN_CPP_EXTERN bool next();
     PN_CPP_EXTERN void* point() const;
     PN_CPP_EXTERN void restore(void* h);
-    PN_CPP_EXTERN void narrow();
-    PN_CPP_EXTERN void widen();
-    PN_CPP_EXTERN bool next();
-    PN_CPP_EXTERN bool prev();
 
+  protected:
+    void narrow();
+    void widen();
+
+  friend class internal::factory<data>;
   friend struct state_guard;
   friend PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const data&);
 };
@@ -101,10 +104,10 @@ struct start {
     bool is_described;       ///< true if first value is a descriptor.
     size_t size;             ///< the element count excluding the descriptor (if any)
 
-    PN_CPP_EXTERN static start array(type_id element, bool described=false) { return start(ARRAY, element, described); }
-    PN_CPP_EXTERN static start list() { return start(LIST); }
-    PN_CPP_EXTERN static start map() { return start(MAP); }
-    PN_CPP_EXTERN static start described() { return start(DESCRIBED, NULL_TYPE, true); }
+    static start array(type_id element, bool described=false) { return start(ARRAY, element, described); }
+    static start list() { return start(LIST); }
+    static start map() { return start(MAP); }
+    static start described() { return start(DESCRIBED, NULL_TYPE, true); }
 };
 
 // Finish inserting or extracting a complex type.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/772fd54f/proton-c/bindings/cpp/include/proton/session_options.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/session_options.hpp b/proton-c/bindings/cpp/include/proton/session_options.hpp
index 182f5ff..0711022 100644
--- a/proton-c/bindings/cpp/include/proton/session_options.hpp
+++ b/proton-c/bindings/cpp/include/proton/session_options.hpp
@@ -61,7 +61,6 @@ class session_options {
     // Other useful session configuration TBD.
   private:
     void apply(session&) const;
-    PN_CPP_EXTERN void update(const session_options& other);
 
     class impl;
     internal::pn_unique_ptr<impl> impl_;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/772fd54f/proton-c/bindings/cpp/include/proton/source_options.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/source_options.hpp b/proton-c/bindings/cpp/include/proton/source_options.hpp
index 0a1d280..0312d06 100644
--- a/proton-c/bindings/cpp/include/proton/source_options.hpp
+++ b/proton-c/bindings/cpp/include/proton/source_options.hpp
@@ -83,7 +83,6 @@ class source_options {
     /// @cond INTERNAL
   private:
     void apply(source&) const;
-    PN_CPP_EXTERN void update(const source_options& other);
 
     class impl;
     internal::pn_unique_ptr<impl> impl_;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/772fd54f/proton-c/bindings/cpp/include/proton/target_options.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/target_options.hpp b/proton-c/bindings/cpp/include/proton/target_options.hpp
index 8863598..bafc363 100644
--- a/proton-c/bindings/cpp/include/proton/target_options.hpp
+++ b/proton-c/bindings/cpp/include/proton/target_options.hpp
@@ -78,7 +78,6 @@ class target_options {
     /// @cond INTERNAL
   private:
     void apply(target&) const;
-    PN_CPP_EXTERN void update(const target_options& other);
 
     class impl;
     internal::pn_unique_ptr<impl> impl_;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/772fd54f/proton-c/bindings/cpp/src/data.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/data.cpp b/proton-c/bindings/cpp/src/data.cpp
index 5bbf743..26583af 100644
--- a/proton-c/bindings/cpp/src/data.cpp
+++ b/proton-c/bindings/cpp/src/data.cpp
@@ -59,8 +59,6 @@ int data::appendn(data src, int limit) { return pn_data_appendn(pn_object(), src
 
 bool data::next() { return pn_data_next(pn_object()); }
 
-bool data::prev() { return pn_data_prev(pn_object()); }
-
 std::ostream& operator<<(std::ostream& o, const data& d) {
     state_guard sg(const_cast<data&>(d));
     const_cast<data&>(d).rewind();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/772fd54f/proton-c/bindings/cpp/src/error_condition.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/error_condition.cpp b/proton-c/bindings/cpp/src/error_condition.cpp
index 1596d59..bce21a3 100644
--- a/proton-c/bindings/cpp/src/error_condition.cpp
+++ b/proton-c/bindings/cpp/src/error_condition.cpp
@@ -28,7 +28,7 @@ namespace proton {
 error_condition::error_condition(pn_condition_t* c) :
     name_(str(pn_condition_get_name(c))),
     description_(str(pn_condition_get_description(c))),
-    properties_(pn_condition_info(c))
+    properties_(make_wrapper(pn_condition_info(c)))
 {}
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/772fd54f/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 98015d8..291b106 100644
--- a/proton-c/bindings/cpp/src/message.cpp
+++ b/proton-c/bindings/cpp/src/message.cpp
@@ -54,7 +54,7 @@ message& message::operator=(message&& m) {
 message::message(const value& x) : pn_msg_(0) { body() = x; }
 
 message::~message() {
-    body_.data_ = codec::data(0);      // Must release body before pn_message_free
+    body_.data_ = codec::data();      // Must release body before pn_message_free
     pn_message_free(pn_msg_);
 }
 
@@ -69,7 +69,7 @@ void swap(message& x, message& y) {
 
 pn_message_t *message::pn_msg() const {
     if (!pn_msg_) pn_msg_ = pn_message();
-    body_.data_ = pn_message_body(pn_msg_);
+    body_.data_ = make_wrapper(pn_message_body(pn_msg_));
     return pn_msg_;
 }
 
@@ -142,7 +142,7 @@ std::string message::reply_to() const {
 }
 
 void message::correlation_id(const message_id& id) {
-    codec::encoder e(pn_message_correlation_id(pn_msg()));
+    codec::encoder e(make_wrapper(pn_message_correlation_id(pn_msg())));
     e << id;
 }
 
@@ -216,7 +216,7 @@ value& message::body() { pn_msg(); return body_; }
 
 // Decode a map on demand
 template<class M> M& get_map(pn_message_t* msg, pn_data_t* (*get)(pn_message_t*), M& map) {
-    codec::decoder d(get(msg));
+    codec::decoder d(make_wrapper(get(msg)));
     if (map.empty() && !d.empty()) {
         d.rewind();
         d >> map;
@@ -227,7 +227,7 @@ template<class M> M& get_map(pn_message_t* msg, pn_data_t* (*get)(pn_message_t*)
 
 // Encode a map if necessary.
 template<class M> M& put_map(pn_message_t* msg, pn_data_t* (*get)(pn_message_t*), M& map) {
-    codec::encoder e(get(msg));
+    codec::encoder e(make_wrapper(get(msg)));
     if (e.empty() && !map.empty()) {
         e << map;
         map.clear();            // The encoded pn_data_t  is now the authority.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/772fd54f/proton-c/bindings/cpp/src/node_options.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/node_options.cpp b/proton-c/bindings/cpp/src/node_options.cpp
index 1053560..5bb2f8e 100644
--- a/proton-c/bindings/cpp/src/node_options.cpp
+++ b/proton-c/bindings/cpp/src/node_options.cpp
@@ -103,21 +103,10 @@ class source_options::impl {
           pn_terminus_set_distribution_mode(unwrap(s), pn_distribution_mode_t(distribution_mode.value));
         if (filters.set && !filters.value.empty()) {
             // Applied at most once via source_option.  No need to clear.
-            codec::encoder e(pn_terminus_filter(unwrap(s)));
+            codec::encoder e(make_wrapper(pn_terminus_filter(unwrap(s))));
             e << filters.value;
         }
     }
-
-    void update(const impl& x) {
-        address.update(x.address);
-        dynamic.update(x.dynamic);
-        durability_mode.update(x.durability_mode);
-        timeout.update(x.timeout);
-        expiry_policy.update(x.expiry_policy);
-        distribution_mode.update(x.distribution_mode);
-        filters.update(x.filters);
-    }
-
 };
 
 source_options::source_options() : impl_(new impl()) {}
@@ -131,8 +120,6 @@ source_options& source_options::operator=(const source_options& x) {
     return *this;
 }
 
-void source_options::update(const source_options& x) { impl_->update(*x.impl_); }
-
 source_options& source_options::address(const std::string &addr) { impl_->address = addr; return *this; }
 source_options& source_options::dynamic(bool b) { impl_->dynamic = b; return *this; }
 source_options& source_options::durability_mode(enum source::durability_mode m) { impl_->durability_mode = m; return *this; }
@@ -158,15 +145,6 @@ class target_options::impl {
         node_durability(t, durability_mode);
         node_expiry(t, expiry_policy, timeout);
     }
-
-    void update(const impl& x) {
-        address.update(x.address);
-        dynamic.update(x.dynamic);
-        durability_mode.update(x.durability_mode);
-        timeout.update(x.timeout);
-        expiry_policy.update(x.expiry_policy);
-    }
-
 };
 
 target_options::target_options() : impl_(new impl()) {}
@@ -180,8 +158,6 @@ target_options& target_options::operator=(const target_options& x) {
     return *this;
 }
 
-void target_options::update(const target_options& x) { impl_->update(*x.impl_); }
-
 target_options& target_options::address(const std::string &addr) { impl_->address = addr; return *this; }
 target_options& target_options::dynamic(bool b) { impl_->dynamic = b; return *this; }
 target_options& target_options::durability_mode(enum target::durability_mode m) { impl_->durability_mode = m; return *this; }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/772fd54f/proton-c/bindings/cpp/src/proton_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.hpp b/proton-c/bindings/cpp/src/proton_bits.hpp
index 2a5362c..6b4a295 100644
--- a/proton-c/bindings/cpp/src/proton_bits.hpp
+++ b/proton-c/bindings/cpp/src/proton_bits.hpp
@@ -29,6 +29,7 @@
 
 struct pn_error_t;
 
+struct pn_data_t;
 struct pn_transport_t;
 struct pn_sasl_t;
 struct pn_ssl_t;
@@ -43,6 +44,7 @@ struct pn_reactor_t;
 
 namespace proton {
 
+namespace codec { class data; }
 class transport;
 class sasl;
 class ssl;
@@ -81,6 +83,7 @@ namespace internal {
 
 // These traits relate the wrapped and wrapper classes for the templated factories below
 template <class T> struct wrapped {};
+template <> struct wrapped<codec::data> { typedef pn_data_t type; };
 template <> struct wrapped<transport> { typedef pn_transport_t type; };
 template <> struct wrapped<sasl> { typedef pn_sasl_t type; };
 template <> struct wrapped<ssl> { typedef pn_ssl_t type; };
@@ -100,6 +103,7 @@ template <> struct wrapped<target> { typedef pn_terminus_t type; };
 template <> struct wrapped<reactor> { typedef pn_reactor_t type; };
 
 template <class T> struct wrapper {};
+template <> struct wrapper<pn_data_t> { typedef codec::data type; };
 template <> struct wrapper<pn_transport_t> { typedef transport type; };
 template <> struct wrapper<pn_sasl_t> { typedef sasl type; };
 template <> struct wrapper<pn_ssl_t> { typedef ssl type; };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/772fd54f/proton-c/bindings/cpp/src/session_options.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/session_options.cpp b/proton-c/bindings/cpp/src/session_options.cpp
index e95884b..9f77d6b 100644
--- a/proton-c/bindings/cpp/src/session_options.cpp
+++ b/proton-c/bindings/cpp/src/session_options.cpp
@@ -55,10 +55,6 @@ class session_options::impl {
         }
     }
 
-    void update(const impl& x) {
-        handler.update(x.handler);
-    }
-
 };
 
 session_options::session_options() : impl_(new impl()) {}
@@ -72,8 +68,6 @@ session_options& session_options::operator=(const session_options& x) {
     return *this;
 }
 
-void session_options::update(const session_options& x) { impl_->update(*x.impl_); }
-
 session_options& session_options::handler(class handler *h) { impl_->handler = h->messaging_adapter_.get(); return *this; }
 
 void session_options::apply(session& s) const { impl_->apply(s); }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/772fd54f/proton-c/bindings/cpp/src/source.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/source.cpp b/proton-c/bindings/cpp/src/source.cpp
index 1c9a5bd..a407d0b 100644
--- a/proton-c/bindings/cpp/src/source.cpp
+++ b/proton-c/bindings/cpp/src/source.cpp
@@ -48,7 +48,7 @@ enum source::distribution_mode source::distribution_mode() const {
 }
 
 source::filter_map source::filters() const {
-    codec::decoder d(pn_terminus_filter(object_));
+    codec::decoder d(make_wrapper(pn_terminus_filter(object_)));
     filter_map map;
     if (!d.empty()) {
         d.rewind();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/772fd54f/proton-c/bindings/cpp/src/terminus.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/terminus.cpp b/proton-c/bindings/cpp/src/terminus.cpp
index 138a42c..75ac64a 100644
--- a/proton-c/bindings/cpp/src/terminus.cpp
+++ b/proton-c/bindings/cpp/src/terminus.cpp
@@ -49,7 +49,7 @@ bool terminus::dynamic() const {
 }
 
 value terminus::node_properties() const {
-    value x(pn_terminus_properties(object_));
+    value x(make_wrapper(pn_terminus_properties(object_)));
     return x;
 }
 


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