Repository: qpid-proton
Updated Branches:
  refs/heads/master b57e6ea7d -> 348f4d51f


PROTON-1215: [C++ binding] Move data to internal namespace
-- Also tidy up use of "using namespace"


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

Branch: refs/heads/master
Commit: 348f4d51fa6bd27da2dc56bbeafef0c0d2273d21
Parents: b57e6ea
Author: Andrew Stitcher <[email protected]>
Authored: Fri May 27 16:10:42 2016 -0400
Committer: Andrew Stitcher <[email protected]>
Committed: Fri Jun 3 01:15:18 2016 -0400

----------------------------------------------------------------------
 .../cpp/include/proton/codec/common.hpp         |  59 ++++++++
 .../bindings/cpp/include/proton/codec/data.hpp  | 133 -------------------
 .../cpp/include/proton/codec/decoder.hpp        |   5 +-
 .../cpp/include/proton/codec/encoder.hpp        |  11 +-
 .../cpp/include/proton/internal/data.hpp        | 105 +++++++++++++++
 proton-c/bindings/cpp/include/proton/value.hpp  |   6 +-
 proton-c/bindings/cpp/src/codec_test.cpp        |   5 +-
 proton-c/bindings/cpp/src/container_test.cpp    |   3 -
 proton-c/bindings/cpp/src/data.cpp              |   9 +-
 proton-c/bindings/cpp/src/decoder.cpp           |  40 +++---
 proton-c/bindings/cpp/src/encoder.cpp           |   8 +-
 proton-c/bindings/cpp/src/engine_test.cpp       |  11 +-
 proton-c/bindings/cpp/src/interop_test.cpp      |   9 +-
 proton-c/bindings/cpp/src/message.cpp           |   2 +-
 proton-c/bindings/cpp/src/message_test.cpp      |   1 -
 proton-c/bindings/cpp/src/proton_bits.hpp       |   6 +-
 proton-c/bindings/cpp/src/scalar_test.cpp       |   3 +-
 proton-c/bindings/cpp/src/test_bits.hpp         |   8 +-
 proton-c/bindings/cpp/src/thread_safe_test.cpp  |   6 +-
 proton-c/bindings/cpp/src/value.cpp             |  14 +-
 proton-c/bindings/cpp/src/value_test.cpp        |   4 +-
 21 files changed, 247 insertions(+), 201 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/proton-c/bindings/cpp/include/proton/codec/common.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/codec/common.hpp 
