[Scummvm-cvs-logs] SF.net SVN: scummvm: [30947] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Feb 24 00:03:09 CET 2008


Revision: 30947
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30947&view=rev
Author:   fingolfin
Date:     2008-02-23 15:03:08 -0800 (Sat, 23 Feb 2008)

Log Message:
-----------
Replaced FilesystemFactory::makeFSFactory with a new method OSystem::getFilesystemFactory()

Modified Paths:
--------------
    scummvm/trunk/backends/fs/fs-factory.h
    scummvm/trunk/backends/module.mk
    scummvm/trunk/common/fs.cpp
    scummvm/trunk/common/system.cpp
    scummvm/trunk/common/system.h

Removed Paths:
-------------
    scummvm/trunk/backends/fs/fs-factory.cpp

Deleted: scummvm/trunk/backends/fs/fs-factory.cpp
===================================================================
--- scummvm/trunk/backends/fs/fs-factory.cpp	2008-02-23 22:58:56 UTC (rev 30946)
+++ scummvm/trunk/backends/fs/fs-factory.cpp	2008-02-23 23:03:08 UTC (rev 30947)
@@ -1,87 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- */
-
-#include "backends/fs/fs-factory.h"
-
-/*
- * All the following includes choose, at compile time, which specific backend will be used
- * during the execution of the ScummVM.
- *
- * It has to be done this way because not all the necessary libraries will be available in
- * all build environments. Additionally, this results in smaller binaries.
- */
-#if defined(__amigaos4__)
-	#include "backends/fs/amigaos4/amigaos4-fs-factory.cpp"
-#elif defined(__DC__)
-	#include "backends/fs/dc/ronincd-fs-factory.cpp"
-#elif defined(__DS__)
-	#include "backends/fs/ds/ds-fs-factory.cpp"
-#elif defined(__GP32__)
-	#include "backends/fs/gp32/gp32-fs-factory.cpp"
-#elif defined(__MORPHOS__)
-	#include "backends/fs/morphos/abox-fs-factory.cpp"
-#elif defined(PALMOS_MODE)
-	#include "backends/fs/palmos/palmos-fs-factory.cpp"
-#elif defined(__PLAYSTATION2__)
-	#include "backends/fs/ps2/ps2-fs-factory.cpp"
-#elif defined(__PSP__)
-	#include "backends/fs/psp/psp-fs-factory.cpp"
-#elif defined(__SYMBIAN32__)
-	#include "backends/fs/symbian/symbian-fs-factory.cpp"
-#elif defined(UNIX)
-	#include "backends/fs/posix/posix-fs-factory.cpp"
-#elif defined(WIN32)
-	#include "backends/fs/windows/windows-fs-factory.cpp"
-#endif
-
-/**
- * Creates concrete FilesystemFactory objects depending on the current architecture.
- *
- * @return FilesystemFactory* The specific factory for the current architecture.
- */
-FilesystemFactory *FilesystemFactory::makeFSFactory() {
-	#if defined(__amigaos4__)
-		return &AmigaOSFilesystemFactory::instance();
-	#elif defined(__DC__)
-		return &RoninCDFilesystemFactory::instance();
-	#elif defined(__DS__)
-		return &DSFilesystemFactory::instance();
-	#elif defined(__GP32__)
-		return &GP32FilesystemFactory::instance();
-	#elif defined(__MORPHOS__)
-		return &ABoxFilesystemFactory::instance();
-	#elif defined(PALMOS_MODE)
-		return &PalmOSFilesystemFactory::instance();
-	#elif defined(__PLAYSTATION2__)
-		return &Ps2FilesystemFactory::instance();
-	#elif defined(__PSP__)
-		return &PSPFilesystemFactory::instance();
-	#elif defined(__SYMBIAN32__)
-		return &SymbianFilesystemFactory::instance();
-	#elif defined(UNIX)
-		return &POSIXFilesystemFactory::instance();
-	#elif defined(WIN32)
-		return &WindowsFilesystemFactory::instance();
-	#endif
-}

Modified: scummvm/trunk/backends/fs/fs-factory.h
===================================================================
--- scummvm/trunk/backends/fs/fs-factory.h	2008-02-23 22:58:56 UTC (rev 30946)
+++ scummvm/trunk/backends/fs/fs-factory.h	2008-02-23 23:03:08 UTC (rev 30947)
@@ -66,13 +66,6 @@
 	 * On Windows, it will be a special node which "contains" all drives (C:, D:, E:).
 	 */
 	virtual AbstractFilesystemNode *makeRootFileNode() const = 0;
-
-
-	/**
-	 * Meta-factory method which returns a concrete FilesystemFactory
-	 * instance depending on the current architecture.
-	 */
-	static FilesystemFactory *makeFSFactory();
 };
 
 #endif /*FILESYSTEM_FACTORY_H*/

Modified: scummvm/trunk/backends/module.mk
===================================================================
--- scummvm/trunk/backends/module.mk	2008-02-23 22:58:56 UTC (rev 30946)
+++ scummvm/trunk/backends/module.mk	2008-02-23 23:03:08 UTC (rev 30947)
@@ -2,7 +2,6 @@
 
 MODULE_OBJS := \
 	events/default/default-events.o \
-	fs/fs-factory.o \
 	midi/alsa.o \
 	midi/camd.o \
 	midi/coreaudio.o \

