[Scummvm-cvs-logs] SF.net SVN: scummvm: [28395] scummvm/branches/gsoc2007-fsnode
david_corrales at users.sourceforge.net
david_corrales at users.sourceforge.net
Thu Aug 2 00:07:50 CEST 2007
Revision: 28395
http://scummvm.svn.sourceforge.net/scummvm/?rev=28395&view=rev
Author: david_corrales
Date: 2007-08-01 15:07:50 -0700 (Wed, 01 Aug 2007)
Log Message:
-----------
Initial commit of the new BaseFile implementation. It provides a common ground for file objects across platforms and divides responsibilities between the Common::File class and a base file implementation.
Also rearranged the factories into a new directory for clarity.
Note 1: The posix-file.h and cpp files are for testing only. Only the ds, ps2 and symbian architecture will use special BaseFile based objects.
Note 2: The current code does not yet make use of this new structure, since the Common::File remains intact.
Modified Paths:
--------------
scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs.h
scummvm/branches/gsoc2007-fsnode/common/file.h
scummvm/branches/gsoc2007-fsnode/common/fs.cpp
Added Paths:
-----------
scummvm/branches/gsoc2007-fsnode/backends/factories/
scummvm/branches/gsoc2007-fsnode/backends/factories/abstract-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/factories/amigaos4/
scummvm/branches/gsoc2007-fsnode/backends/factories/amigaos4/amigaos4-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/factories/amigaos4/amigaos4-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/factories/dc/
scummvm/branches/gsoc2007-fsnode/backends/factories/dc/ronincd-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/factories/dc/ronincd-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/factories/ds/
scummvm/branches/gsoc2007-fsnode/backends/factories/ds/ds-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/factories/ds/ds-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/factories/fs-factory-maker.cpp
scummvm/branches/gsoc2007-fsnode/backends/factories/gp32/
scummvm/branches/gsoc2007-fsnode/backends/factories/gp32/gp32-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/factories/gp32/gp32-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/factories/morphos/
scummvm/branches/gsoc2007-fsnode/backends/factories/morphos/abox-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/factories/morphos/abox-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/factories/palmos/
scummvm/branches/gsoc2007-fsnode/backends/factories/palmos/palmos-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/factories/palmos/palmos-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/factories/posix/
scummvm/branches/gsoc2007-fsnode/backends/factories/posix/posix-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/factories/posix/posix-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/factories/ps2/
scummvm/branches/gsoc2007-fsnode/backends/factories/ps2/ps2-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/factories/ps2/ps2-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/factories/psp/
scummvm/branches/gsoc2007-fsnode/backends/factories/psp/psp-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/factories/psp/psp-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/factories/symbian/
scummvm/branches/gsoc2007-fsnode/backends/factories/symbian/symbian-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/factories/symbian/symbian-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/factories/windows/
scummvm/branches/gsoc2007-fsnode/backends/factories/windows/windows-fs-factory.cpp
scummvm/branches/gsoc2007-fsnode/backends/factories/windows/windows-fs-factory.h
scummvm/branches/gsoc2007-fsnode/backends/file/
scummvm/branches/gsoc2007-fsnode/backends/file/base-file.cpp
scummvm/branches/gsoc2007-fsnode/backends/file/base-file.h
scummvm/branches/gsoc2007-fsnode/backends/file/ds/
scummvm/branches/gsoc2007-fsnode/backends/file/ds/ds-file.cpp
scummvm/branches/gsoc2007-fsnode/backends/file/ds/ds-file.h
scummvm/branches/gsoc2007-fsnode/backends/file/posix/
scummvm/branches/gsoc2007-fsnode/backends/file/posix/posix-file.cpp
scummvm/branches/gsoc2007-fsnode/backends/file/posix/posix-file.h
scummvm/branches/gsoc2007-fsnode/backends/file/ps2/
scummvm/branches/gsoc2007-fsnode/backends/file/ps2/ps2-file.cpp
scummvm/branches/gsoc2007-fsnode/backends/file/ps2/ps2-file.h
scummvm/branches/gsoc2007-fsnode/backends/file/symbian/
scummvm/branches/gsoc2007-fsnode/backends/file/symbian/symbian-file.cpp
scummvm/branches/gsoc2007-fsnode/backends/file/symbian/symbian-file.h
Removed Paths:
-------------
scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs-factory.h
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
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/abstract-fs-factory.h (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs-factory.h)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/abstract-fs-factory.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/abstract-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,56 @@
+#ifndef ABSTRACT_FILESYSTEM_FACTORY_H
+#define ABSTRACT_FILESYSTEM_FACTORY_H
+
+#include "common/str.h"
+#include "backends/fs/abstract-fs.h"
+#include "backends/file/base-file.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;
+
+ /**
+ * Creates a base file usable by the Common::File wrapper to implement several
+ * methods.
+ */
+ virtual BaseFile *makeBaseFile() const = 0;
+};
+
+#endif /*ABSTRACT_FILESYSTEM_FACTORY_H*/
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/amigaos4/amigaos4-fs-factory.cpp (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.cpp)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/amigaos4/amigaos4-fs-factory.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/amigaos4/amigaos4-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,21 @@
+#include "backends/factories/amigaos4/amigaos4-fs-factory.h"
+#include "backends/fs/amigaos4/amigaos4-fs.cpp"
+#include "backends/file/amigaos4/amigaos4-file.h"
+
+DECLARE_SINGLETON(AmigaOSFilesystemFactory);
+
+AbstractFilesystemNode *AmigaOSFilesystemFactory::makeRootFileNode() const {
+ return new AmigaOSFilesystemNode();
+}
+
+AbstractFilesystemNode *AmigaOSFilesystemFactory::makeCurrentDirectoryFileNode() const {
+ return new AmigaOSFilesystemNode();
+}
+
+AbstractFilesystemNode *AmigaOSFilesystemFactory::makeFileNodePath(const String &path) const {
+ return new AmigaOSFilesystemNode(path);
+}
+
+BaseFile *AmigaOSFilesystemFactory::makeBaseFile() const {
+ return new AmigaOSFile();
+}
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/amigaos4/amigaos4-fs-factory.h (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.h)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/amigaos4/amigaos4-fs-factory.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/amigaos4/amigaos4-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,28 @@
+#ifndef AMIGAOS_FILESYSTEM_FACTORY_H
+#define AMIGAOS_FILESYSTEM_FACTORY_H
+
+#include "common/singleton.h"
+#include "backends/factories/abstract-fs-factory.h"
+
+/**
+ * Creates AmigaOSFilesystemNode objects.
+ *
+ * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
+ */
+class AmigaOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<AmigaOSFilesystemFactory> {
+public:
+ typedef Common::String String;
+
+ virtual AbstractFilesystemNode *makeRootFileNode() const;
+ virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
+ virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
+ virtual BaseFile *makeBaseFile() const;
+
+protected:
+ AmigaOSFilesystemFactory() {};
+
+private:
+ friend class Common::Singleton<SingletonBaseType>;
+};
+
+#endif /*AMIGAOS_FILESYSTEM_FACTORY_H*/
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/dc/ronincd-fs-factory.cpp (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.cpp)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/dc/ronincd-fs-factory.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/dc/ronincd-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,21 @@
+#include "backends/factories/dc/ronincd-fs-factory.h"
+#include "backends/fs/dc/dc-fs.cpp"
+#include "backends/file/base-file.h"
+
+DECLARE_SINGLETON(RoninCDFilesystemFactory);
+
+AbstractFilesystemNode *RoninCDFilesystemFactory::makeRootFileNode() const {
+ return new RoninCDFilesystemNode();
+}
+
+AbstractFilesystemNode *RoninCDFilesystemFactory::makeCurrentDirectoryFileNode() const {
+ return new RoninCDFilesystemNode();
+}
+
+AbstractFilesystemNode *RoninCDFilesystemFactory::makeFileNodePath(const String &path) const {
+ return new RoninCDFilesystemNode(path, true);
+}
+
+BaseFile *RoninCDFilesystemFactory::makeBaseFile() const {
+ return new BaseFile();
+}
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/dc/ronincd-fs-factory.h (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.h)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/dc/ronincd-fs-factory.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/dc/ronincd-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,28 @@
+#ifndef RONINCD_FILESYSTEM_FACTORY_H
+#define RONINCD_FILESYSTEM_FACTORY_H
+
+#include "common/singleton.h"
+#include "backends/factories/abstract-fs-factory.h"
+
+/**
+ * Creates RoninCDFilesystemNode objects.
+ *
+ * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
+ */
+class RoninCDFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<RoninCDFilesystemFactory> {
+public:
+ typedef Common::String String;
+
+ virtual AbstractFilesystemNode *makeRootFileNode() const;
+ virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
+ virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
+ virtual BaseFile *makeBaseFile() const;
+
+protected:
+ RoninCDFilesystemFactory() {};
+
+private:
+ friend class Common::Singleton<SingletonBaseType>;
+};
+
+#endif /*RONINCD_FILESYSTEM_FACTORY_H*/
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/ds/ds-fs-factory.cpp (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.cpp)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/ds/ds-fs-factory.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/ds/ds-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,34 @@
+#include "backends/factories/ds/ds-fs-factory.h"
+#include "backends/fs/ds/ds-fs.cpp"
+#include "backends/file/ds/ds-file.h"
+#include "dsmain.h" //for the isGBAMPAvailable() function
+
+DECLARE_SINGLETON(DSFilesystemFactory);
+
+AbstractFilesystemNode *DSFilesystemFactory::makeRootFileNode() const {
+ if (DS::isGBAMPAvailable()) {
+ return new DS::GBAMPFileSystemNode();
+ } else {
+ return new DS::DSFileSystemNode();
+ }
+}
+
+AbstractFilesystemNode *DSFilesystemFactory::makeCurrentDirectoryFileNode() const {
+ if (DS::isGBAMPAvailable()) {
+ return new DS::GBAMPFileSystemNode();
+ } else {
+ return new DS::DSFileSystemNode();
+ }
+}
+
+AbstractFilesystemNode *DSFilesystemFactory::makeFileNodePath(const String &path) const {
+ if (DS::isGBAMPAvailable()) {
+ return new DS::GBAMPFileSystemNode(path);
+ } else {
+ return new DS::DSFileSystemNode(path);
+ }
+}
+
+BaseFile *DSFilesystemFactory::makeBaseFile() const {
+ return new DSFile();
+}
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/ds/ds-fs-factory.h (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.h)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/ds/ds-fs-factory.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/ds/ds-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,28 @@
+#ifndef DS_FILESYSTEM_FACTORY_H
+#define DS_FILESYSTEM_FACTORY_H
+
+#include "common/singleton.h"
+#include "backends/factories/abstract-fs-factory.h"
+
+/**
+ * Creates DSFilesystemNode objects.
+ *
+ * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
+ */
+class DSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<DSFilesystemFactory> {
+public:
+ typedef Common::String String;
+
+ virtual AbstractFilesystemNode *makeRootFileNode() const;
+ virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
+ virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
+ virtual BaseFile *makeBaseFile() const;
+
+protected:
+ DSFilesystemFactory() {};
+
+private:
+ friend class Common::Singleton<SingletonBaseType>;
+};
+
+#endif /*DS_FILESYSTEM_FACTORY_H*/
Added: scummvm/branches/gsoc2007-fsnode/backends/factories/fs-factory-maker.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/fs-factory-maker.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/fs-factory-maker.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,113 @@
+#include "backends/factories/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/factories/amigaos4/amigaos4-fs-factory.cpp"
+#endif
+
+#if defined(__DC__)
+ #include "backends/factories/dc/ronincd-fs-factory.cpp"
+#endif
+
+#if defined(__DS__)
+ #include "backends/factories/ds/ds-fs-factory.cpp"
+#endif
+
+#if defined(__GP32__)
+ #include "backends/factories/gp32/gp32-fs-factory.cpp"
+#endif
+
+#if defined(__MORPHOS__)
+ #include "backends/factories/morphos/abox-fs-factory.cpp"
+#endif
+
+#if defined(PALMOS_MODE)
+ #include "backends/factories/palmos/palmos-fs-factory.cpp"
+#endif
+
+#if defined(__PLAYSTATION2__)
+ #include "backends/factories/ps2/ps2-fs-factory.cpp"
+#endif
+
+#if defined(__PSP__)
+ #include "backends/factories/psp/psp-fs-factory.cpp"
+#endif
+
+#if defined(__SYMBIAN32__)
+ #include "backends/factories/symbian/symbian-fs-factory.cpp"
+#endif
+
+#if defined(UNIX)
+ #include "backends/factories/posix/posix-fs-factory.cpp"
+#endif
+
+#if defined(WIN32)
+ #include "backends/factories/windows/windows-fs-factory.cpp"
+#endif
+
+/**
+ * Creates concrete FilesystemFactory and FileFactory objects depending on the current architecture.
+ */
+class FilesystemFactoryMaker {
+public:
+
+ /**
+ * Returns the correct concrete filesystem factory depending on the current build architecture.
+ */
+ static AbstractFilesystemFactory *makeFactory();
+
+protected:
+ FilesystemFactoryMaker() {}; // avoid instances of this class
+};
+
+AbstractFilesystemFactory *FilesystemFactoryMaker::makeFactory(){
+ #if defined(__amigaos4__)
+ return &AmigaOSFilesystemFactory::instance();
+ #endif
+
+ #if defined(__DC__)
+ return &RoninCDFilesystemFactory::instance();
+ #endif
+
+ #if defined(__DS__)
+ return &DSFilesystemFactory::instance();
+ #endif
+
+ #if defined(__GP32__)
+ return &GP32FilesystemFactory::instance();
+ #endif
+
+ #if defined(__MORPHOS__)
+ return &ABoxFilesystemFactory::instance();
+ #endif
+
+ #if defined(PALMOS_MODE)
+ return &PalmOSFilesystemFactory::instance();
+ #endif
+
+ #if defined(__PLAYSTATION2__)
+ return &Ps2FilesystemFactory::instance();
+ #endif
+
+ #if defined(__PSP__)
+ return &PSPFilesystemFactory::instance();
+ #endif
+
+ #if defined(__SYMBIAN32__)
+ return &SymbianFilesystemFactory::instance();
+ #endif
+
+ #if defined(UNIX)
+ return &POSIXFilesystemFactory::instance();
+ #endif
+
+ #if defined(WIN32)
+ return &WindowsFilesystemFactory::instance();
+ #endif
+}
Property changes on: scummvm/branches/gsoc2007-fsnode/backends/factories/fs-factory-maker.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/gp32/gp32-fs-factory.cpp (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.cpp)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/gp32/gp32-fs-factory.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/gp32/gp32-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,21 @@
+#include "backends/factories/gp32/gp32-fs-factory.h"
+#include "backends/fs/gp32/gp32-fs.cpp"
+#include "backends/file/base-file.h"
+
+DECLARE_SINGLETON(GP32FilesystemFactory);
+
+AbstractFilesystemNode *GP32FilesystemFactory::makeRootFileNode() const {
+ return new GP32FilesystemNode();
+}
+
+AbstractFilesystemNode *GP32FilesystemFactory::makeCurrentDirectoryFileNode() const {
+ return new GP32FilesystemNode();
+}
+
+AbstractFilesystemNode *GP32FilesystemFactory::makeFileNodePath(const String &path) const {
+ return new GP32FilesystemNode(path);
+}
+
+BaseFile *GP32FilesystemFactory::makeBaseFile() const {
+ return new BaseFile();
+}
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/gp32/gp32-fs-factory.h (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.h)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/gp32/gp32-fs-factory.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/gp32/gp32-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,28 @@
+#ifndef GP32_FILESYSTEM_FACTORY_H
+#define GP32_FILESYSTEM_FACTORY_H
+
+#include "common/singleton.h"
+#include "backends/factories/abstract-fs-factory.h"
+
+/**
+ * Creates GP32FilesystemNode objects.
+ *
+ * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
+ */
+class GP32FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<GP32FilesystemFactory> {
+public:
+ typedef Common::String String;
+
+ virtual AbstractFilesystemNode *makeRootFileNode() const;
+ virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
+ virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
+ virtual BaseFile *makeBaseFile() const;
+
+protected:
+ GP32FilesystemFactory() {};
+
+private:
+ friend class Common::Singleton<SingletonBaseType>;
+};
+
+#endif /*GP32_FILESYSTEM_FACTORY_H*/
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/morphos/abox-fs-factory.cpp (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.cpp)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/morphos/abox-fs-factory.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/morphos/abox-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,21 @@
+#include "backends/factories/morphos/abox-fs-factory.h"
+#include "backends/fs/morphos/abox-fs.cpp"
+#include "backends/file/base-file.h"
+
+DECLARE_SINGLETON(ABoxFilesystemFactory);
+
+AbstractFilesystemNode *ABoxFilesystemFactory::makeRootFileNode() const {
+ return new ABoxFilesystemNode();
+}
+
+AbstractFilesystemNode *ABoxFilesystemFactory::makeCurrentDirectoryFileNode() const {
+ return new ABoxFilesystemNode();
+}
+
+AbstractFilesystemNode *ABoxFilesystemFactory::makeFileNodePath(const String &path) const {
+ return new ABoxFilesystemNode(path);
+}
+
+BaseFile *ABoxFilesystemFactory::makeBaseFile() const {
+ return new BaseFile();
+}
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/morphos/abox-fs-factory.h (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.h)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/morphos/abox-fs-factory.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/morphos/abox-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,28 @@
+#ifndef ABOX_FILESYSTEM_FACTORY_H
+#define ABOX_FILESYSTEM_FACTORY_H
+
+#include "common/singleton.h"
+#include "backends/factories/abstract-fs-factory.h"
+
+/**
+ * Creates ABoxFilesystemNode objects.
+ *
+ * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
+ */
+class ABoxFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<ABoxFilesystemFactory> {
+public:
+ typedef Common::String String;
+
+ virtual AbstractFilesystemNode *makeRootFileNode() const;
+ virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
+ virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
+ virtual BaseFile *makeBaseFile() const;
+
+protected:
+ ABoxFilesystemFactory() {};
+
+private:
+ friend class Common::Singleton<SingletonBaseType>;
+};
+
+#endif /*ABOX_FILESYSTEM_FACTORY_H*/
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/palmos/palmos-fs-factory.cpp (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.cpp)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/palmos/palmos-fs-factory.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/palmos/palmos-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,21 @@
+#include "backends/factories/palmos/palmos-fs-factory.h"
+#include "backends/fs/palmos/palmos-fs.cpp"
+#include "backends/file/base-file.h"
+
+DECLARE_SINGLETON(PalmOSFilesystemFactory);
+
+AbstractFilesystemNode *PalmOSFilesystemFactory::makeRootFileNode() const {
+ return new PalmOSFilesystemNode();
+}
+
+AbstractFilesystemNode *PalmOSFilesystemFactory::makeCurrentDirectoryFileNode() const {
+ return new PalmOSFilesystemNode();
+}
+
+AbstractFilesystemNode *PalmOSFilesystemFactory::makeFileNodePath(const String &path) const {
+ return new PalmOSFilesystemNode(path);
+}
+
+BaseFile *PalmOSFilesystemFactory::makeBaseFile() const {
+ return new BaseFile();
+}
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/palmos/palmos-fs-factory.h (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.h)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/palmos/palmos-fs-factory.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/palmos/palmos-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,28 @@
+#ifndef PALMOS_FILESYSTEM_FACTORY_H
+#define PALMOS_FILESYSTEM_FACTORY_H
+
+#include "common/singleton.h"
+#include "backends/factories/abstract-fs-factory.h"
+
+/**
+ * Creates PalmOSFilesystemNode objects.
+ *
+ * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
+ */
+class PalmOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PalmOSFilesystemFactory> {
+public:
+ typedef Common::String String;
+
+ virtual AbstractFilesystemNode *makeRootFileNode() const;
+ virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
+ virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
+ virtual BaseFile *makeBaseFile() const;
+
+protected:
+ PalmOSFilesystemFactory() {};
+
+private:
+ friend class Common::Singleton<SingletonBaseType>;
+};
+
+#endif /*PALMOS_FILESYSTEM_FACTORY_H*/
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/posix/posix-fs-factory.cpp (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.cpp)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/posix/posix-fs-factory.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/posix/posix-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,24 @@
+#include "backends/factories/posix/posix-fs-factory.h"
+#include "backends/fs/posix/posix-fs.cpp"
+#include "backends/file/posix/posix-file.cpp"
+//#include "backends/file/base-file.cpp"
+
+DECLARE_SINGLETON(POSIXFilesystemFactory);
+
+AbstractFilesystemNode *POSIXFilesystemFactory::makeRootFileNode() const {
+ return new POSIXFilesystemNode();
+}
+
+AbstractFilesystemNode *POSIXFilesystemFactory::makeCurrentDirectoryFileNode() const {
+ char buf[MAXPATHLEN];
+ getcwd(buf, MAXPATHLEN);
+ return new POSIXFilesystemNode(buf, true);
+}
+
+AbstractFilesystemNode *POSIXFilesystemFactory::makeFileNodePath(const String &path) const {
+ return new POSIXFilesystemNode(path, true);
+}
+
+BaseFile *POSIXFilesystemFactory::makeBaseFile() const {
+ return new POSIXFile();
+}
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/posix/posix-fs-factory.h (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.h)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/posix/posix-fs-factory.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/posix/posix-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,28 @@
+#ifndef POSIX_FILESYSTEM_FACTORY_H
+#define POSIX_FILESYSTEM_FACTORY_H
+
+#include "common/singleton.h"
+#include "backends/factories/abstract-fs-factory.h"
+
+/**
+ * Creates POSIXFilesystemNode objects.
+ *
+ * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
+ */
+class POSIXFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<POSIXFilesystemFactory> {
+public:
+ typedef Common::String String;
+
+ virtual AbstractFilesystemNode *makeRootFileNode() const;
+ virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
+ virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
+ virtual BaseFile *makeBaseFile() const;
+
+protected:
+ POSIXFilesystemFactory() {};
+
+private:
+ friend class Common::Singleton<SingletonBaseType>;
+};
+
+#endif /*POSIX_FILESYSTEM_FACTORY_H*/
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/ps2/ps2-fs-factory.cpp (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.cpp)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/ps2/ps2-fs-factory.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/ps2/ps2-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,21 @@
+#include "backends/factories/ps2/ps2-fs-factory.h"
+#include "backends/fs/ps2/ps2-fs.cpp"
+#include "backends/file/ps2/ps2-file.h"
+
+DECLARE_SINGLETON(Ps2FilesystemFactory);
+
+AbstractFilesystemNode *Ps2FilesystemFactory::makeRootFileNode() const {
+ return new Ps2FilesystemNode();
+}
+
+AbstractFilesystemNode *Ps2FilesystemFactory::makeCurrentDirectoryFileNode() const {
+ return new Ps2FilesystemNode();
+}
+
+AbstractFilesystemNode *Ps2FilesystemFactory::makeFileNodePath(const String &path) const {
+ return new Ps2FilesystemNode(path);
+}
+
+BaseFile *Ps2FilesystemFactory::makeBaseFile() const {
+ return new Ps2File();
+}
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/ps2/ps2-fs-factory.h (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.h)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/ps2/ps2-fs-factory.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/ps2/ps2-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,28 @@
+#ifndef PS2_FILESYSTEM_FACTORY_H
+#define PS2_FILESYSTEM_FACTORY_H
+
+#include "common/singleton.h"
+#include "backends/factories/abstract-fs-factory.h"
+
+/**
+ * Creates PS2FilesystemNode objects.
+ *
+ * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
+ */
+class Ps2FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<Ps2FilesystemFactory> {
+public:
+ typedef Common::String String;
+
+ virtual AbstractFilesystemNode *makeRootFileNode() const;
+ virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
+ virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
+ virtual BaseFile *makeBaseFile() const;
+
+protected:
+ Ps2FilesystemFactory() {};
+
+private:
+ friend class Common::Singleton<SingletonBaseType>;
+};
+
+#endif /*PS2_FILESYSTEM_FACTORY_H*/
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/psp/psp-fs-factory.cpp (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.cpp)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/psp/psp-fs-factory.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/psp/psp-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,21 @@
+#include "backends/factories/psp/psp-fs-factory.h"
+#include "backends/fs/psp/psp_fs.cpp"
+#include "backends/file/base-file.h"
+
+DECLARE_SINGLETON(PSPFilesystemFactory);
+
+AbstractFilesystemNode *PSPFilesystemFactory::makeRootFileNode() const {
+ return new PSPFilesystemNode();
+}
+
+AbstractFilesystemNode *PSPFilesystemFactory::makeCurrentDirectoryFileNode() const {
+ return new PSPFilesystemNode();
+}
+
+AbstractFilesystemNode *PSPFilesystemFactory::makeFileNodePath(const String &path) const {
+ return new PSPFilesystemNode(path, true);
+}
+
+BaseFile *PSPFilesystemFactory::makeBaseFile() const {
+ return new BaseFile();
+}
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/psp/psp-fs-factory.h (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.h)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/psp/psp-fs-factory.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/psp/psp-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,28 @@
+#ifndef PSP_FILESYSTEM_FACTORY_H
+#define PSP_FILESYSTEM_FACTORY_H
+
+#include "common/singleton.h"
+#include "backends/factories/abstract-fs-factory.h"
+
+/**
+ * Creates PSPFilesystemNode objects.
+ *
+ * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
+ */
+class PSPFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PSPFilesystemFactory> {
+public:
+ typedef Common::String String;
+
+ virtual AbstractFilesystemNode *makeRootFileNode() const;
+ virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
+ virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
+ virtual BaseFile *makeBaseFile() const;
+
+protected:
+ PSPFilesystemFactory() {};
+
+private:
+ friend class Common::Singleton<SingletonBaseType>;
+};
+
+#endif /*PSP_FILESYSTEM_FACTORY_H*/
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/symbian/symbian-fs-factory.cpp (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.cpp)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/symbian/symbian-fs-factory.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/symbian/symbian-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,23 @@
+#include "backends/factories/symbian/symbian-fs-factory.h"
+#include "backends/fs/symbian/symbian-fs.cpp"
+#include "backends/file/symbian/symbian-file.h"
+
+DECLARE_SINGLETON(SymbianFilesystemFactory);
+
+AbstractFilesystemNode *SymbianFilesystemFactory::makeRootFileNode() const {
+ return new SymbianFilesystemNode(true);
+}
+
+AbstractFilesystemNode *SymbianFilesystemFactory::makeCurrentDirectoryFileNode() const {
+ char path[MAXPATHLEN];
+ getcwd(path, MAXPATHLEN);
+ return new SymbianFilesystemNode(path);
+}
+
+AbstractFilesystemNode *SymbianFilesystemFactory::makeFileNodePath(const String &path) const {
+ return new SymbianFilesystemNode(path);
+}
+
+BaseFile *SymbianFilesystemFactory::makeBaseFile() const {
+ return new SymbianFile();
+}
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/symbian/symbian-fs-factory.h (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.h)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/symbian/symbian-fs-factory.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/symbian/symbian-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,28 @@
+#ifndef SYMBIAN_FILESYSTEM_FACTORY_H
+#define SYMBIAN_FILESYSTEM_FACTORY_H
+
+#include "common/singleton.h"
+#include "backends/factories/abstract-fs-factory.h"
+
+/**
+ * Creates SymbianFilesystemNode objects.
+ *
+ * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
+ */
+class SymbianFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<SymbianFilesystemFactory> {
+public:
+ typedef Common::String String;
+
+ virtual AbstractFilesystemNode *makeRootFileNode() const;
+ virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
+ virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
+ virtual BaseFile *makeBaseFile() const;
+
+protected:
+ SymbianFilesystemFactory() {};
+
+private:
+ friend class Common::Singleton<SingletonBaseType>;
+};
+
+#endif /*SYMBIAN_FILESYSTEM_FACTORY_H*/
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/windows/windows-fs-factory.cpp (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.cpp)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/windows/windows-fs-factory.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/windows/windows-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,21 @@
+#include "backends/factories/windows/windows-fs-factory.h"
+#include "backends/fs/windows/windows-fs.cpp"
+#include "backends/file/base-file.h"
+
+DECLARE_SINGLETON(WindowsFilesystemFactory);
+
+AbstractFilesystemNode *WindowsFilesystemFactory::makeRootFileNode() const {
+ return new WindowsFilesystemNode();
+}
+
+AbstractFilesystemNode *WindowsFilesystemFactory::makeCurrentDirectoryFileNode() const {
+ return new WindowsFilesystemNode("", true);
+}
+
+AbstractFilesystemNode *WindowsFilesystemFactory::makeFileNodePath(const String &path) const {
+ return new WindowsFilesystemNode(path, false);
+}
+
+BaseFile *WindowsFilesystemFactory::makeBaseFile() const {
+ return new BaseFile();
+}
Copied: scummvm/branches/gsoc2007-fsnode/backends/factories/windows/windows-fs-factory.h (from rev 28281, scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.h)
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/factories/windows/windows-fs-factory.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/factories/windows/windows-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,28 @@
+#ifndef WINDOWS_FILESYSTEM_FACTORY_H
+#define WINDOWS_FILESYSTEM_FACTORY_H
+
+#include "common/singleton.h"
+#include "backends/factories/abstract-fs-factory.h"
+
+/**
+ * Creates WindowsFilesystemNode objects.
+ *
+ * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
+ */
+class WindowsFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<WindowsFilesystemFactory> {
+public:
+ typedef Common::String String;
+
+ virtual AbstractFilesystemNode *makeRootFileNode() const;
+ virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
+ virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
+ virtual BaseFile *makeBaseFile() const;
+
+protected:
+ WindowsFilesystemFactory() {};
+
+private:
+ friend class Common::Singleton<SingletonBaseType>;
+};
+
+#endif /*WINDOWS_FILESYSTEM_FACTORY_H*/
Added: scummvm/branches/gsoc2007-fsnode/backends/file/base-file.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/file/base-file.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/file/base-file.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,226 @@
+/* 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: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/branches/gsoc2007-fsnode/common/file.cpp $
+ * $Id: file.cpp 28150 2007-07-20 19:42:38Z david_corrales $
+ *
+ */
+
+#include "backends/file/base-file.h"
+#include "common/fs.h"
+#include "common/hashmap.h"
+#include "common/util.h"
+#include "common/hash-str.h"
+
+#if defined(UNIX) || defined(__SYMBIAN32__)
+#include <errno.h>
+#endif
+
+#ifdef MACOSX
+#include "CoreFoundation/CoreFoundation.h"
+#endif
+
+BaseFile::BaseFile() {
+ _handle = 0;
+ _ioFailed = false;
+}
+
+//#define DEBUG_FILE_REFCOUNT
+
+BaseFile::~BaseFile() {
+#ifdef DEBUG_FILE_REFCOUNT
+ warning("File::~File on file '%s'", _name.c_str());
+#endif
+ close();
+}
+
+bool BaseFile::open(const String &filename, AccessMode mode) {
+ assert(mode == kFileReadMode || mode == kFileWriteMode);
+
+ if (filename.empty()) {
+ error("File::open: No filename was specified");
+ }
+
+ if (_handle) {
+ error("File::open: This file object already is opened (%s), won't open '%s'", _name.c_str(), filename.c_str());
+ }
+
+ _name.clear();
+ clearIOFailed();
+
+ const char *modeStr = (mode == kFileReadMode) ? "rb" : "wb";
+ _handle = _fopen(filename.c_str(), modeStr);
+
+ if (_handle == NULL) {
+ if (mode == kFileReadMode)
+ debug(2, "File %s not found", filename.c_str());
+ else
+ debug(2, "File %s not opened", filename.c_str());
+ return false;
+ }
+
+ _name = filename;
+
+#ifdef DEBUG_FILE_REFCOUNT
+ warning("File::open on file '%s'", _name.c_str());
+#endif
+
+ return true;
+}
+
+bool BaseFile::remove(const String &filename){
+ if (remove(filename.c_str()) != 0) {
+ if(errno == EACCES)
+ ;//TODO: read-only file
+ if(errno == ENOENT)
+ ;//TODO: non-existent file
+
+ return false;
+ } else {
+ return true;
+ }
+}
+
+void BaseFile::close() {
+ if (_handle)
+ _fclose((FILE *)_handle);
+ _handle = NULL;
+}
+
+bool BaseFile::isOpen() const {
+ return _handle != NULL;
+}
+
+bool BaseFile::ioFailed() const {
+ return _ioFailed != 0;
+}
+
+void BaseFile::clearIOFailed() {
+ _ioFailed = false;
+}
+
+bool BaseFile::eof() const {
+ if (_handle == NULL) {
+ error("File::eof: File is not open!");
+ return false;
+ }
+
+ return _feof((FILE *)_handle) != 0;
+}
+
+uint32 BaseFile::pos() const {
+ if (_handle == NULL) {
+ error("File::pos: File is not open!");
+ return 0;
+ }
+
+ return _ftell((FILE *)_handle);
+}
+
+uint32 BaseFile::size() const {
+ if (_handle == NULL) {
+ error("File::size: File is not open!");
+ return 0;
+ }
+
+ uint32 oldPos = _ftell((FILE *)_handle);
+ _fseek((FILE *)_handle, 0, SEEK_END);
+ uint32 length = _ftell((FILE *)_handle);
+ _fseek((FILE *)_handle, oldPos, SEEK_SET);
+
+ return length;
+}
+
+void BaseFile::seek(int32 offs, int whence) {
+ if (_handle == NULL) {
+ error("File::seek: File is not open!");
+ return;
+ }
+
+ if (_fseek((FILE *)_handle, offs, whence) != 0)
+ _clearerr((FILE *)_handle);
+}
+
+uint32 BaseFile::read(void *ptr, uint32 len) {
+ byte *ptr2 = (byte *)ptr;
+ uint32 real_len;
+
+ if (_handle == NULL) {
+ error("File::read: File is not open!");
+ return 0;
+ }
+
+ if (len == 0)
+ return 0;
+
+ real_len = _fread(ptr2, 1, len, (FILE *)_handle);
+ if (real_len < len) {
+ _ioFailed = true;
+ }
+
+ return real_len;
+}
+
+/*uint32 File::write(const void *ptr, uint32 len) {
+ if (_handle == NULL) {
+ error("File::write: File is not open!");
+ return 0;
+ }
+
+ if (len == 0)
+ return 0;
+
+ if ((uint32)_fwrite(ptr, 1, len, (FILE *)_handle) != len) {
+ _ioFailed = true;
+ }
+
+ return len;
+}*/
+
+void BaseFile::_clearerr(FILE *stream) {
+ clearerr(stream);
+}
+
+int BaseFile::_fclose(FILE *stream) {
+ return fclose(stream);
+}
+
+int BaseFile::_feof(FILE *stream) const {
+ return feof(stream);
+}
+FILE *BaseFile::_fopen(const char * filename, const char * mode) {
+ return fopen(filename, mode);
+}
+
+int BaseFile::_fread(void *buffer, size_t obj_size, size_t num, FILE *stream) {
+ return fread(buffer, obj_size, num, stream);
+}
+
+int BaseFile::_fseek(FILE * stream, long int offset, int origin) const {
+ return fseek(stream, offset, origin);
+}
+
+long BaseFile::_ftell(FILE *stream) const {
+ return ftell(stream);
+}
+
+int BaseFile::_fwrite(const void * ptr, size_t obj_size, size_t count, FILE * stream) {
+ return fwrite(ptr, obj_size, count, stream);
+}
Property changes on: scummvm/branches/gsoc2007-fsnode/backends/file/base-file.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: scummvm/branches/gsoc2007-fsnode/backends/file/base-file.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/file/base-file.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/file/base-file.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,180 @@
+/* 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 BACKENDS_BASE_FILE_H
+#define BACKENDS_BASE_FILE_H
+
+#include "common/stdafx.h"
+#include "common/scummsys.h"
+#include "common/str.h"
+#include "common/stream.h"
+
+using namespace Common;
+
+/**
+ * Implements several file related functions used by the Common::File wrapper.
+ */
+class BaseFile : public Common::SeekableReadStream {
+protected:
+ /** File handle to the actual file; 0 if no file is open. */
+ void *_handle;
+
+ /** Status flag which tells about recent I/O failures. */
+ bool _ioFailed;
+
+ /** The name of this file, for debugging. */
+ String _name;
+
+ /**
+ * The following functions are meant to be redefined by subclasses if needed. E.g. ps2-file.h or ds-file.h
+ * They behave as the C++ standard I/O methods so refer to the standard documentation for usage.
+ *
+ * This design was inspired on the Template pattern.
+ */
+ void _clearerr(FILE *stream);
+ int _fclose(FILE *stream);
+ int _feof(FILE *stream) const;
+ FILE *_fopen(const char * filename, const char * mode);
+ int _fread(void *buffer, size_t obj_size, size_t num, FILE *stream);
+ int _fseek(FILE * stream, long int offset, int origin) const;
+ long _ftell(FILE *stream) const;
+ int _fwrite(const void * ptr, size_t obj_size, size_t count, FILE * stream);
+
+private:
+ // Disallow copying BaseFile objects. There is not strict reason for this,
+ // except that so far we never had real need for such a feature, and
+ // code that accidentally copied File objects tended to break in strange
+ // ways.
+ BaseFile(const BaseFile &f);
+ BaseFile &operator =(const BaseFile &f);
+
+public:
+ enum AccessMode {
+ kFileReadMode = 1,
+ kFileWriteMode = 2
+ };
+
+ BaseFile();
+ virtual ~BaseFile();
+
+ /**
+ * Clears the flag for the last ocurred IO failure.
+ */
+ void clearIOFailed();
+
+ /**
+ * Closes the file handle.
+ */
+ virtual void close();
+
+ /**
+ * Checks for end of file.
+ *
+ * @return: true if the end of file is reached, false otherwise.
+ */
+ bool eof() const;
+
+ /**
+ * Checks for the end of the stream. In this case it's equivalent to eof().
+ *
+ * @return: true if the end of the stream is reached, false otherwise.
+ */
+ bool eos() const { return eof(); }
+
+ /**
+ * Checks whether the last IO operation failed.
+ *
+ * @return: true if the last IO operation failed, false otherwise.
+ */
+ bool ioFailed() const;
+
+ /**
+ * Obtain the filename of the opened file.
+ *
+ * @return: the filename of the opened file.
+ */
+ const char *name() const { return _name.c_str(); }
+
+ /**
+ * Checks if the object opened a file successfully.
+ *
+ * @return: true if any file is opened, false otherwise.
+ */
+ bool isOpen() const;
+
+ /**
+ * Opens a given file.
+ *
+ * @param filename Path of the file to be opened.
+ * @param mode Mode to open to file. Read or write.
+ */
+ virtual bool open(const String &filename, AccessMode mode = kFileReadMode);
+
+ /**
+ * Obtain the position of the seek pointer.
+ *
+ * @return The position of the seek pointer within the file.
+ */
+ uint32 pos() const;
+
+ /**
+ * Read a chunk of data from the file.
+ *
+ * @param dataPtr Buffer to the place the read contents.
+ * @param dataSize Amount of bytes to read from the file.
+ * @return Amount of read bytes.
+ */
+ uint32 read(void *dataPtr, uint32 dataSize);
+
+ /**
+ * Remove a given file from the filesystem.
+ *
+ * @param filename Path to the file to be removed.
+ * @return true if the file was removed succesfully, false otherwise.
+ */
+ virtual bool remove(const String &filename);
+
+ /**
+ * Move the seek pointer within the file.
+ *
+ * @param offs Amount of bytes to move the pointer within the file.
+ * @param whence Starting point of the seek cursor.
+ */
+ void seek(int32 offs, int whence = SEEK_SET);
+
+ /**
+ * Obtain the size of the file.
+ *
+ * @return The size of the file in bytes.
+ */
+ uint32 size() const;
+
+ //TODO: Remove the write functions? Also remove the enum then
+ /**
+ * Write a chunk of data to the file.
+ */
+ //uint32 write(const void *dataPtr, uint32 dataSize);
+};
+
+#endif //BACKENDS_BASE_FILE_H
Property changes on: scummvm/branches/gsoc2007-fsnode/backends/file/base-file.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: scummvm/branches/gsoc2007-fsnode/backends/file/ds/ds-file.cpp
===================================================================
Property changes on: scummvm/branches/gsoc2007-fsnode/backends/file/ds/ds-file.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: scummvm/branches/gsoc2007-fsnode/backends/file/ds/ds-file.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/file/ds/ds-file.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/file/ds/ds-file.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,46 @@
+#ifdef __DS__
+
+ // These functions replease the standard library functions of the same name.
+ // As this header is included after the standard one, I have the chance to #define
+ // all of these to my own code.
+ //
+ // A #define is the only way, as redefinig the functions would cause linker errors.
+
+ // These functions need to be #undef'ed, as their original definition
+ // in devkitarm is done with #includes (ugh!)
+ #undef feof
+ #undef clearerr
+ //#undef getc
+ //#undef ferror
+
+
+ //void std_fprintf(FILE* handle, const char* fmt, ...); // used in common/util.cpp
+ //void std_fflush(FILE* handle); // used in common/util.cpp
+
+ //char* std_fgets(char* str, int size, FILE* file); // not used
+ //int std_getc(FILE* handle); // not used
+ //char* std_getcwd(char* dir, int dunno); // not used
+ //void std_cwd(char* dir); // not used
+ //int std_ferror(FILE* handle); // not used
+
+ // Only functions used in the ScummVM source have been defined here!
+ #define fopen(name, mode) DS::std_fopen(name, mode)
+ #define fclose(handle) DS::std_fclose(handle)
+ #define fread(ptr, size, items, file) DS::std_fread(ptr, size, items, file)
+ #define fwrite(ptr, size, items, file) DS::std_fwrite(ptr, size, items, file)
+ #define feof(handle) DS::std_feof(handle)
+ #define ftell(handle) DS::std_ftell(handle)
+ #define fseek(handle, offset, whence) DS::std_fseek(handle, offset, whence)
+ #define clearerr(handle) DS::std_clearerr(handle)
+
+ //#define printf(fmt, ...) consolePrintf(fmt, ##__VA_ARGS__)
+
+ //#define fprintf(file, fmt, ...) { char str[128]; sprintf(str, fmt, ##__VA_ARGS__); DS::std_fwrite(str, strlen(str), 1, file); }
+ //#define fflush(file) DS::std_fflush(file) // used in common/util.cpp
+
+ //#define fgets(str, size, file) DS::std_fgets(str, size, file) // not used
+ //#define getc(handle) DS::std_getc(handle) // not used
+ //#define getcwd(dir, dunno) DS::std_getcwd(dir, dunno) // not used
+ //#define ferror(handle) DS::std_ferror(handle) // not used
+
+#endif
\ No newline at end of file
Property changes on: scummvm/branches/gsoc2007-fsnode/backends/file/ds/ds-file.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: scummvm/branches/gsoc2007-fsnode/backends/file/posix/posix-file.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/file/posix/posix-file.cpp (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/file/posix/posix-file.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,41 @@
+#include "backends/file/posix/posix-file.h"
+
+POSIXFile::POSIXFile() : BaseFile() {
+ //
+}
+
+POSIXFile::~POSIXFile() {
+ close();
+}
+
+void POSIXFile::_clearerr(FILE *stream) {
+ clearerr(stream);
+}
+
+int POSIXFile::_fclose(FILE *stream) {
+ return fclose(stream);
+}
+
+int POSIXFile::_feof(FILE *stream) const {
+ return feof(stream);
+}
+FILE *POSIXFile::_fopen(const char * filename, const char * mode) {
+ printf("Opened a file!\n");
+ return fopen(filename, mode);
+}
+
+int POSIXFile::_fread(void *buffer, size_t obj_size, size_t num, FILE *stream) {
+ return fread(buffer, obj_size, num, stream);
+}
+
+int POSIXFile::_fseek(FILE * stream, long int offset, int origin) const {
+ return fseek(stream, offset, origin);
+}
+
+long POSIXFile::_ftell(FILE *stream) const {
+ return ftell(stream);
+}
+
+int POSIXFile::_fwrite(const void * ptr, size_t obj_size, size_t count, FILE * stream) {
+ return fwrite(ptr, obj_size, count, stream);
+}
Property changes on: scummvm/branches/gsoc2007-fsnode/backends/file/posix/posix-file.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: scummvm/branches/gsoc2007-fsnode/backends/file/posix/posix-file.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/file/posix/posix-file.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/file/posix/posix-file.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,50 @@
+/* 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 BACKENDS_POSIX_FILE_H
+#define BACKENDS_POSIX_FILE_H
+
+#include "backends/file/base-file.cpp"
+
+/**
+ * Implements several POSIX specific file related functions used by the Common::File wrapper.
+ *
+ * Parts of this class are documented in the base file class, BaseFile.
+ */
+class POSIXFile : public BaseFile {
+public:
+ POSIXFile();
+ ~POSIXFile();
+protected:
+ void _clearerr(FILE *stream);
+ int _fclose(FILE *stream);
+ int _feof(FILE *stream) const;
+ FILE *_fopen(const char * filename, const char * mode);
+ int _fread(void *buffer, size_t obj_size, size_t num, FILE *stream);
+ int _fseek(FILE * stream, long int offset, int origin) const;
+ long _ftell(FILE *stream) const;
+ int _fwrite(const void * ptr, size_t obj_size, size_t count, FILE * stream);
+};
+
+#endif //BACKENDS_POSIX_FILE_H
Property changes on: scummvm/branches/gsoc2007-fsnode/backends/file/posix/posix-file.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: scummvm/branches/gsoc2007-fsnode/backends/file/ps2/ps2-file.cpp
===================================================================
Property changes on: scummvm/branches/gsoc2007-fsnode/backends/file/ps2/ps2-file.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: scummvm/branches/gsoc2007-fsnode/backends/file/ps2/ps2-file.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/file/ps2/ps2-file.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/file/ps2/ps2-file.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,24 @@
+#ifdef __PLAYSTATION2__
+ // for those replaced fopen/fread/etc functions
+ typedef unsigned long uint64;
+ typedef signed long int64;
+ #include "backends/platform/ps2/fileio.h"
+
+ #define fopen(a, b) ps2_fopen(a, b)
+ #define fclose(a) ps2_fclose(a)
+ #define fseek(a, b, c) ps2_fseek(a, b, c)
+ #define ftell(a) ps2_ftell(a)
+ #define feof(a) ps2_feof(a)
+ #define fread(a, b, c, d) ps2_fread(a, b, c, d)
+ #define fwrite(a, b, c, d) ps2_fwrite(a, b, c, d)
+
+ //#define fprintf ps2_fprintf // used in common/util.cpp
+ //#define fflush(a) ps2_fflush(a) // used in common/util.cpp
+
+ //#define fgetc(a) ps2_fgetc(a) // not used
+ //#define fgets(a, b, c) ps2_fgets(a, b, c) // not used
+ //#define fputc(a, b) ps2_fputc(a, b) // not used
+ //#define fputs(a, b) ps2_fputs(a, b) // not used
+
+ //#define fsize(a) ps2_fsize(a) // not used -- and it is not a standard function either
+#endif
\ No newline at end of file
Property changes on: scummvm/branches/gsoc2007-fsnode/backends/file/ps2/ps2-file.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: scummvm/branches/gsoc2007-fsnode/backends/file/symbian/symbian-file.cpp
===================================================================
Property changes on: scummvm/branches/gsoc2007-fsnode/backends/file/symbian/symbian-file.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: scummvm/branches/gsoc2007-fsnode/backends/file/symbian/symbian-file.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/file/symbian/symbian-file.h (rev 0)
+++ scummvm/branches/gsoc2007-fsnode/backends/file/symbian/symbian-file.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -0,0 +1,29 @@
+#ifdef __SYMBIAN32__
+ #undef feof
+ #undef clearerr
+
+ #define FILE void
+
+ FILE* symbian_fopen(const char* name, const char* mode);
+ void symbian_fclose(FILE* handle);
+ size_t symbian_fread(const void* ptr, size_t size, size_t numItems, FILE* handle);
+ size_t symbian_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle);
+ bool symbian_feof(FILE* handle);
+ long int symbian_ftell(FILE* handle);
+ int symbian_fseek(FILE* handle, long int offset, int whence);
+ void symbian_clearerr(FILE* handle);
+
+ // Only functions used in the ScummVM source have been defined here!
+ #define fopen(name, mode) symbian_fopen(name, mode)
+ #define fclose(handle) symbian_fclose(handle)
+ #define fread(ptr, size, items, file) symbian_fread(ptr, size, items, file)
+ #define fwrite(ptr, size, items, file) symbian_fwrite(ptr, size, items, file)
+ #define feof(handle) symbian_feof(handle)
+ #define ftell(handle) symbian_ftell(handle)
+ #define fseek(handle, offset, whence) symbian_fseek(handle, offset, whence)
+ #define clearerr(handle) symbian_clearerr(handle)
+#endif
+
+#if defined(UNIX) || defined(__SYMBIAN32__)
+#include <errno.h>
+#endif
\ No newline at end of file
Property changes on: scummvm/branches/gsoc2007-fsnode/backends/file/symbian/symbian-file.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs-factory.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,48 +0,0 @@
-#ifndef ABSTRACT_FILESYSTEM_FACTORY_H
-#define ABSTRACT_FILESYSTEM_FACTORY_H
-
-#include "common/str.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;
-};
-
-#endif /*ABSTRACT_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -46,7 +46,7 @@
friend class FilesystemNode;
typedef Common::String String;
typedef FilesystemNode::ListMode ListMode;
-
+
/**
* Returns the child node with the given name. If no child with this name
* exists, returns 0. When called on a non-directory node, it should
@@ -77,7 +77,7 @@
* Destructor.
*/
virtual ~AbstractFilesystemNode() {}
-
+
/*
* Indicates whether the object refered by this path exists in the filesystem or not.
*/
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,16 +0,0 @@
-#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();
-}
-
-AbstractFilesystemNode *AmigaOSFilesystemFactory::makeCurrentDirectoryFileNode() const {
- return new AmigaOSFilesystemNode();
-}
-
-AbstractFilesystemNode *AmigaOSFilesystemFactory::makeFileNodePath(const String &path) const {
- return new AmigaOSFilesystemNode(path);
-}
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/amigaos4/amigaos4-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,27 +0,0 @@
-#ifndef AMIGAOS_FILESYSTEM_FACTORY_H
-#define AMIGAOS_FILESYSTEM_FACTORY_H
-
-#include "common/singleton.h"
-#include "backends/fs/abstract-fs-factory.h"
-
-/**
- * Creates AmigaOSFilesystemNode objects.
- *
- * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
- */
-class AmigaOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<AmigaOSFilesystemFactory> {
-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>;
-};
-
-#endif /*AMIGAOS_FILESYSTEM_FACTORY_H*/
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,16 +0,0 @@
-#include "backends/fs/dc/ronincd-fs-factory.h"
-#include "backends/fs/dc/dc-fs.cpp"
-
-DECLARE_SINGLETON(RoninCDFilesystemFactory);
-
-AbstractFilesystemNode *RoninCDFilesystemFactory::makeRootFileNode() const {
- return new RoninCDFilesystemNode();
-}
-
-AbstractFilesystemNode *RoninCDFilesystemFactory::makeCurrentDirectoryFileNode() const {
- return new RoninCDFilesystemNode();
-}
-
-AbstractFilesystemNode *RoninCDFilesystemFactory::makeFileNodePath(const String &path) const {
- return new RoninCDFilesystemNode(path, true);
-}
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/dc/ronincd-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,27 +0,0 @@
-#ifndef RONINCD_FILESYSTEM_FACTORY_H
-#define RONINCD_FILESYSTEM_FACTORY_H
-
-#include "common/singleton.h"
-#include "backends/fs/abstract-fs-factory.h"
-
-/**
- * Creates RoninCDFilesystemNode objects.
- *
- * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
- */
-class RoninCDFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<RoninCDFilesystemFactory> {
-public:
- typedef Common::String String;
-
- virtual AbstractFilesystemNode *makeRootFileNode() const;
- virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
- virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
-
-protected:
- RoninCDFilesystemFactory() {};
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
-};
-
-#endif /*RONINCD_FILESYSTEM_FACTORY_H*/
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,29 +0,0 @@
-#include "backends/fs/ds/ds-fs-factory.h"
-#include "backends/fs/ds/ds-fs.cpp"
-#include "dsmain.h" //for the isGBAMPAvailable() function
-
-DECLARE_SINGLETON(DSFilesystemFactory);
-
-AbstractFilesystemNode *DSFilesystemFactory::makeRootFileNode() const {
- if (DS::isGBAMPAvailable()) {
- return new DS::GBAMPFileSystemNode();
- } else {
- return new DS::DSFileSystemNode();
- }
-}
-
-AbstractFilesystemNode *DSFilesystemFactory::makeCurrentDirectoryFileNode() const {
- if (DS::isGBAMPAvailable()) {
- return new DS::GBAMPFileSystemNode();
- } else {
- return new DS::DSFileSystemNode();
- }
-}
-
-AbstractFilesystemNode *DSFilesystemFactory::makeFileNodePath(const String &path) const {
- if (DS::isGBAMPAvailable()) {
- return new DS::GBAMPFileSystemNode(path);
- } else {
- return new DS::DSFileSystemNode(path);
- }
-}
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/ds/ds-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,27 +0,0 @@
-#ifndef DS_FILESYSTEM_FACTORY_H
-#define DS_FILESYSTEM_FACTORY_H
-
-#include "common/singleton.h"
-#include "backends/fs/abstract-fs-factory.h"
-
-/**
- * Creates DSFilesystemNode objects.
- *
- * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
- */
-class DSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<DSFilesystemFactory> {
-public:
- typedef Common::String String;
-
- virtual AbstractFilesystemNode *makeRootFileNode() const;
- virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
- virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
-
-protected:
- DSFilesystemFactory() {};
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
-};
-
-#endif /*DS_FILESYSTEM_FACTORY_H*/
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/fs-factory-maker.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/fs-factory-maker.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/fs-factory-maker.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,113 +0,0 @@
-#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"
-#endif
-
-#if defined(__DC__)
- #include "backends/fs/dc/ronincd-fs-factory.cpp"
-#endif
-
-#if defined(__DS__)
- #include "backends/fs/ds/ds-fs-factory.cpp"
-#endif
-
-#if defined(__GP32__)
- #include "backends/fs/gp32/gp32-fs-factory.cpp"
-#endif
-
-#if defined(__MORPHOS__)
- #include "backends/fs/morphos/abox-fs-factory.cpp"
-#endif
-
-#if defined(PALMOS_MODE)
- #include "backends/fs/palmos/palmos-fs-factory.cpp"
-#endif
-
-#if defined(__PLAYSTATION2__)
- #include "backends/fs/ps2/ps2-fs-factory.cpp"
-#endif
-
-#if defined(__PSP__)
- #include "backends/fs/psp/psp-fs-factory.cpp"
-#endif
-
-#if defined(__SYMBIAN32__)
- #include "backends/fs/symbian/symbian-fs-factory.cpp"
-#endif
-
-#if defined(UNIX)
- #include "backends/fs/posix/posix-fs-factory.cpp"
-#endif
-
-#if defined(WIN32)
- #include "backends/fs/windows/windows-fs-factory.cpp"
-#endif
-
-/**
- * Creates concrete FilesystemFactory objects depending on the current architecture.
- */
-class FilesystemFactoryMaker {
-public:
-
- /**
- * Returns the correct concrete factory depending on the current build architecture.
- */
- static AbstractFilesystemFactory *makeFactory();
-
-protected:
- FilesystemFactoryMaker() {}; // avoid instances of this class
-};
-
-AbstractFilesystemFactory *FilesystemFactoryMaker::makeFactory(){
- #if defined(__amigaos4__)
- return &AmigaOSFilesystemFactory::instance();
- #endif
-
- #if defined(__DC__)
- return &RoninCDFilesystemFactory::instance();
- #endif
-
- #if defined(__DS__)
- return &DSFilesystemFactory::instance();
- #endif
-
- #if defined(__GP32__)
- return &GP32FilesystemFactory::instance();
- #endif
-
- #if defined(__MORPHOS__)
- return &ABoxFilesystemFactory::instance();
- #endif
-
- #if defined(PALMOS_MODE)
- return &PalmOSFilesystemFactory::instance();
- #endif
-
- #if defined(__PLAYSTATION2__)
- return &Ps2FilesystemFactory::instance();
- #endif
-
- #if defined(__PSP__)
- return &PSPFilesystemFactory::instance();
- #endif
-
- #if defined(__SYMBIAN32__)
- return &SymbianFilesystemFactory::instance();
- #endif
-
- #if defined(UNIX)
- return &POSIXFilesystemFactory::instance();
- #endif
-
- #if defined(WIN32)
- return &WindowsFilesystemFactory::instance();
- #endif
-}
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,16 +0,0 @@
-#include "backends/fs/gp32/gp32-fs-factory.h"
-#include "backends/fs/gp32/gp32-fs.cpp"
-
-DECLARE_SINGLETON(GP32FilesystemFactory);
-
-AbstractFilesystemNode *GP32FilesystemFactory::makeRootFileNode() const {
- return new GP32FilesystemNode();
-}
-
-AbstractFilesystemNode *GP32FilesystemFactory::makeCurrentDirectoryFileNode() const {
- return new GP32FilesystemNode();
-}
-
-AbstractFilesystemNode *GP32FilesystemFactory::makeFileNodePath(const String &path) const {
- return new GP32FilesystemNode(path);
-}
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/gp32/gp32-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,27 +0,0 @@
-#ifndef GP32_FILESYSTEM_FACTORY_H
-#define GP32_FILESYSTEM_FACTORY_H
-
-#include "common/singleton.h"
-#include "backends/fs/abstract-fs-factory.h"
-
-/**
- * Creates GP32FilesystemNode objects.
- *
- * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
- */
-class GP32FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<GP32FilesystemFactory> {
-public:
- typedef Common::String String;
-
- virtual AbstractFilesystemNode *makeRootFileNode() const;
- virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
- virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
-
-protected:
- GP32FilesystemFactory() {};
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
-};
-
-#endif /*GP32_FILESYSTEM_FACTORY_H*/
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,16 +0,0 @@
-#include "backends/fs/morphos/abox-fs-factory.h"
-#include "backends/fs/morphos/abox-fs.cpp"
-
-DECLARE_SINGLETON(ABoxFilesystemFactory);
-
-AbstractFilesystemNode *ABoxFilesystemFactory::makeRootFileNode() const {
- return new ABoxFilesystemNode();
-}
-
-AbstractFilesystemNode *ABoxFilesystemFactory::makeCurrentDirectoryFileNode() const {
- return new ABoxFilesystemNode();
-}
-
-AbstractFilesystemNode *ABoxFilesystemFactory::makeFileNodePath(const String &path) const {
- return new ABoxFilesystemNode(path);
-}
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/morphos/abox-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,27 +0,0 @@
-#ifndef ABOX_FILESYSTEM_FACTORY_H
-#define ABOX_FILESYSTEM_FACTORY_H
-
-#include "common/singleton.h"
-#include "backends/fs/abstract-fs-factory.h"
-
-/**
- * Creates ABoxFilesystemNode objects.
- *
- * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
- */
-class ABoxFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<ABoxFilesystemFactory> {
-public:
- typedef Common::String String;
-
- virtual AbstractFilesystemNode *makeRootFileNode() const;
- virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
- virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
-
-protected:
- ABoxFilesystemFactory() {};
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
-};
-
-#endif /*ABOX_FILESYSTEM_FACTORY_H*/
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,16 +0,0 @@
-#include "backends/fs/palmos/palmos-fs-factory.h"
-#include "backends/fs/palmos/palmos-fs.cpp"
-
-DECLARE_SINGLETON(PalmOSFilesystemFactory);
-
-AbstractFilesystemNode *PalmOSFilesystemFactory::makeRootFileNode() const {
- return new PalmOSFilesystemNode();
-}
-
-AbstractFilesystemNode *PalmOSFilesystemFactory::makeCurrentDirectoryFileNode() const {
- return new PalmOSFilesystemNode();
-}
-
-AbstractFilesystemNode *PalmOSFilesystemFactory::makeFileNodePath(const String &path) const {
- return new PalmOSFilesystemNode(path);
-}
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/palmos/palmos-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,27 +0,0 @@
-#ifndef PALMOS_FILESYSTEM_FACTORY_H
-#define PALMOS_FILESYSTEM_FACTORY_H
-
-#include "common/singleton.h"
-#include "backends/fs/abstract-fs-factory.h"
-
-/**
- * Creates PalmOSFilesystemNode objects.
- *
- * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
- */
-class PalmOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PalmOSFilesystemFactory> {
-public:
- typedef Common::String String;
-
- virtual AbstractFilesystemNode *makeRootFileNode() const;
- virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
- virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
-
-protected:
- PalmOSFilesystemFactory() {};
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
-};
-
-#endif /*PALMOS_FILESYSTEM_FACTORY_H*/
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,18 +0,0 @@
-#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();
-}
-
-AbstractFilesystemNode *POSIXFilesystemFactory::makeCurrentDirectoryFileNode() const {
- char buf[MAXPATHLEN];
- getcwd(buf, MAXPATHLEN);
- return new POSIXFilesystemNode(buf, true);
-}
-
-AbstractFilesystemNode *POSIXFilesystemFactory::makeFileNodePath(const String &path) const {
- return new POSIXFilesystemNode(path, true);
-}
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,27 +0,0 @@
-#ifndef POSIX_FILESYSTEM_FACTORY_H
-#define POSIX_FILESYSTEM_FACTORY_H
-
-#include "common/singleton.h"
-#include "backends/fs/abstract-fs-factory.h"
-
-/**
- * Creates POSIXFilesystemNode objects.
- *
- * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
- */
-class POSIXFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<POSIXFilesystemFactory> {
-public:
- typedef Common::String String;
-
- virtual AbstractFilesystemNode *makeRootFileNode() const;
- virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
- virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
-
-protected:
- POSIXFilesystemFactory() {};
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
-};
-
-#endif /*POSIX_FILESYSTEM_FACTORY_H*/
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,16 +0,0 @@
-#include "backends/fs/ps2/ps2-fs-factory.h"
-#include "backends/fs/ps2/ps2-fs.cpp"
-
-DECLARE_SINGLETON(Ps2FilesystemFactory);
-
-AbstractFilesystemNode *Ps2FilesystemFactory::makeRootFileNode() const {
- return new Ps2FilesystemNode();
-}
-
-AbstractFilesystemNode *Ps2FilesystemFactory::makeCurrentDirectoryFileNode() const {
- return new Ps2FilesystemNode();
-}
-
-AbstractFilesystemNode *Ps2FilesystemFactory::makeFileNodePath(const String &path) const {
- return new Ps2FilesystemNode(path);
-}
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/ps2/ps2-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,27 +0,0 @@
-#ifndef PS2_FILESYSTEM_FACTORY_H
-#define PS2_FILESYSTEM_FACTORY_H
-
-#include "common/singleton.h"
-#include "backends/fs/abstract-fs-factory.h"
-
-/**
- * Creates PS2FilesystemNode objects.
- *
- * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
- */
-class Ps2FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<Ps2FilesystemFactory> {
-public:
- typedef Common::String String;
-
- virtual AbstractFilesystemNode *makeRootFileNode() const;
- virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
- virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
-
-protected:
- Ps2FilesystemFactory() {};
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
-};
-
-#endif /*PS2_FILESYSTEM_FACTORY_H*/
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,16 +0,0 @@
-#include "backends/fs/psp/psp-fs-factory.h"
-#include "backends/fs/psp/psp_fs.cpp"
-
-DECLARE_SINGLETON(PSPFilesystemFactory);
-
-AbstractFilesystemNode *PSPFilesystemFactory::makeRootFileNode() const {
- return new PSPFilesystemNode();
-}
-
-AbstractFilesystemNode *PSPFilesystemFactory::makeCurrentDirectoryFileNode() const {
- return new PSPFilesystemNode();
-}
-
-AbstractFilesystemNode *PSPFilesystemFactory::makeFileNodePath(const String &path) const {
- return new PSPFilesystemNode(path, true);
-}
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/psp/psp-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,27 +0,0 @@
-#ifndef PSP_FILESYSTEM_FACTORY_H
-#define PSP_FILESYSTEM_FACTORY_H
-
-#include "common/singleton.h"
-#include "backends/fs/abstract-fs-factory.h"
-
-/**
- * Creates PSPFilesystemNode objects.
- *
- * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
- */
-class PSPFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PSPFilesystemFactory> {
-public:
- typedef Common::String String;
-
- virtual AbstractFilesystemNode *makeRootFileNode() const;
- virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
- virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
-
-protected:
- PSPFilesystemFactory() {};
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
-};
-
-#endif /*PSP_FILESYSTEM_FACTORY_H*/
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,18 +0,0 @@
-#include "backends/fs/symbian/symbian-fs-factory.h"
-#include "backends/fs/symbian/symbian-fs.cpp"
-
-DECLARE_SINGLETON(SymbianFilesystemFactory);
-
-AbstractFilesystemNode *SymbianFilesystemFactory::makeRootFileNode() const {
- return new SymbianFilesystemNode(true);
-}
-
-AbstractFilesystemNode *SymbianFilesystemFactory::makeCurrentDirectoryFileNode() const {
- char path[MAXPATHLEN];
- getcwd(path, MAXPATHLEN);
- return new SymbianFilesystemNode(path);
-}
-
-AbstractFilesystemNode *SymbianFilesystemFactory::makeFileNodePath(const String &path) const {
- return new SymbianFilesystemNode(path);
-}
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/symbian/symbian-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,27 +0,0 @@
-#ifndef SYMBIAN_FILESYSTEM_FACTORY_H
-#define SYMBIAN_FILESYSTEM_FACTORY_H
-
-#include "common/singleton.h"
-#include "backends/fs/abstract-fs-factory.h"
-
-/**
- * Creates SymbianFilesystemNode objects.
- *
- * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
- */
-class SymbianFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<SymbianFilesystemFactory> {
-public:
- typedef Common::String String;
-
- virtual AbstractFilesystemNode *makeRootFileNode() const;
- virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
- virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
-
-protected:
- SymbianFilesystemFactory() {};
-
-private:
- friend class Common::Singleton<SingletonBaseType>;
-};
-
-#endif /*SYMBIAN_FILESYSTEM_FACTORY_H*/
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,16 +0,0 @@
-#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();
-}
-
-AbstractFilesystemNode *WindowsFilesystemFactory::makeCurrentDirectoryFileNode() const {
- return new WindowsFilesystemNode("", true);
-}
-
-AbstractFilesystemNode *WindowsFilesystemFactory::makeFileNodePath(const String &path) const {
- return new WindowsFilesystemNode(path, false);
-}
Deleted: scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/windows/windows-fs-factory.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -1,27 +0,0 @@
-#ifndef WINDOWS_FILESYSTEM_FACTORY_H
-#define WINDOWS_FILESYSTEM_FACTORY_H
-
-#include "common/singleton.h"
-#include "backends/fs/abstract-fs-factory.h"
-
-/**
- * Creates WindowsFilesystemNode objects.
- *
- * Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
- */
-class WindowsFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<WindowsFilesystemFactory> {
-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>;
-};
-
-#endif /*WINDOWS_FILESYSTEM_FACTORY_H*/
Modified: scummvm/branches/gsoc2007-fsnode/common/file.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/common/file.h 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/common/file.h 2007-08-01 22:07:50 UTC (rev 28395)
@@ -30,6 +30,8 @@
#include "common/scummsys.h"
#include "common/str.h"
#include "common/stream.h"
+#include "backends/file/base-file.h"
+//#include "backends/factories/fs-factory-maker.cpp"
class FilesystemNode;
@@ -38,6 +40,9 @@
class File : public SeekableReadStream, public WriteStream {
protected:
/** File handle to the actual file; 0 if no file is open. */
+ //BaseFile *_test;
+
+ /** File handle to the actual file; 0 if no file is open. */
void *_handle;
/** Status flag which tells about recent I/O failures. */
@@ -52,7 +57,7 @@
// code that accidentally copied File objects tended to break in strange
// ways.
File(const File &f);
- File &operator =(const File &f);
+ File &operator =(const File &f);
public:
enum AccessMode {
Modified: scummvm/branches/gsoc2007-fsnode/common/fs.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/common/fs.cpp 2007-08-01 21:47:17 UTC (rev 28394)
+++ scummvm/branches/gsoc2007-fsnode/common/fs.cpp 2007-08-01 22:07:50 UTC (rev 28395)
@@ -25,7 +25,7 @@
#include "common/stdafx.h"
#include "common/util.h"
#include "backends/fs/abstract-fs.h"
-#include "backends/fs/fs-factory-maker.cpp"
+#include "backends/factories/fs-factory-maker.cpp"
/*
* Simple DOS-style pattern matching function (understands * and ? like used in DOS).
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