b/proton-c/bindings/cpp/include/proton/codec/common.hpp
new file mode 100644
index 0000000..e8d8ce5
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/codec/common.hpp
@@ -0,0 +1,59 @@
+#ifndef PROTON_CODEC_COMMON_HPP
+#define PROTON_CODEC_COMMON_HPP
+
+/*
+ *
+ * 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 "../type_id.hpp"
+
+namespace proton {
+namespace codec {
+
+/// **Experimental** - Start encoding a complex type.
+struct start {
+    /// @cond INTERNAL
+    /// XXX Document
+    start(type_id type_=NULL_TYPE, type_id element_=NULL_TYPE,
+          bool described_=false, size_t size_=0) :
+        type(type_), element(element_), is_described(described_), size(size_) 
{}
+
+    type_id type;            ///< The container type: ARRAY, LIST, MAP or 
DESCRIBED.
+    type_id element;         ///< the element type for array only.
+    bool is_described;       ///< true if first value is a descriptor.
+    size_t size;             ///< the element count excluding the descriptor 
(if any)
+    /// @endcond
+
+    /// @cond INTERNAL
+    /// XXX Document
+    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); }
+    /// @endcond
+};
+
+/// **Experimental** - Finish inserting or extracting a complex type.
+struct finish {};
+
+} // codec
+} // proton
+
+#endif // PROTON_CODEC_COMMON_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/proton-c/bindings/cpp/include/proton/codec/data.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/codec/data.hpp 
b/proton-c/bindings/cpp/include/proton/codec/data.hpp
deleted file mode 100644
index 19df1ed..0000000
--- a/proton-c/bindings/cpp/include/proton/codec/data.hpp
+++ /dev/null
@@ -1,133 +0,0 @@
-#ifndef PROTON_CODEC_DATA_HPP
-#define PROTON_CODEC_DATA_HPP
-
-/*
- *
- * 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 "../internal/object.hpp"
-#include "../types_fwd.hpp"
-#include "../type_id.hpp"
-
-struct pn_data_t;
-
-namespace proton {
-
-class value;
-
-// XXX -> internal namespace
-namespace codec {
-
-/// @cond INTERNAL
-/// Wrapper for a proton data object.
-class data : public internal::object<pn_data_t> {
-    /// Wrap an existing proton-C data object.
-    data(pn_data_t* d) : internal::object<pn_data_t>(d) {}
-
-  public:
-    /// Create an empty data.
-    data() : internal::object<pn_data_t>(0) {}
-
-    /// Create a new data object.
-    PN_CPP_EXTERN static data create();
-
-    /// Copy the contents of another data object.
-    PN_CPP_EXTERN void copy(const data&);
-
-    /// Clear the data.
-    PN_CPP_EXTERN void clear();
-
-    /// Rewind current position to the start.
-    PN_CPP_EXTERN void rewind();
-
-    /// True if there are no values.
-    PN_CPP_EXTERN bool empty() const;
-
-    /// Append the contents of another data object.
-    PN_CPP_EXTERN int append(data src);
-
-    /// Append up to limit items from data object.
-    PN_CPP_EXTERN int appendn(data src, int limit);
-
-    PN_CPP_EXTERN bool next();
-    PN_CPP_EXTERN void* point() const;
-    PN_CPP_EXTERN void restore(void* h);
-
-  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&);
-};
-/// @endcond
-
-/// **Experimental** - Save and restore codec state
-///
-/// A state_guard saves the state and restores it in the destructor
-/// unless cancel() is called.
-struct state_guard {
-    /// @cond INTERNAL
-    data& data_;
-    void* point_;
-    bool cancel_;
-    /// @endcond
-
-    /// @cond INTERNAL
-    state_guard(data& d) : data_(d), point_(data_.point()), cancel_(false) {}
-    /// @endcond
-    
-    ~state_guard() { if (!cancel_) data_.restore(point_); }
-
-    /// Discard the saved state.
-    void cancel() { cancel_ = true; }
-};
-
-/// **Experimental** - Start encoding a complex type.
-struct start {
-    /// @cond INTERNAL
-    /// XXX Document
-    start(type_id type_=NULL_TYPE, type_id element_=NULL_TYPE,
-          bool described_=false, size_t size_=0) :
-        type(type_), element(element_), is_described(described_), size(size_) 
{}
-
-    type_id type;            ///< The container type: ARRAY, LIST, MAP or 
DESCRIBED.
-    type_id element;         ///< the element type for array only.
-    bool is_described;       ///< true if first value is a descriptor.
-    size_t size;             ///< the element count excluding the descriptor 
(if any)
-    /// @endcond
-
-    /// @cond INTERNAL
-    /// XXX Document
-    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); }
-    /// @endcond
-};
-
-/// **Experimental** - Finish inserting or extracting a complex type.
-struct finish {};
-
-} // codec
-} // proton
-
-#endif // PROTON_CODEC_DATA_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/proton-c/bindings/cpp/include/proton/codec/decoder.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/codec/decoder.hpp 
b/proton-c/bindings/cpp/include/proton/codec/decoder.hpp
index bdc2208..7acae9d 100644
--- a/proton-c/bindings/cpp/include/proton/codec/decoder.hpp
+++ b/proton-c/bindings/cpp/include/proton/codec/decoder.hpp
@@ -22,9 +22,10 @@
  *
  */
 
-#include "./data.hpp"
+#include "../internal/data.hpp"
 #include "../internal/type_traits.hpp"
 #include "../types_fwd.hpp"
+#include "./common.hpp"
 
 #include <utility>
 
