Style fixes. Thanks Axel and Ingo.

This commit is contained in:
czeidler
2012-01-06 09:35:33 +13:00
parent 430fc0e90c
commit b5c5640ec0
2 changed files with 17 additions and 16 deletions
+2 -2
View File
@@ -61,7 +61,7 @@ public:
} }
template <typename OtherType> template<typename OtherType>
BReference(const BReference<OtherType>& other) BReference(const BReference<OtherType>& other)
: :
fObject(NULL) fObject(NULL)
@@ -131,7 +131,7 @@ public:
return *this; return *this;
} }
template <typename OtherType> template<typename OtherType>
BReference& operator=(const BReference<OtherType>& other) BReference& operator=(const BReference<OtherType>& other)
{ {
SetTo(other.Get()); SetTo(other.Get());
+15 -14
View File
@@ -87,7 +87,7 @@ public:
SetTo(other); SetTo(other);
} }
template <typename OtherType> template<typename OtherType>
BWeakReference(const BReference<OtherType>& other) BWeakReference(const BReference<OtherType>& other)
: :
fPointer(NULL) fPointer(NULL)
@@ -95,7 +95,7 @@ public:
SetTo(other.Get()); SetTo(other.Get());
} }
template <typename OtherType> template<typename OtherType>
BWeakReference(const BWeakReference<OtherType>& other) BWeakReference(const BWeakReference<OtherType>& other)
: :
fPointer(NULL) fPointer(NULL)
@@ -126,7 +126,7 @@ public:
} }
} }
template <typename OtherType> template<typename OtherType>
void SetTo(const BWeakReference<OtherType>& other) void SetTo(const BWeakReference<OtherType>& other)
{ {
// Just a compiler check if the types are compatible. // Just a compiler check if the types are compatible.
@@ -136,8 +136,8 @@ public:
Unset(); Unset();
if (other.Get()) { if (other.PrivatePointer()) {
fPointer = const_cast<WeakPointer*>(other.Get()); fPointer = const_cast<WeakPointer*>(other.PrivatePointer());
fPointer->AcquireReference(); fPointer->AcquireReference();
} }
} }
@@ -172,13 +172,6 @@ public:
return BReference<Type>(object, true); return BReference<Type>(object, true);
} }
/*! Do not use this if you do not know what you are doing. The WeakPointer
is for internal use only. */
const WeakPointer* Get() const
{
return fPointer;
}
BWeakReference& operator=(const BWeakReference<Type>& other) BWeakReference& operator=(const BWeakReference<Type>& other)
{ {
if (this == &other) if (this == &other)
@@ -200,14 +193,14 @@ public:
return *this; return *this;
} }
template <typename OtherType> template<typename OtherType>
BWeakReference& operator=(const BReference<OtherType>& other) BWeakReference& operator=(const BReference<OtherType>& other)
{ {
SetTo(other.Get()); SetTo(other.Get());
return *this; return *this;
} }
template <typename OtherType> template<typename OtherType>
BWeakReference& operator=(const BWeakReference<OtherType>& other) BWeakReference& operator=(const BWeakReference<OtherType>& other)
{ {
SetTo(other); SetTo(other);
@@ -224,6 +217,14 @@ public:
return fPointer != other.fPointer; return fPointer != other.fPointer;
} }
/*! Do not use this if you do not know what you are doing. The WeakPointer
is for internal use only.
*/
const WeakPointer* PrivatePointer() const
{
return fPointer;
}
private: private:
WeakPointer* fPointer; WeakPointer* fPointer;
}; };