[Scummvm-cvs-logs] SF.net SVN: scummvm:[34098] scummvm/trunk/backends
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Fri Aug 22 13:36:48 CEST 2008
Revision: 34098
http://scummvm.svn.sourceforge.net/scummvm/?rev=34098&view=rev
Author: fingolfin
Date: 2008-08-22 11:36:47 +0000 (Fri, 22 Aug 2008)
Log Message:
-----------
Turned Windows, AmigaOS and POSIX FSFactories into plain classes; no need for them to be singletons (actually true for all other FS factories)
Modified Paths:
--------------
scummvm/trunk/backends/fs/amigaos4/amigaos4-fs-factory.cpp
scummvm/trunk/backends/fs/amigaos4/amigaos4-fs-factory.h
scummvm/trunk/backends/fs/posix/posix-fs-factory.cpp
scummvm/trunk/backends/fs/posix/posix-fs-factory.h
scummvm/trunk/backends/fs/windows/windows-fs-factory.cpp
scummvm/trunk/backends/fs/windows/windows-fs-factory.h
scummvm/trunk/backends/platform/sdl/sdl.cpp
scummvm/trunk/backends/platform/sdl/sdl.h
Modified: scummvm/trunk/backends/fs/amigaos4/amigaos4-fs-factory.cpp
===================================================================
--- scummvm/trunk/backends/fs/amigaos4/amigaos4-fs-factory.cpp 2008-08-22 11:19:41 UTC (rev 34097)
+++ scummvm/trunk/backends/fs/amigaos4/amigaos4-fs-factory.cpp 2008-08-22 11:36:47 UTC (rev 34098)
@@ -26,8 +26,6 @@
#include "backends/fs/amigaos4/amigaos4-fs-factory.h"
#include "backends/fs/amigaos4/amigaos4-fs.cpp"
-DECLARE_SINGLETON(AmigaOSFilesystemFactory);
-
AbstractFilesystemNode *AmigaOSFilesystemFactory::makeRootFileNode() const {
return new AmigaOSFilesystemNode();
}
@@ -36,7 +34,7 @@
return new AmigaOSFilesystemNode();
}
-AbstractFilesystemNode *AmigaOSFilesystemFactory::makeFileNodePath(const String &path) const {
+AbstractFilesystemNode *AmigaOSFilesystemFactory::makeFileNodePath(const Common::String &path) const {
return new AmigaOSFilesystemNode(path);
}
#endif
Modified: scummvm/trunk/backends/fs/amigaos4/amigaos4-fs-factory.h
===================================================================
--- scummvm/trunk/backends/fs/amigaos4/amigaos4-fs-factory.h 2008-08-22 11:19:41 UTC (rev 34097)
+++ scummvm/trunk/backends/fs/amigaos4/amigaos4-fs-factory.h 2008-08-22 11:36:47 UTC (rev 34098)
@@ -25,7 +25,6 @@
#ifndef AMIGAOS_FILESYSTEM_FACTORY_H
#define AMIGAOS_FILESYSTEM_FACTORY_H
-#include "common/singleton.h"
#include "backends/fs/fs-factory.h"
/**
@@ -33,19 +32,11 @@
*
* Parts of this class are documented in the base interface class, FilesystemFactory.
*/
-class AmigaOSFilesystemFactory : public FilesystemFactory, public Common::Singleton<AmigaOSFilesystemFactory> {
+class AmigaOSFilesystemFactory : public FilesystemFactory {
public:
- typedef Common::String String;
-
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
- virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
-
-protected:
- AmigaOSFilesystemFactory() {};
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
+ virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
};
#endif /*AMIGAOS_FILESYSTEM_FACTORY_H*/
Modified: scummvm/trunk/backends/fs/posix/posix-fs-factory.cpp
===================================================================
--- scummvm/trunk/backends/fs/posix/posix-fs-factory.cpp 2008-08-22 11:19:41 UTC (rev 34097)
+++ scummvm/trunk/backends/fs/posix/posix-fs-factory.cpp 2008-08-22 11:36:47 UTC (rev 34098)
@@ -26,8 +26,6 @@
#include "backends/fs/posix/posix-fs-factory.h"
#include "backends/fs/posix/posix-fs.cpp"
-DECLARE_SINGLETON(POSIXFilesystemFactory);
-
AbstractFilesystemNode *POSIXFilesystemFactory::makeRootFileNode() const {
return new POSIXFilesystemNode();
}
@@ -38,7 +36,7 @@
return new POSIXFilesystemNode(buf, true);
}
-AbstractFilesystemNode *POSIXFilesystemFactory::makeFileNodePath(const String &path) const {
+AbstractFilesystemNode *POSIXFilesystemFactory::makeFileNodePath(const Common::String &path) const {
return new POSIXFilesystemNode(path, true);
}
#endif
Modified: scummvm/trunk/backends/fs/posix/posix-fs-factory.h
===================================================================
--- scummvm/trunk/backends/fs/posix/posix-fs-factory.h 2008-08-22 11:19:41 UTC (rev 34097)
+++ scummvm/trunk/backends/fs/posix/posix-fs-factory.h 2008-08-22 11:36:47 UTC (rev 34098)
@@ -25,7 +25,6 @@
#ifndef POSIX_FILESYSTEM_FACTORY_H
#define POSIX_FILESYSTEM_FACTORY_H
-#include "common/singleton.h"
#include "backends/fs/fs-factory.h"
/**
@@ -33,19 +32,10 @@
*
* Parts of this class are documented in the base interface class, FilesystemFactory.
*/
-class POSIXFilesystemFactory : public FilesystemFactory, public Common::Singleton<POSIXFilesystemFactory> {
-public:
- typedef Common::String String;
-
+class POSIXFilesystemFactory : public FilesystemFactory {
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
- virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
-
-protected:
- POSIXFilesystemFactory() {};
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
+ virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
};
#endif /*POSIX_FILESYSTEM_FACTORY_H*/
Modified: scummvm/trunk/backends/fs/windows/windows-fs-factory.cpp
===================================================================
--- scummvm/trunk/backends/fs/windows/windows-fs-factory.cpp 2008-08-22 11:19:41 UTC (rev 34097)
+++ scummvm/trunk/backends/fs/windows/windows-fs-factory.cpp 2008-08-22 11:36:47 UTC (rev 34098)
@@ -26,8 +26,6 @@
#include "backends/fs/windows/windows-fs-factory.h"
#include "backends/fs/windows/windows-fs.cpp"
-DECLARE_SINGLETON(WindowsFilesystemFactory);
-
AbstractFilesystemNode *WindowsFilesystemFactory::makeRootFileNode() const {
return new WindowsFilesystemNode();
}
@@ -36,7 +34,7 @@
return new WindowsFilesystemNode("", true);
}
-AbstractFilesystemNode *WindowsFilesystemFactory::makeFileNodePath(const String &path) const {
+AbstractFilesystemNode *WindowsFilesystemFactory::makeFileNodePath(const Common::String &path) const {
return new WindowsFilesystemNode(path, false);
}
#endif
Modified: scummvm/trunk/backends/fs/windows/windows-fs-factory.h
===================================================================
--- scummvm/trunk/backends/fs/windows/windows-fs-factory.h 2008-08-22 11:19:41 UTC (rev 34097)
+++ scummvm/trunk/backends/fs/windows/windows-fs-factory.h 2008-08-22 11:36:47 UTC (rev 34098)
@@ -25,7 +25,6 @@
#ifndef WINDOWS_FILESYSTEM_FACTORY_H
#define WINDOWS_FILESYSTEM_FACTORY_H
-#include "common/singleton.h"
#include "backends/fs/fs-factory.h"
/**
@@ -33,19 +32,11 @@
*
* Parts of this class are documented in the base interface class, FilesystemFactory.
*/
-class WindowsFilesystemFactory : public FilesystemFactory, public Common::Singleton<WindowsFilesystemFactory> {
+class WindowsFilesystemFactory : public FilesystemFactory {
public:
- typedef Common::String String;
-
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
- virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
-
-protected:
- WindowsFilesystemFactory() {};
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
+ virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
};
#endif /*WINDOWS_FILESYSTEM_FACTORY_H*/
Modified: scummvm/trunk/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.cpp 2008-08-22 11:19:41 UTC (rev 34097)
+++ scummvm/trunk/backends/platform/sdl/sdl.cpp 2008-08-22 11:36:47 UTC (rev 34098)
@@ -170,6 +170,21 @@
_timerID = SDL_AddTimer(10, &timer_handler, _timer);
}
+ if (_fsFactory == 0) {
+ #if defined(__amigaos4__)
+ _fsFactory = new AmigaOSFilesystemFactory();
+ #elif defined(UNIX)
+ _fsFactory = new POSIXFilesystemFactory();
+ #elif defined(WIN32)
+ _fsFactory = new WindowsFilesystemFactory();
+ #elif defined(__SYMBIAN32__)
+ // Do nothing since its handled by the Symbian SDL inheritance
+ #else
+ #error Unknown and unsupported backend in OSystem_SDL::getFilesystemFactory
+ #endif
+ }
+
+
// Invoke parent implementation of this method
OSystem::initBackend();
@@ -196,6 +211,7 @@
_soundMutex(0), _soundCond(0), _soundThread(0),
_soundThreadIsRunning(false), _soundThreadShouldQuit(false),
#endif
+ _fsFactory(0),
_savefile(0),
_mixer(0),
_timer(0),
@@ -254,17 +270,7 @@
}
FilesystemFactory *OSystem_SDL::getFilesystemFactory() {
- #if defined(__amigaos4__)
- return &AmigaOSFilesystemFactory::instance();
- #elif defined(UNIX)
- return &POSIXFilesystemFactory::instance();
- #elif defined(WIN32)
- return &WindowsFilesystemFactory::instance();
- #elif defined(__SYMBIAN32__)
- // Do nothing since its handled by the Symbian SDL inheritance
- #else
- #error Unknown and unsupported backend in OSystem_SDL::getFilesystemFactory
- #endif
+ return _fsFactory;
}
static Common::String getDefaultConfigFileName() {
Modified: scummvm/trunk/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.h 2008-08-22 11:19:41 UTC (rev 34097)
+++ scummvm/trunk/backends/platform/sdl/sdl.h 2008-08-22 11:36:47 UTC (rev 34098)
@@ -400,14 +400,13 @@
void deinitThreadedMixer();
#endif
-
+ FilesystemFactory *_fsFactory;
Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
SDL_TimerID _timerID;
Common::TimerManager *_timer;
-
protected:
void addDirtyRgnAuto(const byte *buf);
void makeChecksums(const byte *buf);
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