Modified: scummvm/trunk/common/fs.cpp
===================================================================
--- scummvm/trunk/common/fs.cpp	2008-02-23 22:58:56 UTC (rev 30946)
+++ scummvm/trunk/common/fs.cpp	2008-02-23 23:03:08 UTC (rev 30947)
@@ -23,6 +23,7 @@
  */
 
 #include "common/util.h"
+#include "common/system.h"
 #include "backends/fs/abstract-fs.h"
 #include "backends/fs/fs-factory.h"
 
@@ -44,7 +45,7 @@
 }
 
 FilesystemNode::FilesystemNode(const Common::String &p) {
-	FilesystemFactory *factory = FilesystemFactory::makeFSFactory();
+	FilesystemFactory *factory = g_system->getFilesystemFactory();
 
 	if (p.empty() || p == ".")
 		_realNode = factory->makeCurrentDirectoryFileNode();

Modified: scummvm/trunk/common/system.cpp
===================================================================
--- scummvm/trunk/common/system.cpp	2008-02-23 22:58:56 UTC (rev 30946)
+++ scummvm/trunk/common/system.cpp	2008-02-23 23:03:08 UTC (rev 30947)
@@ -24,6 +24,7 @@
  */
 
 #include "backends/events/default/default-events.h"
+#include "backends/fs/fs-factory.h"
 
 #include "common/config-manager.h"
 #include "common/system.h"
@@ -127,3 +128,62 @@
 	time_t curTime = time(0);
 	t = *localtime(&curTime);
 }
+
+/*
+ * All the following includes choose, at compile time, which specific backend will be used
+ * during the execution of the ScummVM.
+ *
+ * TODO: Remove these gradually and instead move the getFilesystemFactory() implementatios
+ * to the respective backends.
+ */
+#if defined(__amigaos4__)
+	#include "backends/fs/amigaos4/amigaos4-fs-factory.cpp"
+#elif defined(__DC__)
+	#include "backends/fs/dc/ronincd-fs-factory.cpp"
+#elif defined(__DS__)
+	#include "backends/fs/ds/ds-fs-factory.cpp"
+#elif defined(__GP32__)
+	#include "backends/fs/gp32/gp32-fs-factory.cpp"
+#elif defined(__MORPHOS__)
+	#include "backends/fs/morphos/abox-fs-factory.cpp"
+#elif defined(PALMOS_MODE)
+	#include "backends/fs/palmos/palmos-fs-factory.cpp"
+#elif defined(__PLAYSTATION2__)
+	#include "backends/fs/ps2/ps2-fs-factory.cpp"
+#elif defined(__PSP__)
+	#include "backends/fs/psp/psp-fs-factory.cpp"
+#elif defined(__SYMBIAN32__)
+	#include "backends/fs/symbian/symbian-fs-factory.cpp"
+#elif defined(UNIX)
+	#include "backends/fs/posix/posix-fs-factory.cpp"
+#elif defined(WIN32)
+	#include "backends/fs/windows/windows-fs-factory.cpp"
+#endif
+
+FilesystemFactory *OSystem::getFilesystemFactory() {
+	#if defined(__amigaos4__)
+		return &AmigaOSFilesystemFactory::instance();
+	#elif defined(__DC__)
+		return &RoninCDFilesystemFactory::instance();
+	#elif defined(__DS__)
+		return &DSFilesystemFactory::instance();
+	#elif defined(__GP32__)
+		return &GP32FilesystemFactory::instance();
+	#elif defined(__MORPHOS__)
+		return &ABoxFilesystemFactory::instance();
+	#elif defined(PALMOS_MODE)
+		return &PalmOSFilesystemFactory::instance();
+	#elif defined(__PLAYSTATION2__)
+		return &Ps2FilesystemFactory::instance();
+	#elif defined(__PSP__)
+		return &PSPFilesystemFactory::instance();
+	#elif defined(__SYMBIAN32__)
+		return &SymbianFilesystemFactory::instance();
+	#elif defined(UNIX)
+		return &POSIXFilesystemFactory::instance();
+	#elif defined(WIN32)
+		return &WindowsFilesystemFactory::instance();
+	#else
+		#error Unknown and unsupported backend in OSystem::getFilesystemFactory
+	#endif
+}
\ No newline at end of file

Modified: scummvm/trunk/common/system.h
===================================================================
--- scummvm/trunk/common/system.h	2008-02-23 22:58:56 UTC (rev 30946)
+++ scummvm/trunk/common/system.h	2008-02-23 23:03:08 UTC (rev 30947)
@@ -46,6 +46,8 @@
 	class TimerManager;
 }
 
+class FilesystemFactory;
+
 /**
  * Interface for ScummVM backends. If you want to port ScummVM to a system
  * which is not currently covered by any of our backends, this is the place
@@ -900,7 +902,14 @@
 	 */
 	virtual Common::SaveFileManager *getSavefileManager() = 0;
 
+	/**
+	 * Returns the FilesystemFactory object, depending on the current architecture.
+	 *
+	 * @return FilesystemFactory* The specific factory for the current architecture.
+	 */
+	virtual FilesystemFactory *getFilesystemFactory();
 
+
 	/**
 	 * Return String which is used for backend-specific addition to theme
 	 * config.


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