[Scummvm-cvs-logs] SF.net SVN: scummvm:[48337] scummvm/trunk/common/ptr.h
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sat Mar 20 21:25:15 CET 2010
Revision: 48337
http://scummvm.svn.sourceforge.net/scummvm/?rev=48337&view=rev
Author: lordhoto
Date: 2010-03-20 20:25:12 +0000 (Sat, 20 Mar 2010)
Log Message:
-----------
- Renamed SharedPtr<T>::Pointer to SharedPtr<T>::PointerType
- Introduced ReferenceType to SharedPtr and ScopedPtr
Modified Paths:
--------------
scummvm/trunk/common/ptr.h
Modified: scummvm/trunk/common/ptr.h
===================================================================
--- scummvm/trunk/common/ptr.h 2010-03-20 20:16:16 UTC (rev 48336)
+++ scummvm/trunk/common/ptr.h 2010-03-20 20:25:12 UTC (rev 48337)
@@ -111,7 +111,8 @@
public:
typedef int RefValue;
typedef T ValueType;
- typedef T *Pointer;
+ typedef T *PointerType;
+ typedef T &ReferenceType;
SharedPtr() : _refCount(0), _deletion(0), _pointer(0) {}
@@ -152,8 +153,8 @@
return *this;
}
- ValueType &operator*() const { assert(_pointer); return *_pointer; }
- Pointer operator->() const { assert(_pointer); return _pointer; }
+ ReferenceType operator*() const { assert(_pointer); return *_pointer; }
+ PointerType operator->() const { assert(_pointer); return _pointer; }
/**
* Returns the plain pointer value. Be sure you know what you
@@ -161,7 +162,7 @@
*
* @return the pointer the SharedPtr object manages
*/
- Pointer get() const { return _pointer; }
+ PointerType get() const { return _pointer; }
/**
* Implicit conversion operator to bool for convenience, to make
@@ -219,7 +220,7 @@
RefValue *_refCount;
SharedPtrDeletionInternal *_deletion;
- T *_pointer;
+ PointerType _pointer;
};
template<typename T>
@@ -227,10 +228,11 @@
public:
typedef T ValueType;
typedef T *PointerType;
+ typedef T &ReferenceType;
explicit ScopedPtr(PointerType o = 0) : _pointer(o) {}
- ValueType &operator*() const { return *_pointer; }
+ ReferenceType operator*() const { return *_pointer; }
PointerType operator->() const { return _pointer; }
operator PointerType() const { return _pointer; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list