Repository: qpid-proton Updated Branches: refs/heads/cjansen-cpp-client 697830998 -> 9d5bf7d77
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9d5bf7d7/proton-c/bindings/cpp/include/proton/messaging_handler.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/messaging_handler.hpp b/proton-c/bindings/cpp/include/proton/messaging_handler.hpp index 9380755..946b9b5 100644 --- a/proton-c/bindings/cpp/include/proton/messaging_handler.hpp +++ b/proton-c/bindings/cpp/include/proton/messaging_handler.hpp @@ -35,7 +35,7 @@ class messaging_handler : public proton_handler , public acking { public: PN_CPP_EXTERN messaging_handler(int prefetch=10, bool auto_accept=true, bool auto_settle=true, - bool peer_close_isError=false); + bool peer_close_is_error=false); PN_CPP_EXTERN virtual ~messaging_handler(); PN_CPP_EXTERN virtual void on_abort(event &e); @@ -48,7 +48,7 @@ class messaging_handler : public proton_handler , public acking PN_CPP_EXTERN virtual void on_connection_opened(event &e); PN_CPP_EXTERN virtual void on_disconnected(event &e); PN_CPP_EXTERN virtual void on_fetch(event &e); - PN_CPP_EXTERN virtual void on_idLoaded(event &e); + PN_CPP_EXTERN virtual void on_id_loaded(event &e); PN_CPP_EXTERN virtual void on_link_closed(event &e); PN_CPP_EXTERN virtual void on_link_closing(event &e); PN_CPP_EXTERN virtual void on_link_error(event &e); @@ -85,7 +85,7 @@ class messaging_handler : public proton_handler , public acking handler *flow_controller_; PN_CPP_EXTERN messaging_handler( bool raw_handler, int prefetch=10, bool auto_accept=true, - bool auto_settle=true, bool peer_close_isError=false); + bool auto_settle=true, bool peer_close_is_error=false); friend class container_impl; friend class messaging_adapter; PN_CPP_EXTERN void create_helpers(); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9d5bf7d7/proton-c/bindings/cpp/include/proton/type_traits.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/type_traits.hpp b/proton-c/bindings/cpp/include/proton/type_traits.hpp index f30d980..b804e77 100644 --- a/proton-c/bindings/cpp/include/proton/type_traits.hpp +++ b/proton-c/bindings/cpp/include/proton/type_traits.hpp @@ -1,5 +1,5 @@ -#ifndef ENABLE_If_HPP -#define ENABLE_If_HPP +#ifndef TYPE_TRAITS_HPP +#define TYPE_TRAITS_HPP /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -19,15 +19,20 @@ * under the License. */ +///@cond INTERNAL_DETAIL + #include "proton/types.hpp" #if defined(__cplusplus) && __cplusplus >= 201100 #include <type_traits> #else +/** + * Workaround missing std:: classes on older C++ compilers. NOTE: this is NOT a + * full implementation of the standard c++11 types, it is the bare minimum + * needed by this library. + */ namespace std { -// Workaround for older C++ compilers. NOTE this is NOT a full implementation of the -// corresponding c++11 types, it is the bare minimum needed by this library. template <bool, class T=void> struct enable_if; template <class T> struct enable_if<true, T> { typedef T type; }; @@ -58,37 +63,44 @@ template <> struct is_signed<signed char> : public true_type {}; template <> struct is_signed<signed short> : public true_type {}; template <> struct is_signed<signed int> : public true_type {}; template <> struct is_signed<signed long> : public true_type {}; + +#if PN_HAVE_LONG_LONG +template <> struct is_integral<unsigned long long> : public true_type {}; +template <> struct is_integral<signed long long> : public true_type {}; +template <> struct is_signed<unsigned long long> : public false_type {}; +template <> struct is_signed<signed long long> : public true_type {}; +#endif } #endif // Old C++ workarounds namespace proton { // Metafunction returning exact AMQP type associated with a C++ type -template <class T> struct type_idOf; -template<> struct type_idOf<amqp_null> { static const type_id value=NULl_; }; -template<> struct type_idOf<amqp_bool> { static const type_id value=BOOL; }; -template<> struct type_idOf<amqp_ubyte> { static const type_id value=UBYTE; }; -template<> struct type_idOf<amqp_byte> { static const type_id value=BYTE; }; -template<> struct type_idOf<amqp_ushort> { static const type_id value=USHORT; }; -template<> struct type_idOf<amqp_short> { static const type_id value=SHORT; }; -template<> struct type_idOf<amqp_uint> { static const type_id value=UINT; }; -template<> struct type_idOf<amqp_int> { static const type_id value=INT; }; -template<> struct type_idOf<amqp_char> { static const type_id value=CHAR; }; -template<> struct type_idOf<amqp_ulong> { static const type_id value=ULONG; }; -template<> struct type_idOf<amqp_long> { static const type_id value=LONG; }; -template<> struct type_idOf<amqp_timestamp> { static const type_id value=TIMESTAMP; }; -template<> struct type_idOf<amqp_float> { static const type_id value=FLOAT; }; -template<> struct type_idOf<amqp_double> { static const type_id value=DOUBLE; }; -template<> struct type_idOf<amqp_decimal32> { static const type_id value=DECIMAL32; }; -template<> struct type_idOf<amqp_decimal64> { static const type_id value=DECIMAL64; }; -template<> struct type_idOf<amqp_decimal128> { static const type_id value=DECIMAL128; }; -template<> struct type_idOf<amqp_uuid> { static const type_id value=UUID; }; -template<> struct type_idOf<amqp_binary> { static const type_id value=BINARY; }; -template<> struct type_idOf<amqp_string> { static const type_id value=STRING; }; -template<> struct type_idOf<amqp_symbol> { static const type_id value=SYMBOL; }; +template <class T> struct type_id_of; +template<> struct type_id_of<amqp_null> { static const type_id value=NULl_; }; +template<> struct type_id_of<amqp_bool> { static const type_id value=BOOL; }; +template<> struct type_id_of<amqp_ubyte> { static const type_id value=UBYTE; }; +template<> struct type_id_of<amqp_byte> { static const type_id value=BYTE; }; +template<> struct type_id_of<amqp_ushort> { static const type_id value=USHORT; }; +template<> struct type_id_of<amqp_short> { static const type_id value=SHORT; }; +template<> struct type_id_of<amqp_uint> { static const type_id value=UINT; }; +template<> struct type_id_of<amqp_int> { static const type_id value=INT; }; +template<> struct type_id_of<amqp_char> { static const type_id value=CHAR; }; +template<> struct type_id_of<amqp_ulong> { static const type_id value=ULONG; }; +template<> struct type_id_of<amqp_long> { static const type_id value=LONG; }; +template<> struct type_id_of<amqp_timestamp> { static const type_id value=TIMESTAMP; }; +template<> struct type_id_of<amqp_float> { static const type_id value=FLOAT; }; +template<> struct type_id_of<amqp_double> { static const type_id value=DOUBLE; }; +template<> struct type_id_of<amqp_decimal32> { static const type_id value=DECIMAL32; }; +template<> struct type_id_of<amqp_decimal64> { static const type_id value=DECIMAL64; }; +template<> struct type_id_of<amqp_decimal128> { static const type_id value=DECIMAL128; }; +template<> struct type_id_of<amqp_uuid> { static const type_id value=UUID; }; +template<> struct type_id_of<amqp_binary> { static const type_id value=BINARY; }; +template<> struct type_id_of<amqp_string> { static const type_id value=STRING; }; +template<> struct type_id_of<amqp_symbol> { static const type_id value=SYMBOL; }; template <class T, class Enable=void> struct has_type_id { static const bool value = false; }; -template <class T> struct has_type_id<T, typename std::enable_if<type_idOf<T>::value>::type> { +template <class T> struct has_type_id<T, typename std::enable_if<type_id_of<T>::value>::type> { static const bool value = true; }; @@ -105,8 +117,11 @@ template<> struct integer_type<8, false> { typedef amqp_ulong type; }; // True if T is an integer type that does not have a type_id mapping. template <class T> struct is_unknown_integer { - static const bool value = !has_type_id<T>::value && std::is_integral<T>::value; + static const bool value = bool((!has_type_id<T>::value) && std::is_integral<T>::value); }; } -#endif // ENABLE_If_HPP + +///@endcond + +#endif // TYPE_TRAITS_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9d5bf7d7/proton-c/bindings/cpp/include/proton/types.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/types.hpp b/proton-c/bindings/cpp/include/proton/types.hpp index efde10c..f3adbf5 100644 --- a/proton-c/bindings/cpp/include/proton/types.hpp +++ b/proton-c/bindings/cpp/include/proton/types.hpp @@ -25,6 +25,7 @@ */ #include "proton/export.hpp" +#include "proton/cstdint.hpp" #include <proton/codec.h> #include <algorithm> #include <bitset> @@ -32,24 +33,6 @@ #include <memory.h> #include <algorithm> -// Workaround for older C++ compilers -#if defined(__cplusplus) && __cplusplus >= 201100 -#include <cstdint> -#else // Workaround for older C++ compilers -#include <proton/type_compat.h> -namespace std { -// Exact-size integer types. -using ::int8_t; -using ::int16_t; -using ::int32_t; -using ::int64_t; -using ::uint8_t; -using ::uint16_t; -using ::uint32_t; -using ::uint64_t; -} -#endif - namespace proton { /** type_id identifies an AMQP type. http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9d5bf7d7/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 d1f17cf..92df1f7 100644 --- a/proton-c/bindings/cpp/src/decoder.cpp +++ b/proton-c/bindings/cpp/src/decoder.cpp @@ -96,7 +96,7 @@ type_id pre_get(pn_data_t* data) { // Simple extract with no type conversion. template <class T, class U> void extract(pn_data_t* data, T& value, U (*get)(pn_data_t*)) { save_state ss(data); - bad_type(type_idOf<T>::value, pre_get(data)); + bad_type(type_id_of<T>::value, pre_get(data)); value = get(data); ss.cancel(); // No error, no rewind } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9d5bf7d7/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 1d8a871..a8c0fe1 100644 --- a/proton-c/bindings/cpp/src/interop_test.cpp +++ b/proton-c/bindings/cpp/src/interop_test.cpp @@ -47,7 +47,7 @@ string read(string filename) { return string(istreambuf_iterator<char>(ifs), istreambuf_iterator<char>()); } -template <class T> T get(decoder& d) { return d.get_as<T, type_idOf<T>::value>(); } +template <class T> T get(decoder& d) { return d.get_as<T, type_id_of<T>::value>(); } template <class T> std::string str(const T& value) { ostringstream oss; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9d5bf7d7/proton-c/bindings/cpp/src/messaging_handler.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/messaging_handler.cpp b/proton-c/bindings/cpp/src/messaging_handler.cpp index 184cc9e..76e3572 100644 --- a/proton-c/bindings/cpp/src/messaging_handler.cpp +++ b/proton-c/bindings/cpp/src/messaging_handler.cpp @@ -52,15 +52,15 @@ class Cflow_controller : public proton_handler -messaging_handler::messaging_handler(int prefetch0, bool auto_accept0, bool auto_settle0, bool peer_close_isError0) : - prefetch_(prefetch0), auto_accept_(auto_accept0), auto_settle_(auto_settle0), peer_close_iserror_(peer_close_isError0) +messaging_handler::messaging_handler(int prefetch0, bool auto_accept0, bool auto_settle0, bool peer_close_is_error0) : + prefetch_(prefetch0), auto_accept_(auto_accept0), auto_settle_(auto_settle0), peer_close_iserror_(peer_close_is_error0) { create_helpers(); } messaging_handler::messaging_handler(bool raw_handler, int prefetch0, bool auto_accept0, bool auto_settle0, - bool peer_close_isError0) : - prefetch_(prefetch0), auto_accept_(auto_accept0), auto_settle_(auto_settle0), peer_close_iserror_(peer_close_isError0) + bool peer_close_is_error0) : + prefetch_(prefetch0), auto_accept_(auto_accept0), auto_settle_(auto_settle0), peer_close_iserror_(peer_close_is_error0) { if (raw_handler) { flow_controller_ = 0; @@ -94,7 +94,7 @@ void messaging_handler::on_connection_opened(event &e) { on_unhandled(e); } void messaging_handler::on_connection_opening(event &e) { on_unhandled(e); } void messaging_handler::on_disconnected(event &e) { on_unhandled(e); } void messaging_handler::on_fetch(event &e) { on_unhandled(e); } -void messaging_handler::on_idLoaded(event &e) { on_unhandled(e); } +void messaging_handler::on_id_loaded(event &e) { on_unhandled(e); } void messaging_handler::on_link_closed(event &e) { on_unhandled(e); } void messaging_handler::on_link_closing(event &e) { on_unhandled(e); } void messaging_handler::on_link_error(event &e) { on_unhandled(e); } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9d5bf7d7/proton-c/docs/api/index.md ---------------------------------------------------------------------- diff --git a/proton-c/docs/api/index.md b/proton-c/docs/api/index.md index ab3267a..10aea84 100644 --- a/proton-c/docs/api/index.md +++ b/proton-c/docs/api/index.md @@ -1,7 +1,5 @@ Proton Documentation {#index} ==================== -The proton library contains two C APIs: The [Engine API](@ref engine), +The proton library contains two APIs: The [Engine API](@ref engine), and the [Messenger API](@ref messenger). - -There is also a [C++ API](@ref cpp). http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9d5bf7d7/proton-c/docs/api/user.doxygen.in ---------------------------------------------------------------------- diff --git a/proton-c/docs/api/user.doxygen.in b/proton-c/docs/api/user.doxygen.in index 951c2fb..82048cb 100644 --- a/proton-c/docs/api/user.doxygen.in +++ b/proton-c/docs/api/user.doxygen.in @@ -642,7 +642,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = @CMAKE_SOURCE_DIR@/proton-c/include @CMAKE_SOURCE_DIR@/proton-c/docs/api @CMAKE_SOURCE_DIR@/proton-c/bindings/cpp/include +INPUT = @CMAKE_SOURCE_DIR@/proton-c/include @CMAKE_SOURCE_DIR@/proton-c/docs/api # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
