From 95b3beb23d5013bc50a8b381ab73b59b19a5e7cb Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 12 Jun 2010 14:29:13 +0000 Subject: [PATCH] 2010-06-12 Tatsuhiro Tsujikawa Renamed member variables * src/SharedHandle.h --- ChangeLog | 5 +++ src/SharedHandle.h | 90 +++++++++++++++++++++++----------------------- 2 files changed, 50 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f5d9bdc..eb83b1f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-06-12 Tatsuhiro Tsujikawa + + Renamed member variables + * src/SharedHandle.h + 2010-06-12 Tatsuhiro Tsujikawa Renamed member variables diff --git a/src/SharedHandle.h b/src/SharedHandle.h index df3f5350..39d2254a 100644 --- a/src/SharedHandle.h +++ b/src/SharedHandle.h @@ -193,55 +193,55 @@ private: template friend class WeakHandle; - T* obj; + T* _obj; - SharedCount ucount; + SharedCount _ucount; public: - SharedHandle():obj(0), ucount() {} + SharedHandle():_obj(0), _ucount() {} - explicit SharedHandle(T* obj):obj(obj), ucount() {} + explicit SharedHandle(T* obj):_obj(obj), _ucount() {} - SharedHandle(const SharedHandle& t):obj(t.obj), ucount(t.ucount) {} + SharedHandle(const SharedHandle& t):_obj(t._obj), _ucount(t._ucount) {} template - SharedHandle(const SharedHandle& t):obj(t.obj), ucount(t.ucount) {} + SharedHandle(const SharedHandle& t):_obj(t._obj), _ucount(t._ucount) {} template SharedHandle(const SharedHandle& t, T* p): - obj(p), ucount(t.ucount) {} + _obj(p), _ucount(t._ucount) {} ~SharedHandle() { - if(ucount.getRefCount() == 1) { - delete obj; + if(_ucount.getRefCount() == 1) { + delete _obj; } } SharedHandle& operator=(const SharedHandle& t) { - if(ucount.reassign(t.ucount)) { - delete obj; + if(_ucount.reassign(t._ucount)) { + delete _obj; } - obj = t.obj; + _obj = t._obj; return *this; } template SharedHandle& operator=(const SharedHandle& t) { - if(ucount.reassign(t.ucount)) { - delete obj; + if(_ucount.reassign(t._ucount)) { + delete _obj; } - obj = t.obj; + _obj = t._obj; return *this; } - T* operator->() const { return obj; } + T* operator->() const { return _obj; } T* get() const { - return obj; + return _obj; } size_t getRefCount() const { - return ucount.getRefCount(); + return _ucount.getRefCount(); } void reset() { @@ -253,7 +253,7 @@ public: } bool isNull() const { - return obj == 0; + return _obj == 0; } }; @@ -269,23 +269,23 @@ dynamic_pointer_cast(const SharedHandle& t) { template std::ostream& operator<<(std::ostream& o, const SharedHandle& sp) { - o << *sp.obj; + o << *sp._obj; return o; } template bool operator==(const SharedHandle& t1, const SharedHandle& t2) { - return *t1.obj == *t2.obj; + return *t1._obj == *t2._obj; } template bool operator!=(const SharedHandle& t1, const SharedHandle& t2) { - return *t1.obj != *t2.obj; + return *t1._obj != *t2._obj; } template bool operator<(const SharedHandle& t1, const SharedHandle& t2) { - return *t1.obj < *t2.obj; + return *t1._obj < *t2._obj; } template @@ -307,60 +307,60 @@ private: template friend class WeakHandle; - T* obj; + T* _obj; - WeakCount ucount; + WeakCount _ucount; public: - WeakHandle():obj(0), ucount(WeakRef()) {} + WeakHandle():_obj(0), _ucount(WeakRef()) {} - explicit WeakHandle(T* obj):obj(obj), ucount(StrongRef()) {} + explicit WeakHandle(T* obj):_obj(obj), _ucount(StrongRef()) {} - WeakHandle(const WeakHandle& t):obj(t.obj), ucount(t.ucount) {} + WeakHandle(const WeakHandle& t):_obj(t._obj), _ucount(t._ucount) {} template - WeakHandle(const SharedHandle& t):obj(t.obj), ucount(t.ucount) {} + WeakHandle(const SharedHandle& t):_obj(t._obj), _ucount(t._ucount) {} template WeakHandle(const WeakHandle& t, T* p): - obj(p), ucount(t.ucount) {} + _obj(p), _ucount(t._ucount) {} ~WeakHandle() {} WeakHandle& operator=(const WeakHandle& t) { - ucount.reassign(t.ucount); - obj = t.obj; + _ucount.reassign(t._ucount); + _obj = t._obj; return *this; } template WeakHandle& operator=(const SharedHandle& t) { - ucount.reassign(t.ucount); - obj = t.obj; + _ucount.reassign(t._ucount); + _obj = t._obj; return *this; } template WeakHandle& operator=(const WeakHandle& t) { - ucount.reassign(t.ucount); - obj = t.obj; + _ucount.reassign(t._ucount); + _obj = t._obj; return *this; } - T* operator->() { return obj; } + T* operator->() { return _obj; } - T* operator->() const { return obj; } + T* operator->() const { return _obj; } T* get() const { if(isNull()) { return 0; } else { - return obj; + return _obj; } } size_t getRefCount() const { - return ucount.getRefCount(); + return _ucount.getRefCount(); } void reset() { @@ -368,29 +368,29 @@ public: } bool isNull() const { - return ucount.getRefCount() == 0 || obj == 0; + return _ucount.getRefCount() == 0 || _obj == 0; } }; template std::ostream& operator<<(std::ostream& o, const WeakHandle& sp) { - o << *sp.obj; + o << *sp._obj; return o; } template bool operator==(const WeakHandle& t1, const WeakHandle& t2) { - return *t1.obj == *t2.obj; + return *t1._obj == *t2._obj; } template bool operator!=(const WeakHandle& t1, const WeakHandle& t2) { - return *t1.obj != *t2.obj; + return *t1._obj != *t2._obj; } template bool operator<(const WeakHandle& t1, const WeakHandle& t2) { - return *t1.obj < *t2.obj; + return *t1._obj < *t2._obj; } template