NO-JIRA: [cpp] added missing to_string and operator<< For transfer::state and proton::uuid
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/ba928611 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/ba928611 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/ba928611 Branch: refs/heads/go1 Commit: ba928611bbb6cdc26cfcb5027981c4e7091f2939 Parents: d9a74ef Author: Alan Conway <acon...@redhat.com> Authored: Wed Jun 6 00:17:07 2018 -0400 Committer: Alan Conway <acon...@redhat.com> Committed: Thu Jun 7 17:35:09 2018 -0400 ---------------------------------------------------------------------- cpp/include/proton/transfer.hpp | 4 ++++ cpp/include/proton/uuid.hpp | 1 + cpp/src/transfer.cpp | 5 +++++ 3 files changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ba928611/cpp/include/proton/transfer.hpp ---------------------------------------------------------------------- diff --git a/cpp/include/proton/transfer.hpp b/cpp/include/proton/transfer.hpp index 7727b54..3e02ca9 100644 --- a/cpp/include/proton/transfer.hpp +++ b/cpp/include/proton/transfer.hpp @@ -27,6 +27,7 @@ #include "./internal/object.hpp" #include <proton/disposition.h> +#include <iosfwd> /// @file /// @copybrief proton::transfer @@ -81,6 +82,9 @@ class transfer : public internal::object<pn_delivery_t> { /// @endcond }; +PN_CPP_EXTERN std::string to_string(enum transfer::state); +PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const enum transfer::state); + } // proton #endif // PROTON_TRANSFER_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ba928611/cpp/include/proton/uuid.hpp ---------------------------------------------------------------------- diff --git a/cpp/include/proton/uuid.hpp b/cpp/include/proton/uuid.hpp index 66578df..f80541c 100644 --- a/cpp/include/proton/uuid.hpp +++ b/cpp/include/proton/uuid.hpp @@ -59,6 +59,7 @@ class uuid : public byte_array<16> { /// UUID standard format: 8-4-4-4-12 (36 chars, 32 alphanumeric chars /// and 4 hyphens). PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const uuid&); +inline std::string to_string(const uuid& u) { return u.str(); } } // proton http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ba928611/cpp/src/transfer.cpp ---------------------------------------------------------------------- diff --git a/cpp/src/transfer.cpp b/cpp/src/transfer.cpp index 8066dd5..a024abf 100644 --- a/cpp/src/transfer.cpp +++ b/cpp/src/transfer.cpp @@ -31,6 +31,8 @@ #include "proton_bits.hpp" +#include <ostream> + namespace proton { session transfer::session() const { return make_wrapper(pn_link_session(pn_delivery_link(pn_object()))); } @@ -44,4 +46,7 @@ bool transfer::settled() const { return pn_delivery_settled(pn_object()); } void transfer::settle() { pn_delivery_settle(pn_object()); } enum transfer::state transfer::state() const { return static_cast<enum state>(pn_delivery_remote_state(pn_object())); } + +std::string to_string(enum transfer::state s) { return pn_disposition_type_name(s); } +std::ostream& operator<<(std::ostream& o, const enum transfer::state s) { return o << to_string(s); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org