PROTON-1590: [C++ binding] Make sasl and ssl objects copyable and assignable - Only ensure that they can't be default constructed (as that makes little sense) - In retrospect only allowing these objects to be copied/assigned is harmless - This fixes some issues when mixing C++03 and C++11 compilation
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/cdd86bcf Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/cdd86bcf Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/cdd86bcf Branch: refs/heads/master Commit: cdd86bcfe748bb979d7f7f1a07a73ed81b0acabe Parents: 80d76d6 Author: Andrew Stitcher <astitc...@apache.org> Authored: Mon Sep 18 11:32:50 2017 -0400 Committer: Andrew Stitcher <astitc...@apache.org> Committed: Tue Sep 19 15:58:17 2017 -0400 ---------------------------------------------------------------------- proton-c/bindings/cpp/include/proton/sasl.hpp | 14 ++++---------- proton-c/bindings/cpp/include/proton/ssl.hpp | 19 ++++++++++--------- .../bindings/cpp/src/include/proton_bits.hpp | 4 ---- proton-c/bindings/cpp/src/transport.cpp | 4 ++-- 4 files changed, 16 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cdd86bcf/proton-c/bindings/cpp/include/proton/sasl.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/sasl.hpp b/proton-c/bindings/cpp/include/proton/sasl.hpp index e381dc7..a054086 100644 --- a/proton-c/bindings/cpp/include/proton/sasl.hpp +++ b/proton-c/bindings/cpp/include/proton/sasl.hpp @@ -41,19 +41,13 @@ class sasl { sasl(pn_sasl_t* s) : object_(s) {} /// @endcond - public: #if PN_CPP_HAS_DELETED_FUNCTIONS sasl() = delete; - sasl(const sasl&) = delete; - sasl& operator=(const sasl&) = delete; - sasl& operator=(sasl&&) = delete; -#endif -#if PN_CPP_HAS_DEFAULTED_FUNCTIONS - /// @cond INTERNAL - sasl(sasl&&) = default; - /// @endcond +#else + sasl(); #endif + public: /// The result of the SASL negotiation. enum outcome { NONE = PN_SASL_NONE, ///< Negotiation not completed @@ -77,7 +71,7 @@ class sasl { private: pn_sasl_t* const object_; - friend class internal::factory<sasl>; + friend class transport; /// @endcond }; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cdd86bcf/proton-c/bindings/cpp/include/proton/ssl.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/ssl.hpp b/proton-c/bindings/cpp/include/proton/ssl.hpp index 8186f71..62a0dc4 100644 --- a/proton-c/bindings/cpp/include/proton/ssl.hpp +++ b/proton-c/bindings/cpp/include/proton/ssl.hpp @@ -23,6 +23,8 @@ */ #include "./internal/export.hpp" +#include "./internal/config.hpp" + #include <proton/ssl.h> @@ -33,20 +35,19 @@ namespace proton { -namespace internal { -template <class T> class factory; -} - /// SSL information. class ssl { /// @cond INTERNAL ssl(pn_ssl_t* s) : object_(s) {} /// @endcond - public: - /// Create an empty ssl object. - ssl() : object_(0) {} +#if PN_CPP_HAS_DELETED_FUNCTIONS + ssl() = delete; +#else + ssl(); +#endif + public: /// Determines the level of peer validation. enum verify_mode { /// Require peer to provide a valid identifying certificate @@ -88,10 +89,10 @@ class ssl { /// @endcond private: - pn_ssl_t* object_; + pn_ssl_t* const object_; /// @cond INTERNAL - friend class internal::factory<ssl>; + friend class transport; /// @endcond }; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cdd86bcf/proton-c/bindings/cpp/src/include/proton_bits.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/include/proton_bits.hpp b/proton-c/bindings/cpp/src/include/proton_bits.hpp index 675249f..b6636f9 100644 --- a/proton-c/bindings/cpp/src/include/proton_bits.hpp +++ b/proton-c/bindings/cpp/src/include/proton_bits.hpp @@ -91,8 +91,6 @@ namespace internal { template <class T> struct wrapped {}; 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; }; template <> struct wrapped<connection> { typedef pn_connection_t type; }; template <> struct wrapped<session> { typedef pn_session_t type; }; template <> struct wrapped<link> { typedef pn_link_t type; }; @@ -109,8 +107,6 @@ template <> struct wrapped<target> { typedef pn_terminus_t type; }; template <class T> struct wrapper {}; 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; }; template <> struct wrapper<pn_connection_t> { typedef connection type; }; template <> struct wrapper<pn_session_t> { typedef session type; }; template <> struct wrapper<pn_link_t> { typedef link type; }; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cdd86bcf/proton-c/bindings/cpp/src/transport.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/transport.cpp b/proton-c/bindings/cpp/src/transport.cpp index da3119e..bd487dd 100644 --- a/proton-c/bindings/cpp/src/transport.cpp +++ b/proton-c/bindings/cpp/src/transport.cpp @@ -39,11 +39,11 @@ connection transport::connection() const { } class ssl transport::ssl() const { - return make_wrapper(pn_ssl(pn_object())); + return pn_ssl(pn_object()); } class sasl transport::sasl() const { - return make_wrapper(pn_sasl(pn_object())); + return pn_sasl(pn_object()); } error_condition transport::error() const { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org