mirror of https://github.com/aria2/aria2
2010-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Renamed member variables * src/SharedHandle.hpull/1/head
parent
e91fbed8ca
commit
95b3beb23d
|
@ -1,3 +1,8 @@
|
||||||
|
2010-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Renamed member variables
|
||||||
|
* src/SharedHandle.h
|
||||||
|
|
||||||
2010-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Renamed member variables
|
Renamed member variables
|
||||||
|
|
|
@ -193,55 +193,55 @@ private:
|
||||||
|
|
||||||
template<typename S> friend class WeakHandle;
|
template<typename S> friend class WeakHandle;
|
||||||
|
|
||||||
T* obj;
|
T* _obj;
|
||||||
|
|
||||||
SharedCount ucount;
|
SharedCount _ucount;
|
||||||
|
|
||||||
public:
|
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<typename S>
|
template<typename S>
|
||||||
SharedHandle(const SharedHandle<S>& t):obj(t.obj), ucount(t.ucount) {}
|
SharedHandle(const SharedHandle<S>& t):_obj(t._obj), _ucount(t._ucount) {}
|
||||||
|
|
||||||
template<typename S>
|
template<typename S>
|
||||||
SharedHandle(const SharedHandle<S>& t, T* p):
|
SharedHandle(const SharedHandle<S>& t, T* p):
|
||||||
obj(p), ucount(t.ucount) {}
|
_obj(p), _ucount(t._ucount) {}
|
||||||
|
|
||||||
~SharedHandle() {
|
~SharedHandle() {
|
||||||
if(ucount.getRefCount() == 1) {
|
if(_ucount.getRefCount() == 1) {
|
||||||
delete obj;
|
delete _obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedHandle& operator=(const SharedHandle& t) {
|
SharedHandle& operator=(const SharedHandle& t) {
|
||||||
if(ucount.reassign(t.ucount)) {
|
if(_ucount.reassign(t._ucount)) {
|
||||||
delete obj;
|
delete _obj;
|
||||||
}
|
}
|
||||||
obj = t.obj;
|
_obj = t._obj;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename S>
|
template<typename S>
|
||||||
SharedHandle& operator=(const SharedHandle<S>& t) {
|
SharedHandle& operator=(const SharedHandle<S>& t) {
|
||||||
if(ucount.reassign(t.ucount)) {
|
if(_ucount.reassign(t._ucount)) {
|
||||||
delete obj;
|
delete _obj;
|
||||||
}
|
}
|
||||||
obj = t.obj;
|
_obj = t._obj;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
T* operator->() const { return obj; }
|
T* operator->() const { return _obj; }
|
||||||
|
|
||||||
T* get() const {
|
T* get() const {
|
||||||
return obj;
|
return _obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t getRefCount() const {
|
size_t getRefCount() const {
|
||||||
return ucount.getRefCount();
|
return _ucount.getRefCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
@ -253,7 +253,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isNull() const {
|
bool isNull() const {
|
||||||
return obj == 0;
|
return _obj == 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -269,23 +269,23 @@ dynamic_pointer_cast(const SharedHandle<S>& t) {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
std::ostream& operator<<(std::ostream& o, const SharedHandle<T>& sp) {
|
std::ostream& operator<<(std::ostream& o, const SharedHandle<T>& sp) {
|
||||||
o << *sp.obj;
|
o << *sp._obj;
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
bool operator==(const SharedHandle<T1>& t1, const SharedHandle<T2>& t2) {
|
bool operator==(const SharedHandle<T1>& t1, const SharedHandle<T2>& t2) {
|
||||||
return *t1.obj == *t2.obj;
|
return *t1._obj == *t2._obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
bool operator!=(const SharedHandle<T1>& t1, const SharedHandle<T2>& t2) {
|
bool operator!=(const SharedHandle<T1>& t1, const SharedHandle<T2>& t2) {
|
||||||
return *t1.obj != *t2.obj;
|
return *t1._obj != *t2._obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
bool operator<(const SharedHandle<T1>& t1, const SharedHandle<T2>& t2) {
|
bool operator<(const SharedHandle<T1>& t1, const SharedHandle<T2>& t2) {
|
||||||
return *t1.obj < *t2.obj;
|
return *t1._obj < *t2._obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -307,60 +307,60 @@ private:
|
||||||
|
|
||||||
template<typename S> friend class WeakHandle;
|
template<typename S> friend class WeakHandle;
|
||||||
|
|
||||||
T* obj;
|
T* _obj;
|
||||||
|
|
||||||
WeakCount ucount;
|
WeakCount _ucount;
|
||||||
|
|
||||||
public:
|
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<typename S>
|
template<typename S>
|
||||||
WeakHandle(const SharedHandle<S>& t):obj(t.obj), ucount(t.ucount) {}
|
WeakHandle(const SharedHandle<S>& t):_obj(t._obj), _ucount(t._ucount) {}
|
||||||
|
|
||||||
template<typename S>
|
template<typename S>
|
||||||
WeakHandle(const WeakHandle<S>& t, T* p):
|
WeakHandle(const WeakHandle<S>& t, T* p):
|
||||||
obj(p), ucount(t.ucount) {}
|
_obj(p), _ucount(t._ucount) {}
|
||||||
|
|
||||||
~WeakHandle() {}
|
~WeakHandle() {}
|
||||||
|
|
||||||
WeakHandle& operator=(const WeakHandle& t) {
|
WeakHandle& operator=(const WeakHandle& t) {
|
||||||
ucount.reassign(t.ucount);
|
_ucount.reassign(t._ucount);
|
||||||
obj = t.obj;
|
_obj = t._obj;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename S>
|
template<typename S>
|
||||||
WeakHandle& operator=(const SharedHandle<S>& t) {
|
WeakHandle& operator=(const SharedHandle<S>& t) {
|
||||||
ucount.reassign(t.ucount);
|
_ucount.reassign(t._ucount);
|
||||||
obj = t.obj;
|
_obj = t._obj;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename S>
|
template<typename S>
|
||||||
WeakHandle& operator=(const WeakHandle<S>& t) {
|
WeakHandle& operator=(const WeakHandle<S>& t) {
|
||||||
ucount.reassign(t.ucount);
|
_ucount.reassign(t._ucount);
|
||||||
obj = t.obj;
|
_obj = t._obj;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
T* operator->() { return obj; }
|
T* operator->() { return _obj; }
|
||||||
|
|
||||||
T* operator->() const { return obj; }
|
T* operator->() const { return _obj; }
|
||||||
|
|
||||||
T* get() const {
|
T* get() const {
|
||||||
if(isNull()) {
|
if(isNull()) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return obj;
|
return _obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t getRefCount() const {
|
size_t getRefCount() const {
|
||||||
return ucount.getRefCount();
|
return _ucount.getRefCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
@ -368,29 +368,29 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isNull() const {
|
bool isNull() const {
|
||||||
return ucount.getRefCount() == 0 || obj == 0;
|
return _ucount.getRefCount() == 0 || _obj == 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
std::ostream& operator<<(std::ostream& o, const WeakHandle<T>& sp) {
|
std::ostream& operator<<(std::ostream& o, const WeakHandle<T>& sp) {
|
||||||
o << *sp.obj;
|
o << *sp._obj;
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
bool operator==(const WeakHandle<T1>& t1, const WeakHandle<T2>& t2) {
|
bool operator==(const WeakHandle<T1>& t1, const WeakHandle<T2>& t2) {
|
||||||
return *t1.obj == *t2.obj;
|
return *t1._obj == *t2._obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
bool operator!=(const WeakHandle<T1>& t1, const WeakHandle<T2>& t2) {
|
bool operator!=(const WeakHandle<T1>& t1, const WeakHandle<T2>& t2) {
|
||||||
return *t1.obj != *t2.obj;
|
return *t1._obj != *t2._obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
bool operator<(const WeakHandle<T1>& t1, const WeakHandle<T2>& t2) {
|
bool operator<(const WeakHandle<T1>& t1, const WeakHandle<T2>& t2) {
|
||||||
return *t1.obj < *t2.obj;
|
return *t1._obj < *t2._obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename S>
|
template<typename T, typename S>
|
||||||
|
|
Loading…
Reference in New Issue