qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject qpid-proton git commit: NO-JIRA: c++: Finish fixing compile error on older c++ compilers (noticed on gcc 4.7)
Date Wed, 21 Oct 2015 20:09:52 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master bbba61afe -> 60aafbc34


NO-JIRA: c++: Finish fixing compile error on older c++ compilers (noticed on gcc 4.7)


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

Branch: refs/heads/master
Commit: 60aafbc349ac95e5aa9752e983194966ca7fe526
Parents: bbba61a
Author: Alan Conway <aconway@redhat.com>
Authored: Wed Oct 21 16:02:55 2015 -0400
Committer: Alan Conway <aconway@redhat.com>
Committed: Wed Oct 21 16:03:04 2015 -0400

----------------------------------------------------------------------
 .../bindings/cpp/include/proton/endpoint.hpp    | 39 ++++++++++----------
 proton-c/bindings/cpp/src/endpoint.cpp          |  8 ++--
 2 files changed, 24 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/60aafbc3/proton-c/bindings/cpp/include/proton/endpoint.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/endpoint.hpp b/proton-c/bindings/cpp/include/proton/endpoint.hpp
index 5ed2646..d1cccb5 100644
--- a/proton-c/bindings/cpp/include/proton/endpoint.hpp
+++ b/proton-c/bindings/cpp/include/proton/endpoint.hpp
@@ -64,7 +64,7 @@ class endpoint
 };
 
 ///@cond INTERNAL
-template <class T, class D> class iter_base {
+template <class T> class iter_base {
   public:
     typedef T value_type;
 
@@ -72,17 +72,17 @@ template <class T, class D> class iter_base {
     T* operator->() const { return ptr_; }
     operator bool() const { return ptr_; }
     bool operator !() const { return !ptr_; }
-    iter_base<T, D>& operator++() { static_cast<D*>(this)->advance();
return *this; }
-    iter_base<T, D>& operator++(int) { iter_base<T, D> x(*this); ++(*this);
return x; }
-    bool operator==(const iter_base<T, D>& x) const { return ptr_ == x.ptr_; }
-    bool operator!=(const iter_base<T, D>& x) const { return ptr_ != x.ptr_; }
+    bool operator==(const iter_base<T>& x) const { return ptr_ == x.ptr_; }
+    bool operator!=(const iter_base<T>& x) const { return ptr_ != x.ptr_; }
 
   protected:
     explicit iter_base(T* p = 0, endpoint::state s = 0) : ptr_(p), state_(s) {}
     T* ptr_;
     endpoint::state state_;
 };
+///@endcond INTERNAL
 
+/// An iterator range.
 template<class I> class range {
   public:
     typedef I iterator;
@@ -93,35 +93,34 @@ template<class I> class range {
   private:
     I begin_, end_;
 };
-///@endcond INTERNAL
 
-///@ An iterator for a range of sessions.
-class session_iterator : public iter_base<session, session_iterator> {
+/// An iterator for sessions.
+class session_iterator : public iter_base<session> {
  public:
     explicit session_iterator(session* p = 0, endpoint::state s = 0) :
-        iter_base<session, session_iterator>(p, s) {}
-  private:
-    PN_CPP_EXTERN void advance();
-  friend class iter_base<session, session_iterator>;
+        iter_base<session>(p, s) {}
+    PN_CPP_EXTERN session_iterator operator++();
+    session_iterator operator++(int) { session_iterator x(*this); ++(*this); return x; }
 };
 
-///@ A range of sessions.
+/// A range of sessions.
 typedef range<session_iterator> session_range;
 
-///@ An iterator for a range of links.
-class link_iterator : public iter_base<link, link_iterator> {
+/// An iterator for links.
+class link_iterator : public iter_base<link> {
   public:
     explicit link_iterator(link* p = 0, endpoint::state s = 0) :
-        iter_base(p, s), session_(0) {}
+        iter_base<link>(p, s), session_(0) {}
     explicit link_iterator(const link_iterator& i, const session *ssn) :
-        iter_base(i.ptr_, i.state_), session_(ssn) {}
+        iter_base<link>(i.ptr_, i.state_), session_(ssn) {}
+    PN_CPP_EXTERN link_iterator operator++();
+    link_iterator operator++(int) { link_iterator x(*this); ++(*this); return x; }
+
   private:
-    PN_CPP_EXTERN void advance();
     const session* session_;
-  friend class iter_base<link, link_iterator>;
 };
 
-///@ A range of links.
+/// A range of links.
 typedef range<link_iterator> link_range;
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/60aafbc3/proton-c/bindings/cpp/src/endpoint.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/endpoint.cpp b/proton-c/bindings/cpp/src/endpoint.cpp
index 7f65054..34ea7c7 100644
--- a/proton-c/bindings/cpp/src/endpoint.cpp
+++ b/proton-c/bindings/cpp/src/endpoint.cpp
@@ -40,14 +40,16 @@ const int endpoint::REMOTE_CLOSED = PN_REMOTE_CLOSED;
 const int endpoint::LOCAL_MASK = PN_LOCAL_MASK;
 const int endpoint::REMOTE_MASK = PN_REMOTE_MASK;
 
-void session_iterator::advance() {
+session_iterator session_iterator::operator++() {
     ptr_ = session::cast(pn_session_next(pn_cast(ptr_), (pn_state_t) state_));
+    return *this;
 }
 
-void link_iterator::advance() {
+link_iterator link_iterator::operator++() {
     do {
         ptr_ = link::cast(pn_link_next(pn_cast(ptr_), (pn_state_t) state_));
-    } while (session_ && &ptr_->session() != session_);
+    } while (ptr_ && session_ && &ptr_->session() != session_);
+    return *this;
 }
 
 }


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


Mime
View raw message