aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorVladimir Menshakov2010-03-20 17:06:18 +0000
committerVladimir Menshakov2010-03-20 17:06:18 +0000
commit7666cac789506b367c504da41ce105e5e351c3dd (patch)
treef362d294717c70f7d127ea662de67b8a9622c037 /engines
parentb5d3d0ebcff5a369e4bea4ccdd73877e674ce3f3 (diff)
downloadscummvm-rg350-7666cac789506b367c504da41ce105e5e351c3dd.tar.gz
scummvm-rg350-7666cac789506b367c504da41ce105e5e351c3dd.tar.bz2
scummvm-rg350-7666cac789506b367c504da41ce105e5e351c3dd.zip
removed auto_ptr semantics in a favor of boost's scoped_ptr
svn-id: r48329
Diffstat (limited to 'engines')
-rw-r--r--engines/teenagent/detection.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp
index 0dc86d57db..559b3c8b17 100644
--- a/engines/teenagent/detection.cpp
+++ b/engines/teenagent/detection.cpp
@@ -79,27 +79,21 @@ static const ADParams detectionParams = {
//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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
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());