qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [1/3] qpid-proton git commit: NO-JIRA: c++: Mark data and encoder/decoder classes private.
Date Sat, 16 Jan 2016 22:42:34 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master 133486ff4 -> b3e143acc


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/proton-c/bindings/cpp/include/proton/value.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/value.hpp b/proton-c/bindings/cpp/include/proton/value.hpp
index 3122dae..b6ea4d2 100644
--- a/proton-c/bindings/cpp/include/proton/value.hpp
+++ b/proton-c/bindings/cpp/include/proton/value.hpp
@@ -18,17 +18,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 #include "proton/data.hpp"
-#include "proton/decoder.hpp"
 #include "proton/types.hpp"
 
 namespace proton {
 
-class data;
-class encoder;
-class decoder;
-
 /**
  * Holder for an AMQP value.
  *
@@ -36,9 +30,6 @@ class decoder;
  * assignment and conversion operators to convert its contents easily to and
  * from native C++ types.
  *
- * See proton::encoder and proton::decoder for details of the conversion rules.
- * Assigning to a proton::value follows the encoder rules, converting from a
- * proton::value (or calling proton::value::get) follows the decoder rules.
  */
 class value {
   public:
@@ -47,30 +38,28 @@ class value {
 #if PN_HAS_CPP11
     PN_CPP_EXTERN value(value&&);
 #endif
-    template <class T> value(const T& x) : data_(data::create()) { data_.copy(x);
}
+    PN_CPP_EXTERN value& operator=(const value&);
 
-    PN_CPP_EXTERN value& operator=(const value& x);
-    template <class T> value& operator=(const T& x) { data_.copy(x); return
*this; }
+    template <class T> value(const T& x) : data_(proton::data::create()) { encode()
<< x; }
+    template <class T> value& operator=(const T& x) { encode() << x;
return *this; }
 
     PN_CPP_EXTERN void clear();
     PN_CPP_EXTERN bool empty() const;
 
-    /** Encoder to encode complex data into this value. Note this clears the value. */
-    PN_CPP_EXTERN class encoder encoder();
-
-    /** Decoder to decode complex data from this value. Note this rewinds the decoder. */
-    PN_CPP_EXTERN class decoder decoder() const;
-
     /** Type of the current value*/
     PN_CPP_EXTERN type_id type() const;
 
-    /** Get the value. */
-    template<class T> void get(T &t) const { decoder() >> t; }
-    template<class T> void get(map_ref<T> t) const { decoder() >> t; }
-    template<class T> void get(pairs_ref<T> t) const { decoder() >> t;
}
-    template<class T> void get(sequence_ref<T> t) const { decoder() >>
t; }
+    /// Get the value.
+    template<class T> void get(T &t) const { decode() >> t; }
 
-    /** Get the value. */
+    /// Get an AMQP map as any type T that satisfies the map concept.
+    template<class T> void get_map(T& t) const { decode() >> to_map(t); }
+    /// Get a map as a as any type T that is a sequence pair-like types with first and second.
+    template<class T> void get_pairs(T& t) const { decode() >> to_pairs(t);
}
+    /// Get an AMQP array or list as type T that satisfies the sequence concept. */
+    template<class T> void get_sequence(T& t) const { decode() >> to_sequence(t);
}
+
+    /// Get the value as C++ type T.
     template<class T> T get() const { T t; get(t); return t; }
 
     ///@name as_ methods do "loose" conversion, they will convert the scalar
@@ -82,6 +71,12 @@ class value {
     PN_CPP_EXTERN std::string as_string() const; ///< Allowed if type_id_is_string_like(type())
     ///@}
 
+    ///@cond INTERNAL
+    PN_CPP_EXTERN encoder encode(); ///< Clear and return an encoder for this value.
+    PN_CPP_EXTERN decoder decode() const; ///< Rewind and return an encoder for this value.
+    PN_CPP_EXTERN class data& data() const; ///< Return a data reference, no clear
or rewind.
+    ///@endcond
+
   friend PN_CPP_EXTERN void swap(value&, value&);
   friend PN_CPP_EXTERN bool operator==(const value& x, const value& y);
   friend PN_CPP_EXTERN bool operator<(const value& x, const value& y);
@@ -90,14 +85,10 @@ class value {
   friend PN_CPP_EXTERN std::ostream& operator<<(std::ostream& o, const value&
dv);
 
   private:
-    value(data d);
-    value& ref(data d);
-
-    data data_;
+    mutable class data data_;
   friend class message;
 };
 
 
 }
 #endif // VALUE_H
-

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/proton-c/bindings/cpp/src/decoder.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/decoder.cpp b/proton-c/bindings/cpp/src/decoder.cpp
index 4639683..f775001 100644
--- a/proton-c/bindings/cpp/src/decoder.cpp
+++ b/proton-c/bindings/cpp/src/decoder.cpp
@@ -153,8 +153,8 @@ decoder operator>>(decoder d, rewind) { d.rewind(); return d; }
 
 decoder operator>>(decoder d, value& v) {
     data ddata = d.data();
-    if (ddata == v.data_) throw decode_error("extract into self");
-    data vdata = v.encoder().data();
+    data vdata = v.encode().data();
+    if (d.data() == v.data_) throw decode_error("extract into self");
     {
         narrow n(ddata);
         check(vdata.appendn(ddata, 1));

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/proton-c/bindings/cpp/src/encoder.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/encoder.cpp b/proton-c/bindings/cpp/src/encoder.cpp
index 109b290..acf4db9 100644
--- a/proton-c/bindings/cpp/src/encoder.cpp
+++ b/proton-c/bindings/cpp/src/encoder.cpp
@@ -30,9 +30,6 @@
 
 namespace proton {
 
-static const std::string prefix("encode: ");
-encode_error::encode_error(const std::string& msg) : error(prefix+msg) {}
-
 namespace {
 struct save_state {
     pn_data_t* data;
@@ -138,7 +135,7 @@ encoder operator<<(encoder e, amqp_binary x) { return insert(e,
e.pn_object(), x
 encoder operator<<(encoder e, const value& v) {
     data edata = e.data();
     if (edata == v.data_) throw encode_error("cannot insert into self");
-    data vdata = v.decoder().data();
+    data vdata = v.decode().data();
     check(edata.append(vdata), e.pn_object());
     return e;
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/proton-c/bindings/cpp/src/error.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/error.cpp b/proton-c/bindings/cpp/src/error.cpp
index 8382a70..d33bb72 100644
--- a/proton-c/bindings/cpp/src/error.cpp
+++ b/proton-c/bindings/cpp/src/error.cpp
@@ -29,4 +29,7 @@ timeout_error::timeout_error(const std::string& msg) : error(msg) {}
 
 decode_error::decode_error(const std::string& msg) : error("decode: "+msg) {}
 
+encode_error::encode_error(const std::string& msg) : error("encode: "+msg) {}
+
+
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/proton-c/bindings/cpp/src/interop_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/interop_test.cpp b/proton-c/bindings/cpp/src/interop_test.cpp
index 69a098d..21a748f 100644
--- a/proton-c/bindings/cpp/src/interop_test.cpp
+++ b/proton-c/bindings/cpp/src/interop_test.cpp
@@ -48,15 +48,15 @@ template <class T> T get(decoder& d) {
 // Test data ostream operator
 void test_data_ostream() {
     value dv;
-    dv.decoder().decode(read("primitives"));
+    dv.decode().decode(read("primitives"));
     ASSERT_EQUAL("true, false, 42, 42, -42, 12345, -12345, 12345, -12345, 0.125, 0.125",
str(dv));
 }
 
 // Test extracting to exact AMQP types works corectly, extrating to invalid types fails.
 void test_decoder_primitves_exact() {
     value dv;
-    dv.decoder().decode(read("primitives"));
-    decoder d(dv.decoder());
+    dv.decode().decode(read("primitives"));
+    decoder d(dv.decode());
     ASSERT(d.more());
     try { get< ::int8_t>(d); FAIL("got bool as byte"); } catch(decode_error){}
     ASSERT_EQUAL(true, get<bool>(d));
@@ -81,7 +81,7 @@ void test_decoder_primitves_exact() {
 // Test inserting primitive sand encoding as AMQP.
 void test_encoder_primitives() {
     value dv;
-    encoder e = dv.encoder();
+    encoder e = dv.encode();
     e << true << false;
     e << ::uint8_t(42);
     e << ::uint16_t(42) << ::int16_t(-42);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/proton-c/bindings/cpp/src/link_options.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/link_options.cpp b/proton-c/bindings/cpp/src/link_options.cpp
index 297a6c7..d5f8fb4 100644
--- a/proton-c/bindings/cpp/src/link_options.cpp
+++ b/proton-c/bindings/cpp/src/link_options.cpp
@@ -104,7 +104,7 @@ class link_options::impl {
                     if (lifetime_policy.set) lp = lifetime_policy_symbol(lifetime_policy.value);
                     if (!sender && distribution_mode.set) dm = distribution_mode_symbol(distribution_mode.value);
                     if (lp.size() || dm.size()) {
-                        encoder enc = t.dynamic_node_properties().encoder();
+                        encoder enc = t.node_properties().encode();
                         enc << start::map();
                         if (dm.size())
                             enc << amqp_symbol("supported-dist-modes") << amqp_string(dm);
@@ -122,9 +122,7 @@ class link_options::impl {
                     l.source().expiry_policy(terminus::EXPIRE_NEVER);
                 }
                 if (selector.set && selector.value.size()) {
-                    data d = l.source().filter();
-                    d.clear();
-                    encoder enc = d.encoder();
+                    encoder enc = l.source().filter().encode();
                     enc << start::map() << amqp_symbol("selector") << start::described()
                         << amqp_symbol("apache.org:selector-filter:string") <<
amqp_binary(selector.value) << finish();
                 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/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 24a6ba6..2358da2 100644
--- a/proton-c/bindings/cpp/src/message.cpp
+++ b/proton-c/bindings/cpp/src/message.cpp
@@ -38,44 +38,44 @@
 
 namespace proton {
 
-// impl exists so body is pre-constructed in reference mode (prevent it creating its own
data)
-// for all message ctors.
-message::impl::impl() : msg(0), body(0) {}
-
-message::impl::~impl() {
-    if (msg) {
-        body.ref(0);            // Clear the reference.
-        pn_message_free(msg);
-    }
-}
-
-// Lazy construct the message.
-pn_message_t* message::pn_msg() const {
-    if (!impl_.msg) impl_.msg = pn_message();
-    return impl_.msg;
-}
-
-message::message() {}
-
-message::message(const message &m) { *this = m; }
+message::message() : pn_msg_(0) {}
+message::message(const message &m) : pn_msg_(0) { *this = m; }
 
 #if PN_HAS_CPP11
-message::message(message &&m) { swap(*this, m); }
+message::message(message &&m) : pn_msg_(0) { swap(*this, m); }
 #endif
 
-message::~message() {}
+message::~message() {
+    body_.data_ = data(0);      // Must release body before pn_message_free
+    pn_message_free(pn_msg_);
+}
+
+void swap(message& x, message& y) {
+    using std::swap;
+    swap(x.pn_msg_, y.pn_msg_);
+    swap(x.body_, y.body_);
+    swap(x.application_properties_, y.application_properties_);
+    swap(x.message_annotations_, y.message_annotations_);
+    swap(x.delivery_annotations_, y.delivery_annotations_);
+}
 
-void swap(message& x, message& y) { std::swap(x.impl_.msg, y.impl_.msg); }
+pn_message_t *message::pn_msg() const {
+    if (!pn_msg_) pn_msg_ = pn_message();
+    body_.data_ = pn_message_body(pn_msg_);
+    return pn_msg_;
+}
 
 message& message::operator=(const message& m) {
-    // TODO aconway 2015-08-10: more efficient pn_message_copy function
-    std::vector<char> data;
-    m.encode(data);
-    decode(data);
+    if (&m != this) {
+        // TODO aconway 2015-08-10: more efficient pn_message_copy function
+        std::vector<char> data;
+        m.encode(data);
+        decode(data);
+    }
     return *this;
 }
 
-void message::clear() { if (impl_.msg) pn_message_clear(impl_.msg); }
+void message::clear() { if (pn_msg_) pn_message_clear(pn_msg_); }
 
 namespace {
 void check(int err) {
@@ -203,8 +203,8 @@ bool message::inferred() const { return pn_message_is_inferred(pn_msg());
}
 
 void message::inferred(bool b) { pn_message_set_inferred(pn_msg(), b); }
 
-const value& message::body() const { return impl_.body.ref(pn_message_body(pn_msg()));
}
-value& message::body() { return impl_.body.ref(pn_message_body(pn_msg())); }
+const value& message::body() const { pn_msg(); return body_; }
+value& message::body() { pn_msg(); return body_; }
 
 // MAP CACHING: the properties and annotations maps can either be encoded in the
 // pn_message pn_data_t structures OR decoded as C++ map members of the message
@@ -232,35 +232,35 @@ template<class M> M& put_map(pn_message_t* msg, pn_data_t*
(*get)(pn_message_t*)
 }
 
 message::property_map& message::application_properties() {
-    return get_map(pn_msg(), pn_message_properties, impl_.application_properties);
+    return get_map(pn_msg(), pn_message_properties, application_properties_);
 }
 
 const message::property_map& message::application_properties() const {
-    return get_map(pn_msg(), pn_message_properties, impl_.application_properties);
+    return get_map(pn_msg(), pn_message_properties, application_properties_);
 }
 
 
 message::annotation_map& message::message_annotations() {
-    return get_map(pn_msg(), pn_message_annotations, impl_.message_annotations);
+    return get_map(pn_msg(), pn_message_annotations, message_annotations_);
 }
 
 const message::annotation_map& message::message_annotations() const {
-    return get_map(pn_msg(), pn_message_annotations, impl_.message_annotations);
+    return get_map(pn_msg(), pn_message_annotations, message_annotations_);
 }
 
 
 message::annotation_map& message::delivery_annotations() {
-    return get_map(pn_msg(), pn_message_instructions, impl_.delivery_annotations);
+    return get_map(pn_msg(), pn_message_instructions, delivery_annotations_);
 }
 
 const message::annotation_map& message::delivery_annotations() const {
-    return get_map(pn_msg(), pn_message_instructions, impl_.delivery_annotations);
+    return get_map(pn_msg(), pn_message_instructions, delivery_annotations_);
 }
 
 void message::encode(std::vector<char> &s) const {
-    put_map(pn_msg(), pn_message_properties, impl_.application_properties);
-    put_map(pn_msg(), pn_message_annotations, impl_.message_annotations);
-    put_map(pn_msg(), pn_message_instructions, impl_.delivery_annotations);
+    put_map(pn_msg(), pn_message_properties, application_properties_);
+    put_map(pn_msg(), pn_message_annotations, message_annotations_);
+    put_map(pn_msg(), pn_message_instructions, delivery_annotations_);
     size_t sz = std::max(s.capacity(), size_t(512));
     while (true) {
         s.resize(sz);
@@ -283,9 +283,9 @@ std::vector<char> message::encode() const {
 }
 
 void message::decode(const std::vector<char> &s) {
-    impl_.application_properties.clear();
-    impl_.message_annotations.clear();
-    impl_.delivery_annotations.clear();
+    application_properties_.clear();
+    message_annotations_.clear();
+    delivery_annotations_.clear();
     check(pn_message_decode(pn_msg(), &s[0], s.size()));
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/proton-c/bindings/cpp/src/scalar.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/scalar.cpp b/proton-c/bindings/cpp/src/scalar.cpp
index d52c8eb..3379c01 100644
--- a/proton-c/bindings/cpp/src/scalar.cpp
+++ b/proton-c/bindings/cpp/src/scalar.cpp
@@ -27,7 +27,11 @@ namespace proton {
 
 scalar::scalar() { atom_.type = PN_NULL; }
 scalar::scalar(const scalar& x) { set(x.atom_); }
-scalar& scalar::operator=(const scalar& x) { set(x.atom_); return *this; }
+scalar& scalar::operator=(const scalar& x) {
+    if (this != &x)
+        set(x.atom_);
+    return *this;
+}
 
 type_id scalar::type() const { return type_id(atom_.type); }
 bool scalar::empty() const { return type() == NULL_TYPE; }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/proton-c/bindings/cpp/src/ssl_domain.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ssl_domain.cpp b/proton-c/bindings/cpp/src/ssl_domain.cpp
index 29d1be5..02e74de 100644
--- a/proton-c/bindings/cpp/src/ssl_domain.cpp
+++ b/proton-c/bindings/cpp/src/ssl_domain.cpp
@@ -69,8 +69,6 @@ ssl_domain& ssl_domain::operator=(const ssl_domain&x) {
 
 ssl_domain::~ssl_domain() { impl_->decref(); }
 
-// FIXME void ssl_domain::swap(ssl_domain &x) { std::swap(impl_, x.impl_); }
-
 pn_ssl_domain_t *ssl_domain::pn_domain() { return impl_->pn_domain(); }
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/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 062f376..2649bc3 100644
--- a/proton-c/bindings/cpp/src/terminus.cpp
+++ b/proton-c/bindings/cpp/src/terminus.cpp
@@ -24,6 +24,10 @@
 
 namespace proton {
 
+terminus::terminus(pn_terminus_t* t) :
+    object_(t), properties_(pn_terminus_properties(t)), filter_(pn_terminus_filter(t))
+{}
+
 terminus::type_t terminus::type() const {
     return type_t(pn_terminus_get_type(object_));
 }
@@ -81,12 +85,11 @@ void terminus::dynamic(bool d) {
     pn_terminus_set_dynamic(object_, d);
 }
 
-data terminus::filter() {
-    return pn_terminus_filter(object_);
-}
+value& terminus::filter() { return filter_; }
+const value& terminus::filter() const { return filter_; }
 
-data terminus::dynamic_node_properties() {
-    return pn_terminus_properties(object_);
-}
+
+value& terminus::node_properties() { return properties_; }
+const value& terminus::node_properties() const { return properties_; }
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/proton-c/bindings/cpp/src/url.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/url.cpp b/proton-c/bindings/cpp/src/url.cpp
index f6158dd..acd6527 100644
--- a/proton-c/bindings/cpp/src/url.cpp
+++ b/proton-c/bindings/cpp/src/url.cpp
@@ -59,7 +59,10 @@ url::url(const url& u) : url_(parse_allow_empty(u.str())) {}
 
 url::~url() { pn_url_free(url_); }
 
-url& url::operator=(const url& u) { replace(url_, parse_allow_empty(u.str())); return
*this; }
+url& url::operator=(const url& u) {
+    if (this != &u) replace(url_, parse_allow_empty(u.str()));
+    return *this;
+}
 
 void url::parse(const std::string& s) { replace(url_, parse_throw(s)); }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/proton-c/bindings/cpp/src/value.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/value.cpp b/proton-c/bindings/cpp/src/value.cpp
index 0a0e08f..54e19b0 100644
--- a/proton-c/bindings/cpp/src/value.cpp
+++ b/proton-c/bindings/cpp/src/value.cpp
@@ -18,7 +18,6 @@
  */
 
 #include "proton_bits.hpp"
-
 #include "proton/data.hpp"
 #include "proton/value.hpp"
 #include "proton/scalar.hpp"
@@ -27,48 +26,59 @@
 
 namespace proton {
 
-value::value() : data_(data::create()) {}
-
-value::value(const value& x) : data_(data::create()) { data_.copy(x.data_); }
-
+value::value() {}
+value::value(const value& x) { *this = x; }
 #if PN_HAS_CPP11
-value::value(value&& x) : data_(0) { swap(*this, x); }
+value::value(value&& x) { swap(*this, x); }
 #endif
 
-// Referencing an external value
-value::value(data d) : data_(d) {}
-
-// Referencing an external value
-value& value::ref(data d) { data_ = d; return *this; }
-
-value& value::operator=(const value& x) { data_.copy(x.data_); return *this; }
+value& value::operator=(const value& x) {
+    if (this != &x) {
+        if (x.empty())
+            clear();
+        else
+            encode() << x;
+    }
+    return *this;
+}
 
 void swap(value& x, value& y) { std::swap(x.data_, y.data_); }
 
-void value::clear() { data_.clear(); }
+void value::clear() { if (!!data_) data_.clear(); }
+
+bool value::empty() const { return !data_ || data_.empty(); }
 
-bool value::empty() const { return data_.empty(); }
+// On demand
+inline data& value::data() const { if (!data_) data_ = proton::data::create(); return
data_; }
 
-class encoder value::encoder() { clear(); return data_.encoder(); }
+class encoder value::encode() { clear(); return data().encoder(); }
 
-class decoder value::decoder() const { data_.decoder().rewind(); return data_.decoder();
}
+class decoder value::decode() const { return data().decoder() >> rewind(); }
 
-type_id value::type() const { return decoder().type(); }
+type_id value::type() const { return decode().type(); }
 
-bool operator==(const value& x, const value& y) { return x.data_.equal(y.data_);
}
+bool operator==(const value& x, const value& y) {
+    if (x.empty() && y.empty()) return true;
+    if (x.empty() || y.empty()) return false;
+    return  x.data().equal(y.data());
+}
 
-bool operator<(const value& x, const value& y) { return x.data_.less(y.data_);
}
+bool operator<(const value& x, const value& y) {
+    if (x.empty() && y.empty()) return false;
+    if (x.empty()) return true; // empty is < !empty
+    return x.data().less(y.data());
+}
 
 std::ostream& operator<<(std::ostream& o, const value& v) {
-    // pn_inspect prints strings with quotes which is not normal in C++.
     if (v.empty())
         return o << "<empty>";
+    // pn_inspect prints strings with quotes which is not normal in C++.
     switch (v.type()) {
       case STRING:
       case SYMBOL:
         return o << v.get<std::string>();
       default:
-        return o << v.data_;
+        return o << v.data();
     }
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/proton-c/bindings/cpp/src/value_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/value_test.cpp b/proton-c/bindings/cpp/src/value_test.cpp
index 8c285ac..2c6a64c 100644
--- a/proton-c/bindings/cpp/src/value_test.cpp
+++ b/proton-c/bindings/cpp/src/value_test.cpp
@@ -41,6 +41,11 @@ template <class T> void value_test(T x, type_id tid, const std::string&
s, T y)
     ASSERT_EQUAL(tid, v2.type());
     ASSERT_EQUAL(x, v2.get<T>());
 
+    value v3(v);
+    v3 = x;
+    ASSERT_EQUAL(tid, v3.type());
+    ASSERT_EQUAL(x, v3.get<T>());
+
     ASSERT_EQUAL(v, v2);
     ASSERT_EQUAL(s, str(v));
     ASSERT(x != y);
@@ -65,7 +70,7 @@ void map_test() {
     ASSERT_EQUAL("{\"a\"=1, \"b\"=b\"xyz\"}",  str(v));
 
     std::vector<std::pair<string, value> > vec;
-    v.get(to_pairs(vec));
+    v.get_pairs(vec);
     ASSERT_EQUAL(2, vec.size());
     ASSERT_EQUAL(std::make_pair(std::string("a"), value(1)), vec[0]);
     ASSERT_EQUAL(std::make_pair(std::string("b"), value(amqp_binary("xyz"))), vec[1]);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e53302d2/tests/tools/apps/cpp/reactor_send.cpp
----------------------------------------------------------------------
diff --git a/tests/tools/apps/cpp/reactor_send.cpp b/tests/tools/apps/cpp/reactor_send.cpp
index 86406f6..9170442 100644
--- a/tests/tools/apps/cpp/reactor_send.cpp
+++ b/tests/tools/apps/cpp/reactor_send.cpp
@@ -92,7 +92,7 @@ class reactor_send : public proton::messaging_handler {
 
     void on_message(proton::event &e) {
         proton::message &msg = e.message();
-        msg.body().decoder() >> received_content_;
+        msg.body().decode() >> received_content_;
         received_bytes_ += received_content_.size();
         if (received_ < total_) {
             received_++;


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


Mime
View raw message