From 80d55b0388ef5883202fa13035115d79046b3072 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 23 Feb 2008 19:01:12 +0000 Subject: Renamed AbstractFilesystemFactory to FilesystemFactory svn-id: r30935 --- backends/fs/abstract-fs-factory.cpp | 87 ------------------------------ backends/fs/abstract-fs-factory.h | 80 --------------------------- backends/fs/amigaos4/amigaos4-fs-factory.h | 6 +-- backends/fs/dc/ronincd-fs-factory.h | 6 +-- backends/fs/ds/ds-fs-factory.h | 6 +-- backends/fs/fs-factory.cpp | 87 ++++++++++++++++++++++++++++++ backends/fs/fs-factory.h | 78 +++++++++++++++++++++++++++ backends/fs/gp32/gp32-fs-factory.h | 6 +-- backends/fs/morphos/abox-fs-factory.h | 6 +-- backends/fs/palmos/palmos-fs-factory.h | 6 +-- backends/fs/posix/posix-fs-factory.h | 6 +-- backends/fs/ps2/ps2-fs-factory.h | 6 +-- backends/fs/psp/psp-fs-factory.h | 6 +-- backends/fs/symbian/symbian-fs-factory.h | 6 +-- backends/fs/windows/windows-fs-factory.h | 6 +-- 15 files changed, 198 insertions(+), 200 deletions(-) delete mode 100644 backends/fs/abstract-fs-factory.cpp delete mode 100644 backends/fs/abstract-fs-factory.h create mode 100644 backends/fs/fs-factory.cpp create mode 100644 backends/fs/fs-factory.h (limited to 'backends/fs') diff --git a/backends/fs/abstract-fs-factory.cpp b/backends/fs/abstract-fs-factory.cpp deleted file mode 100644 index 8cf936f5bc..0000000000 --- a/backends/fs/abstract-fs-factory.cpp +++ /dev/null @@ -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/abstract-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 AbstractFilesystemFactory* The specific factory for the current architecture. - */ -AbstractFilesystemFactory *AbstractFilesystemFactory::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 -} diff --git a/backends/fs/abstract-fs-factory.h b/backends/fs/abstract-fs-factory.h deleted file mode 100644 index c4ce277505..0000000000 --- a/backends/fs/abstract-fs-factory.h +++ /dev/null @@ -1,80 +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$ - */ - -#ifndef ABSTRACT_FILESYSTEM_FACTORY_H -#define ABSTRACT_FILESYSTEM_FACTORY_H - -#include "common/str.h" -#include "backends/fs/abstract-fs.h" - -/** - * Creates concrete FilesystemNode objects depending on the current architecture. - */ -class AbstractFilesystemFactory { -public: - typedef Common::String String; - - /** - * Destructor. - */ - virtual ~AbstractFilesystemFactory() {} - - /** - * Returns a node representing the "current directory". - * If your system does not support this concept, you can either try to - * emulate it or simply return some "sensible" default directory node, - * e.g. the same value as getRoot() returns. - */ - virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const = 0; - - /** - * Construct a node based on a path; the path is in the same format as it - * would be for calls to fopen(). - * - * Furthermore getNodeForPath(oldNode.path()) should create a new node - * identical to oldNode. Hence, we can use the "path" value for persistent - * storage e.g. in the config file. - * - * @param path The path string to create a FilesystemNode for. - */ - virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const = 0; - - /** - * Returns a special node representing the filesystem root. - * The starting point for any file system browsing. - * - * On Unix, this will be simply the node for / (the root directory). - * 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 AbstractFilesystemFactory - * instance depending on the current architecture. - */ - static AbstractFilesystemFactory *makeFSFactory(); -}; - -#endif /*ABSTRACT_FILESYSTEM_FACTORY_H*/ diff --git a/backends/fs/amigaos4/amigaos4-fs-factory.h b/backends/fs/amigaos4/amigaos4-fs-factory.h index 262b3ed233..58a7dcd372 100644 --- a/backends/fs/amigaos4/amigaos4-fs-factory.h +++ b/backends/fs/amigaos4/amigaos4-fs-factory.h @@ -26,14 +26,14 @@ #define AMIGAOS_FILESYSTEM_FACTORY_H #include "common/singleton.h" -#include "backends/fs/abstract-fs-factory.h" +#include "backends/fs/fs-factory.h" /** * Creates AmigaOSFilesystemNode objects. * - * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. + * Parts of this class are documented in the base interface class, FilesystemFactory. */ -class AmigaOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton { +class AmigaOSFilesystemFactory : public FilesystemFactory, public Common::Singleton { public: typedef Common::String String; diff --git a/backends/fs/dc/ronincd-fs-factory.h b/backends/fs/dc/ronincd-fs-factory.h index e49c2c04fa..532a6d3333 100644 --- a/backends/fs/dc/ronincd-fs-factory.h +++ b/backends/fs/dc/ronincd-fs-factory.h @@ -26,14 +26,14 @@ #define RONINCD_FILESYSTEM_FACTORY_H #include "common/singleton.h" -#include "backends/fs/abstract-fs-factory.h" +#include "backends/fs/fs-factory.h" /** * Creates RoninCDFilesystemNode objects. * - * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. + * Parts of this class are documented in the base interface class, FilesystemFactory. */ -class RoninCDFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton { +class RoninCDFilesystemFactory : public FilesystemFactory, public Common::Singleton { public: typedef Common::String String; diff --git a/backends/fs/ds/ds-fs-factory.h b/backends/fs/ds/ds-fs-factory.h index 292a2baa69..bff21a309d 100644 --- a/backends/fs/ds/ds-fs-factory.h +++ b/backends/fs/ds/ds-fs-factory.h @@ -26,14 +26,14 @@ #define DS_FILESYSTEM_FACTORY_H #include "common/singleton.h" -#include "backends/fs/abstract-fs-factory.h" +#include "backends/fs/fs-factory.h" /** * Creates DSFilesystemNode objects. * - * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. + * Parts of this class are documented in the base interface class, FilesystemFactory. */ -class DSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton { +class DSFilesystemFactory : public FilesystemFactory, public Common::Singleton { public: typedef Common::String String; diff --git a/backends/fs/fs-factory.cpp b/backends/fs/fs-factory.cpp new file mode 100644 index 0000000000..035e4bf2f8 --- /dev/null +++ b/backends/fs/fs-factory.cpp @@ -0,0 +1,87 @@ +/* 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 +} diff --git a/backends/fs/fs-factory.h b/backends/fs/fs-factory.h new file mode 100644 index 0000000000..bd208a7beb --- /dev/null +++ b/backends/fs/fs-factory.h @@ -0,0 +1,78 @@ +/* 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$ + */ + +#ifndef FILESYSTEM_FACTORY_H +#define FILESYSTEM_FACTORY_H + +#include "common/str.h" +#include "backends/fs/abstract-fs.h" + +/** + * Creates concrete FilesystemNode objects depending on the current architecture. + */ +class FilesystemFactory { +public: + /** + * Destructor. + */ + virtual ~FilesystemFactory() {} + + /** + * Returns a node representing the "current directory". + * If your system does not support this concept, you can either try to + * emulate it or simply return some "sensible" default directory node, + * e.g. the same value as getRoot() returns. + */ + virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const = 0; + + /** + * Construct a node based on a path; the path is in the same format as it + * would be for calls to fopen(). + * + * Furthermore getNodeForPath(oldNode.path()) should create a new node + * identical to oldNode. Hence, we can use the "path" value for persistent + * storage e.g. in the config file. + * + * @param path The path string to create a FilesystemNode for. + */ + virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const = 0; + + /** + * Returns a special node representing the filesystem root. + * The starting point for any file system browsing. + * + * On Unix, this will be simply the node for / (the root directory). + * 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*/ diff --git a/backends/fs/gp32/gp32-fs-factory.h b/backends/fs/gp32/gp32-fs-factory.h index 90c6bd9500..7e6cb595ca 100644 --- a/backends/fs/gp32/gp32-fs-factory.h +++ b/backends/fs/gp32/gp32-fs-factory.h @@ -26,14 +26,14 @@ #define GP32_FILESYSTEM_FACTORY_H #include "common/singleton.h" -#include "backends/fs/abstract-fs-factory.h" +#include "backends/fs/fs-factory.h" /** * Creates GP32FilesystemNode objects. * - * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. + * Parts of this class are documented in the base interface class, FilesystemFactory. */ -class GP32FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton { +class GP32FilesystemFactory : public FilesystemFactory, public Common::Singleton { public: typedef Common::String String; diff --git a/backends/fs/morphos/abox-fs-factory.h b/backends/fs/morphos/abox-fs-factory.h index 1adbd1475a..0a53822447 100644 --- a/backends/fs/morphos/abox-fs-factory.h +++ b/backends/fs/morphos/abox-fs-factory.h @@ -26,14 +26,14 @@ #define ABOX_FILESYSTEM_FACTORY_H #include "common/singleton.h" -#include "backends/fs/abstract-fs-factory.h" +#include "backends/fs/fs-factory.h" /** * Creates ABoxFilesystemNode objects. * - * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. + * Parts of this class are documented in the base interface class, FilesystemFactory. */ -class ABoxFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton { +class ABoxFilesystemFactory : public FilesystemFactory, public Common::Singleton { public: typedef Common::String String; diff --git a/backends/fs/palmos/palmos-fs-factory.h b/backends/fs/palmos/palmos-fs-factory.h index 9d873eeb12..3ea8b5fe47 100644 --- a/backends/fs/palmos/palmos-fs-factory.h +++ b/backends/fs/palmos/palmos-fs-factory.h @@ -26,14 +26,14 @@ #define PALMOS_FILESYSTEM_FACTORY_H #include "common/singleton.h" -#include "backends/fs/abstract-fs-factory.h" +#include "backends/fs/fs-factory.h" /** * Creates PalmOSFilesystemNode objects. * - * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. + * Parts of this class are documented in the base interface class, FilesystemFactory. */ -class PalmOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton { +class PalmOSFilesystemFactory : public FilesystemFactory, public Common::Singleton { public: typedef Common::String String; diff --git a/backends/fs/posix/posix-fs-factory.h b/backends/fs/posix/posix-fs-factory.h index cf1204c0a3..d8eecda6ef 100644 --- a/backends/fs/posix/posix-fs-factory.h +++ b/backends/fs/posix/posix-fs-factory.h @@ -26,14 +26,14 @@ #define POSIX_FILESYSTEM_FACTORY_H #include "common/singleton.h" -#include "backends/fs/abstract-fs-factory.h" +#include "backends/fs/fs-factory.h" /** * Creates POSIXFilesystemNode objects. * - * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. + * Parts of this class are documented in the base interface class, FilesystemFactory. */ -class POSIXFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton { +class POSIXFilesystemFactory : public FilesystemFactory, public Common::Singleton { public: typedef Common::String String; diff --git a/backends/fs/ps2/ps2-fs-factory.h b/backends/fs/ps2/ps2-fs-factory.h index a7a52fdca3..1b74ae25d1 100644 --- a/backends/fs/ps2/ps2-fs-factory.h +++ b/backends/fs/ps2/ps2-fs-factory.h @@ -26,14 +26,14 @@ #define PS2_FILESYSTEM_FACTORY_H #include "common/singleton.h" -#include "backends/fs/abstract-fs-factory.h" +#include "backends/fs/fs-factory.h" /** * Creates PS2FilesystemNode objects. * - * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. + * Parts of this class are documented in the base interface class, FilesystemFactory. */ -class Ps2FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton { +class Ps2FilesystemFactory : public FilesystemFactory, public Common::Singleton { public: typedef Common::String String; diff --git a/backends/fs/psp/psp-fs-factory.h b/backends/fs/psp/psp-fs-factory.h index 143b2ce684..ffa934755f 100644 --- a/backends/fs/psp/psp-fs-factory.h +++ b/backends/fs/psp/psp-fs-factory.h @@ -26,14 +26,14 @@ #define PSP_FILESYSTEM_FACTORY_H #include "common/singleton.h" -#include "backends/fs/abstract-fs-factory.h" +#include "backends/fs/fs-factory.h" /** * Creates PSPFilesystemNode objects. * - * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. + * Parts of this class are documented in the base interface class, FilesystemFactory. */ -class PSPFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton { +class PSPFilesystemFactory : public FilesystemFactory, public Common::Singleton { public: typedef Common::String String; diff --git a/backends/fs/symbian/symbian-fs-factory.h b/backends/fs/symbian/symbian-fs-factory.h index 4b663fd6b9..502fba2930 100644 --- a/backends/fs/symbian/symbian-fs-factory.h +++ b/backends/fs/symbian/symbian-fs-factory.h @@ -26,14 +26,14 @@ #define SYMBIAN_FILESYSTEM_FACTORY_H #include "common/singleton.h" -#include "backends/fs/abstract-fs-factory.h" +#include "backends/fs/fs-factory.h" /** * Creates SymbianFilesystemNode objects. * - * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. + * Parts of this class are documented in the base interface class, FilesystemFactory. */ -class SymbianFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton { +class SymbianFilesystemFactory : public FilesystemFactory, public Common::Singleton { public: typedef Common::String String; diff --git a/backends/fs/windows/windows-fs-factory.h b/backends/fs/windows/windows-fs-factory.h index 5989cbb17d..0745b286a8 100644 --- a/backends/fs/windows/windows-fs-factory.h +++ b/backends/fs/windows/windows-fs-factory.h @@ -26,14 +26,14 @@ #define WINDOWS_FILESYSTEM_FACTORY_H #include "common/singleton.h" -#include "backends/fs/abstract-fs-factory.h" +#include "backends/fs/fs-factory.h" /** * Creates WindowsFilesystemNode objects. * - * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. + * Parts of this class are documented in the base interface class, FilesystemFactory. */ -class WindowsFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton { +class WindowsFilesystemFactory : public FilesystemFactory, public Common::Singleton { public: typedef Common::String String; -- cgit v1.2.3