@@ -47,7 +48,7 @@ namespace codec {
 /// For internal use only.
 ///
 /// @see @ref types_page for the recommended ways to manage AMQP data
-class decoder : public data {
+class decoder : public internal::data {
   public:
     /// Wrap a Proton C data object.  The exact flag if set means
     /// decode only when there is an exact match between the AMQP and

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/proton-c/bindings/cpp/include/proton/codec/encoder.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/codec/encoder.hpp 
b/proton-c/bindings/cpp/include/proton/codec/encoder.hpp
index 6b90ba2..ac611a4 100644
--- a/proton-c/bindings/cpp/include/proton/codec/encoder.hpp
+++ b/proton-c/bindings/cpp/include/proton/codec/encoder.hpp
@@ -22,9 +22,10 @@
  *
  */
 
-#include "./data.hpp"
+#include "../internal/data.hpp"
 #include "../internal/type_traits.hpp"
 #include "../types_fwd.hpp"
+#include "./common.hpp"
 
 namespace proton {
 
@@ -41,7 +42,7 @@ namespace codec {
 /// For internal use only.
 ///
 /// @see @ref types_page for the recommended ways to manage AMQP data
-class encoder : public data {
+class encoder : public internal::data {
   public:
     /// Wrap Proton-C data object.
     explicit encoder(const data& d) : data(d) {}
@@ -126,7 +127,7 @@ class encoder : public data {
     }
 
     template <class T> encoder& operator<<(const map_cref<T>& x) {
-        state_guard sg(*this);
+        internal::state_guard sg(*this);
         *this << start::map();
         for (typename T::const_iterator i = x.ref.begin(); i != x.ref.end(); 
++i)
             *this << i->first << i->second;
@@ -135,7 +136,7 @@ class encoder : public data {
     }
 
     template <class T> encoder& operator<<(const list_cref<T>& x) {
-        state_guard sg(*this);
+        internal::state_guard sg(*this);
         *this << start::list();
         for (typename T::const_iterator i = x.ref.begin(); i != x.ref.end(); 
++i)
             *this << *i;
@@ -144,7 +145,7 @@ class encoder : public data {
     }
 
     template <class T> encoder& operator<<(const array_cref<T>& x) {
-        state_guard sg(*this);
+        internal::state_guard sg(*this);
         *this << x.array_start;
         for (typename T::const_iterator i = x.ref.begin(); i != x.ref.end(); 
++i)
             *this << *i;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/proton-c/bindings/cpp/include/proton/internal/data.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/internal/data.hpp 
b/proton-c/bindings/cpp/include/proton/internal/data.hpp
new file mode 100644
index 0000000..bfc0e33
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/internal/data.hpp
@@ -0,0 +1,105 @@
+#ifndef PROTON_INTERNAL_DATA_HPP
+#define PROTON_INTERNAL_DATA_HPP
+
+/*
+ *
+ * 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 "../internal/object.hpp"
+#include "../types_fwd.hpp"
+
+struct pn_data_t;
+
+namespace proton {
+
+class value;
+
+namespace internal {
+
+/// @cond INTERNAL
+/// Wrapper for a proton data object.
+class data : public object<pn_data_t> {
+    /// Wrap an existing proton-C data object.
+    data(pn_data_t* d) : internal::object<pn_data_t>(d) {}
+
+  public:
+    /// Create an empty data.
+    data() : internal::object<pn_data_t>(0) {}
+
+    /// Create a new data object.
+    PN_CPP_EXTERN static data create();
+
+    /// Copy the contents of another data object.
+    PN_CPP_EXTERN void copy(const data&);
+
+    /// Clear the data.
+    PN_CPP_EXTERN void clear();
+
+    /// Rewind current position to the start.
+    PN_CPP_EXTERN void rewind();
+
+    /// True if there are no values.
+    PN_CPP_EXTERN bool empty() const;
+
+    /// Append the contents of another data object.
+    PN_CPP_EXTERN int append(data src);
+
+    /// Append up to limit items from data object.
+    PN_CPP_EXTERN int appendn(data src, int limit);
+
+    PN_CPP_EXTERN bool next();
+    PN_CPP_EXTERN void* point() const;
+    PN_CPP_EXTERN void restore(void* h);
+
+  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&);
+};
+/// @endcond
+
+/// **Experimental** - Save and restore codec state
+///
+/// A state_guard saves the state and restores it in the destructor
+/// unless cancel() is called.
+struct state_guard {
+    /// @cond INTERNAL
+    data& data_;
+    void* point_;
+    bool cancel_;
+    /// @endcond
+
+    /// @cond INTERNAL
+    state_guard(data& d) : data_(d), point_(data_.point()), cancel_(false) {}
+    /// @endcond
+
+    ~state_guard() { if (!cancel_) data_.restore(point_); }
+
+    /// Discard the saved state.
+    void cancel() { cancel_ = true; }
+};
+
+} // internal
+} // proton
+
+#endif // PROTON_INTERNAL_DATA_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/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 4149f60..5438e00 100644
--- a/proton-c/bindings/cpp/include/proton/value.hpp
+++ b/proton-c/bindings/cpp/include/proton/value.hpp
@@ -50,8 +50,8 @@ class value_base {
     PN_CPP_EXTERN bool empty() const;
 
   protected:
-    codec::data& data() const;
-    mutable class codec::data data_;
+    internal::data& data() const;
+    mutable class internal::data data_;
 
     /// @cond INTERNAL    
   friend class proton::message;
@@ -119,7 +119,7 @@ class value : public internal::value_base, private 
internal::comparable<value> {
     /// @}
 
     /// @cond INTERNAL
-    PN_CPP_EXTERN explicit value(const codec::data&);
+    PN_CPP_EXTERN explicit value(const internal::data&);
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/proton-c/bindings/cpp/src/codec_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/codec_test.cpp 
b/proton-c/bindings/cpp/src/codec_test.cpp
index b2b40ac..7791749 100644
--- a/proton-c/bindings/cpp/src/codec_test.cpp
+++ b/proton-c/bindings/cpp/src/codec_test.cpp
@@ -19,13 +19,12 @@
 
 #include "test_bits.hpp"
 
-#include "proton/codec/data.hpp"
+#include "proton/internal/data.hpp"
 #include "proton/internal/config.hpp"
 #include "proton/types.hpp"
 
 namespace {
 
-using namespace test;
 using namespace proton;
 
 template <class T> void  simple_type_test(const T& x) {
@@ -108,7 +107,7 @@ int main(int, char**) {
     RUN_TEST(failed, (uncodable_type_test<std::pair<int, float> >()));
     RUN_TEST(failed, (uncodable_type_test<std::pair<scalar, value> >()));
     RUN_TEST(failed, (uncodable_type_test<std::basic_string<wchar_t> >()));
-    RUN_TEST(failed, (uncodable_type_test<codec::data>()));
+    RUN_TEST(failed, (uncodable_type_test<internal::data>()));
     RUN_TEST(failed, (uncodable_type_test<pn_data_t*>()));
 
     return failed;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/proton-c/bindings/cpp/src/container_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_test.cpp 
b/proton-c/bindings/cpp/src/container_test.cpp
index 940f833..e6e02a0 100644
--- a/proton-c/bindings/cpp/src/container_test.cpp
+++ b/proton-c/bindings/cpp/src/container_test.cpp
@@ -34,9 +34,6 @@
 
 namespace {
 
-using namespace test;
-
-
 static std::string int2string(int n) {
     std::ostringstream strm;
     strm << n;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/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 43f2e5c..0f6e7f5 100644
--- a/proton-c/bindings/cpp/src/data.cpp
+++ b/proton-c/bindings/cpp/src/data.cpp
@@ -17,11 +17,10 @@
  * under the License.
  */
 
-#include "proton_bits.hpp"
+#include "proton/internal/data.hpp"
 
 #include "proton/binary.hpp"
 #include "proton/codec/encoder.hpp"
-#include "proton/codec/data.hpp"
 #include "proton/decimal.hpp"
 #include "proton/message_id.hpp"
 #include "proton/symbol.hpp"
@@ -32,8 +31,10 @@
 
 #include <ostream>
 
+#include "proton_bits.hpp"
+
 namespace proton {
-namespace codec {
+namespace internal {
 
 data data::create() { return internal::take_ownership(pn_data(0)).get(); }
 
@@ -65,5 +66,5 @@ std::ostream& operator<<(std::ostream& o, const data& d) {
     return o << inspectable(d.pn_object());
 }
 
-} // codec
+} // internal
 } // proton

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/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 d42af54..b215539 100644
--- a/proton-c/bindings/cpp/src/decoder.cpp
+++ b/proton-c/bindings/cpp/src/decoder.cpp
@@ -17,10 +17,10 @@
  * under the License.
  */
 
+#include "proton/codec/decoder.hpp"
+
 #include "proton/annotation_key.hpp"
 #include "proton/binary.hpp"
-#include "proton/codec/encoder.hpp"
-#include "proton/codec/data.hpp"
 #include "proton/decimal.hpp"
 #include "proton/message_id.hpp"
 #include "proton/scalar.hpp"
@@ -54,7 +54,7 @@ template <class T> T check(T result) {
 }
 
 void decoder::decode(const char* i, size_t size) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     const char* end = i + size;
     while (i < end)
         i += check(pn_data_decode(pn_object(), i, size_t(end - i)));
@@ -63,7 +63,7 @@ void decoder::decode(const char* i, size_t size) {
 void decoder::decode(const std::string& s) { decode(s.data(), s.size()); }
 
 bool decoder::more() {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     return next();
 }
 
@@ -89,7 +89,7 @@ void assign(binary& x, const pn_bytes_t y) { x = bin(y); }
 
 // Simple extract with no type conversion.
 template <class T, class U> decoder& decoder::extract(T& x, U 
(*get)(pn_data_t*)) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     assert_type_equal(internal::type_id_of<T>::value, pre_get());
     assign(x, get(pn_object()));
     sg.cancel();                // No error, cancel the reset.
@@ -97,12 +97,12 @@ template <class T, class U> decoder& decoder::extract(T& x, 
U (*get)(pn_data_t*)
 }
 
 type_id decoder::next_type() {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     return pre_get();
 }
 
 decoder& decoder::operator>>(start& s) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     s.type = pre_get();
     switch (s.type) {
       case ARRAY:
@@ -133,7 +133,7 @@ decoder& decoder::operator>>(const finish&) {
 }
 
 decoder& decoder::operator>>(null&) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     assert_type_equal(NULL_TYPE, pre_get());
     return *this;
 }
@@ -156,7 +156,7 @@ decoder& decoder::operator>>(internal::value_base& x) {
 }
 
 decoder& decoder::operator>>(message_id& x) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     type_id got = pre_get();
     if (got != ULONG && got != UUID && got != BINARY && got != STRING)
         throw conversion_error(
@@ -167,7 +167,7 @@ decoder& decoder::operator>>(message_id& x) {
 }
 
 decoder& decoder::operator>>(annotation_key& x) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     type_id got = pre_get();
     if (got != ULONG && got != SYMBOL)
         throw conversion_error(msg() << "expected one of ulong or symbol but 
found " << got);
@@ -177,7 +177,7 @@ decoder& decoder::operator>>(annotation_key& x) {
 }
 
 decoder& decoder::operator>>(scalar& x) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     type_id got = pre_get();
     if (!type_id_is_scalar(got))
         throw conversion_error("expected scalar, found "+type_name(got));
@@ -193,7 +193,7 @@ decoder& decoder::operator>>(uint8_t &x)  { return 
extract(x, pn_data_get_ubyte)
 decoder& decoder::operator>>(int8_t &x) { return extract(x, pn_data_get_byte); 
}
 
 decoder& decoder::operator>>(uint16_t &x) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     type_id tid = pre_get();
     if (exact_) assert_type_equal(USHORT, tid);
     switch (tid) {
@@ -206,7 +206,7 @@ decoder& decoder::operator>>(uint16_t &x) {
 }
 
 decoder& decoder::operator>>(int16_t &x) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     type_id tid = pre_get();
     if (exact_) assert_type_equal(SHORT, tid);
     switch (tid) {
@@ -219,7 +219,7 @@ decoder& decoder::operator>>(int16_t &x) {
 }
 
 decoder& decoder::operator>>(uint32_t &x) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     type_id tid = pre_get();
     if (exact_) assert_type_equal(UINT, tid);
     switch (tid) {
@@ -233,7 +233,7 @@ decoder& decoder::operator>>(uint32_t &x) {
 }
 
 decoder& decoder::operator>>(int32_t &x) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     type_id tid = pre_get();
     if (exact_) assert_type_equal(INT, tid);
     switch (tid) {
@@ -247,7 +247,7 @@ decoder& decoder::operator>>(int32_t &x) {
 }
 
 decoder& decoder::operator>>(uint64_t &x) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     type_id tid = pre_get();
     if (exact_) assert_type_equal(ULONG, tid);
     switch (tid) {
@@ -262,7 +262,7 @@ decoder& decoder::operator>>(uint64_t &x) {
 }
 
 decoder& decoder::operator>>(int64_t &x) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     type_id tid = pre_get();
     if (exact_) assert_type_equal(LONG, tid);
     switch (tid) {
@@ -281,7 +281,7 @@ decoder& decoder::operator>>(wchar_t &x) { return 
extract(x, pn_data_get_char);
 decoder& decoder::operator>>(timestamp &x) { return extract(x, 
pn_data_get_timestamp); }
 
 decoder& decoder::operator>>(float &x) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     type_id tid = pre_get();
     if (exact_) assert_type_equal(FLOAT, tid);
     switch (tid) {
@@ -294,7 +294,7 @@ decoder& decoder::operator>>(float &x) {
 }
 
 decoder& decoder::operator>>(double &x) {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     type_id tid = pre_get();
     if (exact_) assert_type_equal(DOUBLE, tid);
     switch (tid) {
@@ -315,7 +315,7 @@ decoder& decoder::operator>>(binary &x)  { return 
extract(x, pn_data_get_binary)
 decoder& decoder::operator>>(symbol &x)  { return extract(x, 
pn_data_get_symbol); }
 
 decoder& decoder::operator>>(std::string &x)  {
-    state_guard sg(*this);
+    internal::state_guard sg(*this);
     type_id tid = pre_get();
     if (exact_) assert_type_equal(STRING, tid);
     switch (tid) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/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 a433091..79f7826 100644
--- a/proton-c/bindings/cpp/src/encoder.cpp
+++ b/proton-c/bindings/cpp/src/encoder.cpp
@@ -17,14 +17,14 @@
  * under the License.
  */
 
+#include "proton/codec/encoder.hpp"
+
 #include "proton_bits.hpp"
 #include "types_internal.hpp"
 #include "msg.hpp"
 
 #include "proton/annotation_key.hpp"
 #include "proton/binary.hpp"
-#include "proton/codec/encoder.hpp"
-#include "proton/codec/data.hpp"
 #include "proton/decimal.hpp"
 #include "proton/message_id.hpp"
 #include "proton/internal/scalar_base.hpp"
@@ -51,7 +51,7 @@ encoder::encoder(internal::value_base& v) : data(v.data()) {
 }
 
 bool encoder::encode(char* buffer, size_t& size) {
-    state_guard sg(*this); // In case of error
+    internal::state_guard sg(*this); // In case of error
     ssize_t result = pn_data_encode(pn_object(), buffer, size);
     if (result == PN_OVERFLOW) {
         result = pn_data_encoded_size(pn_object());
@@ -117,7 +117,7 @@ int pn_data_put_amqp_symbol(pn_data_t *d, const symbol& x) 
{ return pn_data_put_
 
 template <class T, class U>
 encoder& encoder::insert(const T& x, int (*put)(pn_data_t*, U)) {
-    state_guard sg(*this);         // Save state in case of error.
+    internal::state_guard sg(*this);         // Save state in case of error.
     check(put(pn_object(), coerce<U>(x)));
     sg.cancel();                // Don't restore state, all is good.
     return *this;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/proton-c/bindings/cpp/src/engine_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/engine_test.cpp 
b/proton-c/bindings/cpp/src/engine_test.cpp
index 681f61c..4189435 100644
--- a/proton-c/bindings/cpp/src/engine_test.cpp
+++ b/proton-c/bindings/cpp/src/engine_test.cpp
@@ -34,10 +34,15 @@
 
 namespace {
 
-using namespace proton::io;
-using namespace proton;
-using namespace test;
 using namespace std;
+using namespace proton;
+
+using proton::io::connection_engine;
+using proton::io::link_namer;
+using proton::io::const_buffer;
+using proton::io::mutable_buffer;
+
+using test::dummy_container;
 
 typedef std::deque<char> byte_stream;
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/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 45f6a0d..ee29bc1 100644
--- a/proton-c/bindings/cpp/src/interop_test.cpp
+++ b/proton-c/bindings/cpp/src/interop_test.cpp
@@ -32,8 +32,13 @@ namespace {
 
 using namespace std;
 using namespace proton;
-using namespace proton::codec;
-using namespace test;
+
+using proton::codec::encoder;
+using proton::codec::decoder;
+
+using proton::internal::data;
+
+using test::str;
 
 std::string tests_dir;
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/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 44565b3..6a05d90 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();      // Must release body before 
pn_message_free
+    body_.data_ = internal::data();      // Must release body before 
pn_message_free
     pn_message_free(pn_msg_);
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/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 0d9e7cf..68205c9 100644
--- a/proton-c/bindings/cpp/src/message_test.cpp
+++ b/proton-c/bindings/cpp/src/message_test.cpp
@@ -29,7 +29,6 @@ namespace {
 
 using namespace std;
 using namespace proton;
-using namespace test;
 
 #define CHECK_STR(ATTR) \
     m.ATTR(#ATTR); \

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/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 1c96bdb..8d58938 100644
--- a/proton-c/bindings/cpp/src/proton_bits.hpp
+++ b/proton-c/bindings/cpp/src/proton_bits.hpp
@@ -44,7 +44,7 @@ struct pn_reactor_t;
 
 namespace proton {
 
-namespace codec { class data; }
+namespace internal { class data; }
 class transport;
 class sasl;
 class ssl;
@@ -83,7 +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<internal::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; };
@@ -103,7 +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_data_t> { typedef internal::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/348f4d51/proton-c/bindings/cpp/src/scalar_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/scalar_test.cpp 
b/proton-c/bindings/cpp/src/scalar_test.cpp
index 3d6d6de..54be0b9 100644
--- a/proton-c/bindings/cpp/src/scalar_test.cpp
+++ b/proton-c/bindings/cpp/src/scalar_test.cpp
@@ -23,7 +23,8 @@ namespace {
 
 using namespace std;
 using namespace proton;
-using namespace test;
+
+using test::scalar_test_group;
 
 // NOTE: proton::coerce<> and bad proton::get() are tested in value_test to 
avoid redundant test code.
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/proton-c/bindings/cpp/src/test_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/test_bits.hpp 
b/proton-c/bindings/cpp/src/test_bits.hpp
index 6486e48..2079be5 100644
--- a/proton-c/bindings/cpp/src/test_bits.hpp
+++ b/proton-c/bindings/cpp/src/test_bits.hpp
@@ -47,19 +47,19 @@ inline void assert_equalish(double want, double got, double 
delta, const std::st
 }
 
 #define FAIL_MSG(WHAT) (MSG(__FILE__ << ":" << __LINE__ << ": " << WHAT).str())
-#define FAIL(WHAT) throw fail(FAIL_MSG(WHAT))
+#define FAIL(WHAT) throw test::fail(FAIL_MSG(WHAT))
 #define ASSERT(TEST) do { if (!(TEST)) FAIL("failed ASSERT(" #TEST ")"); } 
while(false)
 #define ASSERT_EQUAL(WANT, GOT) \
-    assert_equal((WANT), (GOT), FAIL_MSG("failed ASSERT_EQUAL(" #WANT ", " 
#GOT ")"))
+    test::assert_equal((WANT), (GOT), FAIL_MSG("failed ASSERT_EQUAL(" #WANT ", 
" #GOT ")"))
 #define ASSERT_EQUALISH(WANT, GOT, DELTA) \
-    assert_equalish((WANT), (GOT), (DELTA), FAIL_MSG("failed ASSERT_EQUALISH(" 
#WANT ", " #GOT ")"))
+    test::assert_equalish((WANT), (GOT), (DELTA), FAIL_MSG("failed 
ASSERT_EQUALISH(" #WANT ", " #GOT ")"))
 
 #define RUN_TEST(BAD_COUNT, TEST)                                       \
     do {                                                                \
         try {                                                           \
             TEST;                                                       \
             break;                                                      \
-        } catch(const fail& e) {                                        \
+        } catch(const test::fail& e) {                                        \
             std::cout << "FAIL " << #TEST << std::endl << e.what() << 
std::endl; \
         } catch(const std::exception& e) {                              \
             std::cout << "ERROR " << #TEST << std::endl << __FILE__ << ":" << 
__LINE__ << ": " << e.what() << std::endl; \

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/proton-c/bindings/cpp/src/thread_safe_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/thread_safe_test.cpp 
b/proton-c/bindings/cpp/src/thread_safe_test.cpp
index 540fcc8..0eb21b2 100644
--- a/proton-c/bindings/cpp/src/thread_safe_test.cpp
+++ b/proton-c/bindings/cpp/src/thread_safe_test.cpp
@@ -32,9 +32,11 @@
 
 namespace {
 
-using namespace proton;
-using namespace test;
 using namespace std;
+using namespace proton;
+
+using test::dummy_container;
+using test::dummy_event_loop;
 
 dummy_container cont;
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/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 c5c71a0..d0ef2ee 100644
--- a/proton-c/bindings/cpp/src/value.cpp
+++ b/proton-c/bindings/cpp/src/value.cpp
@@ -18,7 +18,7 @@
  */
 
 #include "proton_bits.hpp"
-#include "proton/codec/data.hpp"
+#include "proton/internal/data.hpp"
 #include "proton/value.hpp"
 #include "proton/types.hpp"
 #include "proton/scalar.hpp"
@@ -28,11 +28,13 @@
 
 namespace proton {
 
-using namespace codec;
+using codec::decoder;
+using codec::encoder;
+using codec::start;
 
 value::value() {}
 value::value(const value& x) { *this = x; }
-value::value(const codec::data& x) { if (!x.empty()) data().copy(x); }
+value::value(const internal::data& x) { if (!x.empty()) data().copy(x); }
 #if PN_CPP_HAS_RVALUE_REFERENCES
 value::value(value&& x) { swap(*this, x); }
 value& value::operator=(value&& x) { swap(*this, x); return *this; }
@@ -61,9 +63,9 @@ type_id value_base::type() const {
 bool value_base::empty() const { return type() == NULL_TYPE; }
 
 // On demand
-codec::data& value_base::data() const {
+internal::data& value_base::data() const {
     if (!data_)
-        data_ = codec::data::create();
+        data_ = internal::data::create();
     return data_;
 }
 
@@ -145,7 +147,7 @@ int compare_next(decoder& a, decoder& b) {
 
 int compare(const value& x, const value& y) {
     decoder a(x), b(y);
-    state_guard s1(a), s2(b);
+    internal::state_guard s1(a), s2(b);
     a.rewind();
     b.rewind();
     while (a.more() && b.more()) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348f4d51/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 966f415..917753c 100644
--- a/proton-c/bindings/cpp/src/value_test.cpp
+++ b/proton-c/bindings/cpp/src/value_test.cpp
@@ -23,7 +23,9 @@ namespace {
 
 using namespace std;
 using namespace proton;
-using namespace test;
+
+using test::many;
+using test::scalar_test_group;
 
 // Inserting and extracting arrays from a container T of type U
 template <class T> void sequence_test(type_id tid, const many<typename 
T::value_type>& values) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to