[Scummvm-cvs-logs] SF.net SVN: scummvm: [26814] scummvm/branches/gsoc2007-fsnode
david_corrales at users.sourceforge.net
david_corrales at users.sourceforge.net
Sat May 12 22:00:53 CEST 2007
Revision: 26814
http://scummvm.svn.sourceforge.net/scummvm/?rev=26814&view=rev
Author: david_corrales
Date: 2007-05-12 13:00:52 -0700 (Sat, 12 May 2007)
Log Message:
-----------
Use common/singleton.h in the concrete fs factories.
Modified Paths:
--------------
scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/fs/fs-factory-maker.cpp
scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.h
scummvm/branches/gsoc2007-fsnode/common/fs.cpp
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -1,15 +1,8 @@
#include "backends/fs/amigaos4/amigaos4-fs-factory.h"
#include "backends/fs/amigaos4/amigaos4-fs.cpp"
-AmigaOSFilesystemFactory *AmigaOSFilesystemFactory::_instance = 0;
+DECLARE_SINGLETON(AmigaOSFilesystemFactory);
-AmigaOSFilesystemFactory *AmigaOSFilesystemFactory::instance(){
- if(_instance == 0){
- _instance = new AmigaOSFilesystemFactory();
- }
- return _instance;
-}
-
AbstractFilesystemNode *AmigaOSFilesystemFactory::makeRootFileNode() const {
return new AmigaOSFilesystemNode();
}
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.h 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.h 2007-05-12 20:00:52 UTC (rev 26814)
@@ -8,16 +8,9 @@
*
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
*/
-class AmigaOSFilesystemFactory : public AbstractFilesystemFactory {
+class AmigaOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<AmigaOSFilesystemFactory> {
public:
typedef Common::String String;
-
- /**
- * Creates an instance of AmigaOSFilesystemFactory using the Singleton pattern.
- *
- * @return A unique instance of AmigaOSFilesytemFactory.
- */
- static AmigaOSFilesystemFactory *instance();
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
@@ -27,7 +20,7 @@
AmigaOSFilesystemFactory() {};
private:
- static AmigaOSFilesystemFactory *_instance;
+ friend class Common::Singleton<SingletonBaseType>;
};
#endif /*AMIGAOS_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -1,15 +1,8 @@
#include "backends/fs/dc/ronincd-fs-factory.h"
#include "backends/fs/dc/dc-fs.cpp"
-RoninCDFilesystemFactory *RoninCDFilesystemFactory::_instance = 0;
+DECLARE_SINGLETON(RoninCDFilesystemFactory);
-RoninCDFilesystemFactory *RoninCDFilesystemFactory::instance(){
- if(_instance == 0){
- _instance = new RoninCDFilesystemFactory();
- }
- return _instance;
-}
-
AbstractFilesystemNode *RoninCDFilesystemFactory::makeRootFileNode() const {
return new RoninCDFilesystemNode();
}
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.h 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.h 2007-05-12 20:00:52 UTC (rev 26814)
@@ -8,16 +8,9 @@
*
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
*/
-class RoninCDFilesystemFactory : public AbstractFilesystemFactory {
+class RoninCDFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<RoninCDFilesystemFactory> {
public:
typedef Common::String String;
-
- /**
- * Creates an instance of RoninCDFilesystemFactory using the Singleton pattern.
- *
- * @return A unique instance of RoninCDFilesytemFactory.
- */
- static RoninCDFilesystemFactory *instance();
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
@@ -27,7 +20,7 @@
RoninCDFilesystemFactory() {};
private:
- static RoninCDFilesystemFactory *_instance;
+ friend class Common::Singleton<SingletonBaseType>;
};
#endif /*RONINCD_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -2,15 +2,8 @@
#include "backends/fs/ds/ds-fs.cpp"
#include "dsmain.h" //for the isGBAMPAvailable() function
-DSFilesystemFactory *DSFilesystemFactory::_instance = 0;
+DECLARE_SINGLETON(DSFilesystemFactory);
-DSFilesystemFactory *DSFilesystemFactory::instance(){
- if(_instance == 0){
- _instance = new DSFilesystemFactory();
- }
- return _instance;
-}
-
AbstractFilesystemNode *DSFilesystemFactory::makeRootFileNode() const {
if (DS::isGBAMPAvailable()) {
return new DS::GBAMPFileSystemNode();
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.h 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.h 2007-05-12 20:00:52 UTC (rev 26814)
@@ -8,16 +8,9 @@
*
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
*/
-class DSFilesystemFactory : public AbstractFilesystemFactory {
+class DSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<DSFilesystemFactory> {
public:
typedef Common::String String;
-
- /**
- * Creates an instance of DSFilesystemFactory using the Singleton pattern.
- *
- * @return A unique instance of DSFilesytemFactory.
- */
- static DSFilesystemFactory *instance();
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
@@ -27,7 +20,7 @@
DSFilesystemFactory() {};
private:
- static DSFilesystemFactory *_instance;
+ friend class Common::Singleton<SingletonBaseType>;
};
#endif /*DS_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/fs-factory-maker.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/fs-factory-maker.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/fs-factory-maker.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -68,46 +68,46 @@
AbstractFilesystemFactory *FilesystemFactoryMaker::makeFactory(){
#if defined(__amigaos4__)
- return AmigaOSFilesystemFactory::instance();
+ return &AmigaOSFilesystemFactory::instance();
#endif
#if defined(__DC__)
- return RoninCDFilesystemFactory::instance();
+ return &RoninCDFilesystemFactory::instance();
#endif
#if defined(__DS__)
- return DSFilesystemFactory::instance();
+ return &DSFilesystemFactory::instance();
#endif
#if defined(__GP32__)
- return GP32FilesystemFactory::instance();
+ return &GP32FilesystemFactory::instance();
#endif
#if defined(__MORPHOS__)
- return ABoxFilesystemFactory::instance();
+ return &ABoxFilesystemFactory::instance();
#endif
#if defined(PALMOS_MODE)
- return PalmOSFilesystemFactory::instance();
+ return &PalmOSFilesystemFactory::instance();
#endif
#if defined(__PLAYSTATION2__)
- return Ps2FilesystemFactory::instance();
+ return &Ps2FilesystemFactory::instance();
#endif
#if defined(__PSP__)
- return PSPFilesystemFactory::instance();
+ return &PSPFilesystemFactory::instance();
#endif
#if defined(__SYMBIAN32__)
- return SymbianFilesystemFactory::instance();
+ return &SymbianFilesystemFactory::instance();
#endif
#if defined(UNIX)
- return POSIXFilesystemFactory::instance();
+ return &POSIXFilesystemFactory::instance();
#endif
#if defined(WIN32)
- return WindowsFilesystemFactory::instance();
+ return &WindowsFilesystemFactory::instance();
#endif
}
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -1,15 +1,8 @@
#include "backends/fs/gp32/gp32-fs-factory.h"
#include "backends/fs/gp32/gp32-fs.cpp"
-GP32FilesystemFactory *GP32FilesystemFactory::_instance = 0;
+DECLARE_SINGLETON(GP32FilesystemFactory);
-GP32FilesystemFactory *GP32FilesystemFactory::instance(){
- if(_instance == 0){
- _instance = new GP32FilesystemFactory();
- }
- return _instance;
-}
-
AbstractFilesystemNode *GP32FilesystemFactory::makeRootFileNode() const {
return new GP32FilesystemNode();
}
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.h 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.h 2007-05-12 20:00:52 UTC (rev 26814)
@@ -8,16 +8,9 @@
*
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
*/
-class GP32FilesystemFactory : public AbstractFilesystemFactory {
+class GP32FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<GP32FilesystemFactory> {
public:
typedef Common::String String;
-
- /**
- * Creates an instance of GP32FilesystemFactory using the Singleton pattern.
- *
- * @return A unique instance of GP32FilesytemFactory.
- */
- static GP32FilesystemFactory *instance();
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
@@ -27,7 +20,7 @@
GP32FilesystemFactory() {};
private:
- static GP32FilesystemFactory *_instance;
+ friend class Common::Singleton<SingletonBaseType>;
};
#endif /*GP32_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -1,15 +1,8 @@
#include "backends/fs/morphos/abox-fs-factory.h"
#include "backends/fs/morphos/abox-fs.cpp"
-ABoxFilesystemFactory *ABoxFilesystemFactory::_instance = 0;
+DECLARE_SINGLETON(ABoxFilesystemFactory);
-ABoxFilesystemFactory *ABoxFilesystemFactory::instance(){
- if(_instance == 0){
- _instance = new ABoxFilesystemFactory();
- }
- return _instance;
-}
-
AbstractFilesystemNode *ABoxFilesystemFactory::makeRootFileNode() const {
return new ABoxFilesystemNode();
}
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.h 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.h 2007-05-12 20:00:52 UTC (rev 26814)
@@ -8,16 +8,9 @@
*
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
*/
-class ABoxFilesystemFactory : public AbstractFilesystemFactory {
+class ABoxFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<ABoxFilesystemFactory> {
public:
typedef Common::String String;
-
- /**
- * Creates an instance of ABoxFilesystemFactory using the Singleton pattern.
- *
- * @return A unique instance of ABoxFilesytemFactory.
- */
- static ABoxFilesystemFactory *instance();
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
@@ -27,7 +20,7 @@
ABoxFilesystemFactory() {};
private:
- static ABoxFilesystemFactory *_instance;
+ friend class Common::Singleton<SingletonBaseType>;
};
#endif /*ABOX_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -1,15 +1,8 @@
#include "backends/fs/palmos/palmos-fs-factory.h"
#include "backends/fs/palmos/palmos-fs.cpp"
-PalmOSFilesystemFactory *PalmOSFilesystemFactory::_instance = 0;
+DECLARE_SINGLETON(PalmOSFilesystemFactory);
-PalmOSFilesystemFactory *PalmOSFilesystemFactory::instance(){
- if(_instance == 0){
- _instance = new PalmOSFilesystemFactory();
- }
- return _instance;
-}
-
AbstractFilesystemNode *PalmOSFilesystemFactory::makeRootFileNode() const {
return new PalmOSFilesystemNode();
}
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.h 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.h 2007-05-12 20:00:52 UTC (rev 26814)
@@ -8,16 +8,9 @@
*
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
*/
-class PalmOSFilesystemFactory : public AbstractFilesystemFactory {
+class PalmOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PalmOSFilesystemFactory> {
public:
typedef Common::String String;
-
- /**
- * Creates an instance of PalmOSFilesystemFactory using the Singleton pattern.
- *
- * @return A unique instance of PalmOSFilesytemFactory.
- */
- static PalmOSFilesystemFactory *instance();
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
@@ -27,7 +20,7 @@
PalmOSFilesystemFactory() {};
private:
- static PalmOSFilesystemFactory *_instance;
+ friend class Common::Singleton<SingletonBaseType>;
};
#endif /*PALMOS_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -1,15 +1,8 @@
#include "backends/fs/posix/posix-fs-factory.h"
#include "backends/fs/posix/posix-fs.cpp"
-POSIXFilesystemFactory *POSIXFilesystemFactory::_instance = 0;
+DECLARE_SINGLETON(POSIXFilesystemFactory);
-POSIXFilesystemFactory *POSIXFilesystemFactory::instance(){
- if(_instance == 0){
- _instance = new POSIXFilesystemFactory();
- }
- return _instance;
-}
-
AbstractFilesystemNode *POSIXFilesystemFactory::makeRootFileNode() const {
return new POSIXFilesystemNode();
}
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.h 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.h 2007-05-12 20:00:52 UTC (rev 26814)
@@ -1,6 +1,7 @@
#ifndef POSIX_FILESYSTEM_FACTORY_H
#define POSIX_FILESYSTEM_FACTORY_H
+#include "common/singleton.h"
#include "backends/fs/abstract-fs-factory.h"
/**
@@ -8,16 +9,9 @@
*
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
*/
-class POSIXFilesystemFactory : public AbstractFilesystemFactory {
+class POSIXFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<POSIXFilesystemFactory> {
public:
typedef Common::String String;
-
- /**
- * Creates an instance of POSIXFilesystemFactory using the Singleton pattern.
- *
- * @return A unique instance of POSIXFilesytemFactory.
- */
- static POSIXFilesystemFactory *instance();
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
@@ -27,7 +21,7 @@
POSIXFilesystemFactory() {};
private:
- static POSIXFilesystemFactory *_instance;
+ friend class Common::Singleton<SingletonBaseType>;
};
#endif /*POSIX_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -1,15 +1,8 @@
#include "backends/fs/ps2/ps2-fs-factory.h"
#include "backends/fs/ps2/ps2-fs.cpp"
-Ps2FilesystemFactory *Ps2FilesystemFactory::_instance = 0;
+DECLARE_SINGLETON(Ps2FilesystemFactory);
-Ps2FilesystemFactory *Ps2FilesystemFactory::instance(){
- if(_instance == 0){
- _instance = new Ps2FilesystemFactory();
- }
- return _instance;
-}
-
AbstractFilesystemNode *Ps2FilesystemFactory::makeRootFileNode() const {
return new Ps2FilesystemNode();
}
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.h 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.h 2007-05-12 20:00:52 UTC (rev 26814)
@@ -8,16 +8,9 @@
*
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
*/
-class Ps2FilesystemFactory : public AbstractFilesystemFactory {
+class Ps2FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<Ps2FilesystemFactory> {
public:
typedef Common::String String;
-
- /**
- * Creates an instance of Ps2FilesystemFactory using the Singleton pattern.
- *
- * @return A unique instance of Ps2FilesytemFactory.
- */
- static Ps2FilesystemFactory *instance();
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
@@ -27,7 +20,7 @@
Ps2FilesystemFactory() {};
private:
- static Ps2FilesystemFactory *_instance;
+ friend class Common::Singleton<SingletonBaseType>;
};
#endif /*PS2_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -1,15 +1,8 @@
#include "backends/fs/psp/psp-fs-factory.h"
#include "backends/fs/psp/psp_fs.cpp"
-PSPFilesystemFactory *PSPFilesystemFactory::_instance = 0;
+DECLARE_SINGLETON(PSPFilesystemFactory);
-PSPFilesystemFactory *PSPFilesystemFactory::instance(){
- if(_instance == 0){
- _instance = new PSPFilesystemFactory();
- }
- return _instance;
-}
-
AbstractFilesystemNode *PSPFilesystemFactory::makeRootFileNode() const {
return new PSPFilesystemNode();
}
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.h 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.h 2007-05-12 20:00:52 UTC (rev 26814)
@@ -8,16 +8,9 @@
*
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
*/
-class PSPFilesystemFactory : public AbstractFilesystemFactory {
+class PSPFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PSPFilesystemFactory> {
public:
typedef Common::String String;
-
- /**
- * Creates an instance of PSPFilesystemFactory using the Singleton pattern.
- *
- * @return A unique instance of PSPFilesytemFactory.
- */
- static PSPFilesystemFactory *instance();
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
@@ -27,7 +20,7 @@
PSPFilesystemFactory() {};
private:
- static PSPFilesystemFactory *_instance;
+ friend class Common::Singleton<SingletonBaseType>;
};
#endif /*PSP_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -1,15 +1,8 @@
#include "backends/fs/symbian/symbian-fs-factory.h"
#include "backends/fs/symbian/symbian-fs.cpp"
-SymbianFilesystemFactory *SymbianFilesystemFactory::_instance = 0;
+DECLARE_SINGLETON(SymbianFilesystemFactory);
-SymbianFilesystemFactory *SymbianFilesystemFactory::instance(){
- if(_instance == 0){
- _instance = new SymbianFilesystemFactory();
- }
- return _instance;
-}
-
AbstractFilesystemNode *SymbianFilesystemFactory::makeRootFileNode() const {
return new SymbianFilesystemNode(true);
}
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.h 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.h 2007-05-12 20:00:52 UTC (rev 26814)
@@ -8,16 +8,9 @@
*
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
*/
-class SymbianFilesystemFactory : public AbstractFilesystemFactory {
+class SymbianFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<SymbianFilesystemFactory> {
public:
typedef Common::String String;
-
- /**
- * Creates an instance of SymbianFilesystemFactory using the Singleton pattern.
- *
- * @return A unique instance of SymbianFilesytemFactory.
- */
- static SymbianFilesystemFactory *instance();
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
@@ -27,7 +20,7 @@
SymbianFilesystemFactory() {};
private:
- static SymbianFilesystemFactory *_instance;
+ friend class Common::Singleton<SingletonBaseType>;
};
#endif /*SYMBIAN_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -1,15 +1,8 @@
#include "backends/fs/windows/windows-fs-factory.h"
#include "backends/fs/windows/windows-fs.cpp"
-WindowsFilesystemFactory *WindowsFilesystemFactory::_instance = 0;
+DECLARE_SINGLETON(WindowsFilesystemFactory);
-WindowsFilesystemFactory *WindowsFilesystemFactory::instance(){
- if(_instance == 0){
- _instance = new WindowsFilesystemFactory();
- }
- return _instance;
-}
-
AbstractFilesystemNode *WindowsFilesystemFactory::makeRootFileNode() const {
return new WindowsFilesystemNode();
}
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.h 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.h 2007-05-12 20:00:52 UTC (rev 26814)
@@ -8,17 +8,10 @@
*
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
*/
-class WindowsFilesystemFactory : public AbstractFilesystemFactory {
+class WindowsFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<WindowsFilesystemFactory> {
public:
typedef Common::String String;
- /**
- * Creates an instance of WindowsFilesystemFactory using the Singleton pattern.
- *
- * @return A unique instance of WindowsFilesytemFactory.
- */
- static WindowsFilesystemFactory *instance();
-
virtual AbstractFilesystemNode *makeRootFileNode() const;
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
@@ -27,7 +20,7 @@
WindowsFilesystemFactory() {};
private:
- static WindowsFilesystemFactory *_instance;
+ friend class Common::Singleton<SingletonBaseType>;
};
#endif /*WINDOWS_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/common/fs.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/common/fs.cpp 2007-05-12 19:33:00 UTC (rev 26813)
+++ scummvm/branches/gsoc2007-fsnode/common/fs.cpp 2007-05-12 20:00:52 UTC (rev 26814)
@@ -20,9 +20,8 @@
*/
#include "common/stdafx.h"
-
-#include "backends/fs/abstract-fs.h"
#include "common/util.h"
+#include "backends/fs/abstract-fs.h"
#include "backends/fs/fs-factory-maker.cpp"
FilesystemNode::FilesystemNode(AbstractFilesystemNode *realNode) {
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