[Scummvm-cvs-logs] SF.net SVN: scummvm:[48329] scummvm/trunk/engines/teenagent/detection.cpp
megath at users.sourceforge.net
megath at users.sourceforge.net
Sat Mar 20 18:06:18 CET 2010
Revision: 48329
http://scummvm.svn.sourceforge.net/scummvm/?rev=48329&view=rev
Author: megath
Date: 2010-03-20 17:06:18 +0000 (Sat, 20 Mar 2010)
Log Message:
-----------
removed auto_ptr semantics in a favor of boost's scoped_ptr
Modified Paths:
--------------
scummvm/trunk/engines/teenagent/detection.cpp
Modified: scummvm/trunk/engines/teenagent/detection.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/detection.cpp 2010-03-20 17:05:59 UTC (rev 48328)
+++ scummvm/trunk/engines/teenagent/detection.cpp 2010-03-20 17:06:18 UTC (rev 48329)
@@ -79,27 +79,21 @@
//add it to ptr.h?
template<typename T>
-class AutoPtr {
+class ScopedPtr : Common::NonCopyable {
protected:
- mutable T *object;
+ T *object;
public:
typedef T ValueType;
typedef T *PointerType;
- inline AutoPtr(T *o = NULL): object(o) {}
- inline AutoPtr(const AutoPtr& other): object(other.release()) {}
- inline AutoPtr& operator=(const AutoPtr& other) {
- delete object;
- object = other.release();
- return *this;
- }
+ inline explicit ScopedPtr(T *o = NULL): object(o) {}
inline T *operator->() const { return object; }
inline operator T*() const { return object; }
inline operator bool() const { return object != NULL; }
- inline ~AutoPtr() {
+ inline ~ScopedPtr() {
delete object;
}
@@ -108,7 +102,9 @@
object = o;
}
- inline T *release() const {
+ inline T *get() { return object; }
+
+ inline T *release() {
T *r = object;
object = NULL;
return r;
@@ -169,7 +165,7 @@
int slot;
const char *ext = strrchr(file->c_str(), '.');
if (ext && (slot = atoi(ext + 1)) >= 0 && slot < MAX_SAVES) {
- AutoPtr<Common::InSaveFile> in = g_system->getSavefileManager()->openForLoading(*file);
+ ScopedPtr<Common::InSaveFile> in(g_system->getSavefileManager()->openForLoading(*file));
if (!in)
continue;
@@ -194,7 +190,7 @@
virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const {
Common::String filename = generateGameStateFileName(target, slot);
- AutoPtr<Common::InSaveFile> in = g_system->getSavefileManager()->openForLoading(filename);
+ ScopedPtr<Common::InSaveFile> in(g_system->getSavefileManager()->openForLoading(filename));
if (!in)
return SaveStateDescriptor();
@@ -213,7 +209,7 @@
ssd.setDeletableFlag(true);
//checking for the thumbnail
- AutoPtr<Graphics::Surface> thumb = new Graphics::Surface;
+ ScopedPtr<Graphics::Surface> thumb(new Graphics::Surface);
if (Graphics::loadThumbnail(*in, *thumb))
ssd.setThumbnail(thumb.release());
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