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. svn-id: r28395
This commit is contained in:
parent
9752c75f40
commit
1400d28bfb
37 changed files with 718 additions and 42 deletions
|
@ -2,6 +2,8 @@
|
|||
#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.
|
||||
|
@ -13,7 +15,7 @@ public:
|
|||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~AbstractFilesystemFactory() {};
|
||||
virtual ~AbstractFilesystemFactory() {}
|
||||
|
||||
/**
|
||||
* Returns a node representing the "current directory".
|
||||
|
@ -43,6 +45,12 @@ public:
|
|||
* 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*/
|
|
@ -1,5 +1,6 @@
|
|||
#include "backends/fs/amigaos4/amigaos4-fs-factory.h"
|
||||
#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);
|
||||
|
||||
|
@ -14,3 +15,7 @@ AbstractFilesystemNode *AmigaOSFilesystemFactory::makeCurrentDirectoryFileNode()
|
|||
AbstractFilesystemNode *AmigaOSFilesystemFactory::makeFileNodePath(const String &path) const {
|
||||
return new AmigaOSFilesystemNode(path);
|
||||
}
|
||||
|
||||
BaseFile *AmigaOSFilesystemFactory::makeBaseFile() const {
|
||||
return new AmigaOSFile();
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#define AMIGAOS_FILESYSTEM_FACTORY_H
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "backends/fs/abstract-fs-factory.h"
|
||||
#include "backends/factories/abstract-fs-factory.h"
|
||||
|
||||
/**
|
||||
* Creates AmigaOSFilesystemNode objects.
|
||||
|
@ -16,6 +16,7 @@ public:
|
|||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||
virtual BaseFile *makeBaseFile() const;
|
||||
|
||||
protected:
|
||||
AmigaOSFilesystemFactory() {};
|
|
@ -1,5 +1,6 @@
|
|||
#include "backends/fs/dc/ronincd-fs-factory.h"
|
||||
#include "backends/factories/dc/ronincd-fs-factory.h"
|
||||
#include "backends/fs/dc/dc-fs.cpp"
|
||||
#include "backends/file/base-file.h"
|
||||
|
||||
DECLARE_SINGLETON(RoninCDFilesystemFactory);
|
||||
|
||||
|
@ -14,3 +15,7 @@ AbstractFilesystemNode *RoninCDFilesystemFactory::makeCurrentDirectoryFileNode()
|
|||
AbstractFilesystemNode *RoninCDFilesystemFactory::makeFileNodePath(const String &path) const {
|
||||
return new RoninCDFilesystemNode(path, true);
|
||||
}
|
||||
|
||||
BaseFile *RoninCDFilesystemFactory::makeBaseFile() const {
|
||||
return new BaseFile();
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#define RONINCD_FILESYSTEM_FACTORY_H
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "backends/fs/abstract-fs-factory.h"
|
||||
#include "backends/factories/abstract-fs-factory.h"
|
||||
|
||||
/**
|
||||
* Creates RoninCDFilesystemNode objects.
|
||||
|
@ -16,6 +16,7 @@ public:
|
|||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||
virtual BaseFile *makeBaseFile() const;
|
||||
|
||||
protected:
|
||||
RoninCDFilesystemFactory() {};
|
|
@ -1,5 +1,6 @@
|
|||
#include "backends/fs/ds/ds-fs-factory.h"
|
||||
#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);
|
||||
|
@ -27,3 +28,7 @@ AbstractFilesystemNode *DSFilesystemFactory::makeFileNodePath(const String &path
|
|||
return new DS::DSFileSystemNode(path);
|
||||
}
|
||||
}
|
||||
|
||||
BaseFile *DSFilesystemFactory::makeBaseFile() const {
|
||||
return new DSFile();
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#define DS_FILESYSTEM_FACTORY_H
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "backends/fs/abstract-fs-factory.h"
|
||||
#include "backends/factories/abstract-fs-factory.h"
|
||||
|
||||
/**
|
||||
* Creates DSFilesystemNode objects.
|
||||
|
@ -16,6 +16,7 @@ public:
|
|||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||
virtual BaseFile *makeBaseFile() const;
|
||||
|
||||
protected:
|
||||
DSFilesystemFactory() {};
|
|
@ -1,4 +1,4 @@
|
|||
#include "backends/fs/abstract-fs-factory.h"
|
||||
#include "backends/factories/abstract-fs-factory.h"
|
||||
|
||||
/*
|
||||
* All the following includes choose, at compile time, which specific backend will be used
|
||||
|
@ -8,57 +8,57 @@
|
|||
* all build environments. Additionally, this results in smaller binaries.
|
||||
*/
|
||||
#if defined(__amigaos4__)
|
||||
#include "backends/fs/amigaos4/amigaos4-fs-factory.cpp"
|
||||
#include "backends/factories/amigaos4/amigaos4-fs-factory.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(__DC__)
|
||||
#include "backends/fs/dc/ronincd-fs-factory.cpp"
|
||||
#include "backends/factories/dc/ronincd-fs-factory.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(__DS__)
|
||||
#include "backends/fs/ds/ds-fs-factory.cpp"
|
||||
#include "backends/factories/ds/ds-fs-factory.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(__GP32__)
|
||||
#include "backends/fs/gp32/gp32-fs-factory.cpp"
|
||||
#include "backends/factories/gp32/gp32-fs-factory.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(__MORPHOS__)
|
||||
#include "backends/fs/morphos/abox-fs-factory.cpp"
|
||||
#include "backends/factories/morphos/abox-fs-factory.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(PALMOS_MODE)
|
||||
#include "backends/fs/palmos/palmos-fs-factory.cpp"
|
||||
#include "backends/factories/palmos/palmos-fs-factory.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(__PLAYSTATION2__)
|
||||
#include "backends/fs/ps2/ps2-fs-factory.cpp"
|
||||
#include "backends/factories/ps2/ps2-fs-factory.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(__PSP__)
|
||||
#include "backends/fs/psp/psp-fs-factory.cpp"
|
||||
#include "backends/factories/psp/psp-fs-factory.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(__SYMBIAN32__)
|
||||
#include "backends/fs/symbian/symbian-fs-factory.cpp"
|
||||
#include "backends/factories/symbian/symbian-fs-factory.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(UNIX)
|
||||
#include "backends/fs/posix/posix-fs-factory.cpp"
|
||||
#include "backends/factories/posix/posix-fs-factory.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(WIN32)
|
||||
#include "backends/fs/windows/windows-fs-factory.cpp"
|
||||
#include "backends/factories/windows/windows-fs-factory.cpp"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Creates concrete FilesystemFactory objects depending on the current architecture.
|
||||
* Creates concrete FilesystemFactory and FileFactory objects depending on the current architecture.
|
||||
*/
|
||||
class FilesystemFactoryMaker {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns the correct concrete factory depending on the current build architecture.
|
||||
* Returns the correct concrete filesystem factory depending on the current build architecture.
|
||||
*/
|
||||
static AbstractFilesystemFactory *makeFactory();
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#include "backends/fs/gp32/gp32-fs-factory.h"
|
||||
#include "backends/factories/gp32/gp32-fs-factory.h"
|
||||
#include "backends/fs/gp32/gp32-fs.cpp"
|
||||
#include "backends/file/base-file.h"
|
||||
|
||||
DECLARE_SINGLETON(GP32FilesystemFactory);
|
||||
|
||||
|
@ -14,3 +15,7 @@ AbstractFilesystemNode *GP32FilesystemFactory::makeCurrentDirectoryFileNode() co
|
|||
AbstractFilesystemNode *GP32FilesystemFactory::makeFileNodePath(const String &path) const {
|
||||
return new GP32FilesystemNode(path);
|
||||
}
|
||||
|
||||
BaseFile *GP32FilesystemFactory::makeBaseFile() const {
|
||||
return new BaseFile();
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#define GP32_FILESYSTEM_FACTORY_H
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "backends/fs/abstract-fs-factory.h"
|
||||
#include "backends/factories/abstract-fs-factory.h"
|
||||
|
||||
/**
|
||||
* Creates GP32FilesystemNode objects.
|
||||
|
@ -16,6 +16,7 @@ public:
|
|||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||
virtual BaseFile *makeBaseFile() const;
|
||||
|
||||
protected:
|
||||
GP32FilesystemFactory() {};
|
|
@ -1,5 +1,6 @@
|
|||
#include "backends/fs/morphos/abox-fs-factory.h"
|
||||
#include "backends/factories/morphos/abox-fs-factory.h"
|
||||
#include "backends/fs/morphos/abox-fs.cpp"
|
||||
#include "backends/file/base-file.h"
|
||||
|
||||
DECLARE_SINGLETON(ABoxFilesystemFactory);
|
||||
|
||||
|
@ -14,3 +15,7 @@ AbstractFilesystemNode *ABoxFilesystemFactory::makeCurrentDirectoryFileNode() co
|
|||
AbstractFilesystemNode *ABoxFilesystemFactory::makeFileNodePath(const String &path) const {
|
||||
return new ABoxFilesystemNode(path);
|
||||
}
|
||||
|
||||
BaseFile *ABoxFilesystemFactory::makeBaseFile() const {
|
||||
return new BaseFile();
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#define ABOX_FILESYSTEM_FACTORY_H
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "backends/fs/abstract-fs-factory.h"
|
||||
#include "backends/factories/abstract-fs-factory.h"
|
||||
|
||||
/**
|
||||
* Creates ABoxFilesystemNode objects.
|
||||
|
@ -16,6 +16,7 @@ public:
|
|||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||
virtual BaseFile *makeBaseFile() const;
|
||||
|
||||
protected:
|
||||
ABoxFilesystemFactory() {};
|
|
@ -1,5 +1,6 @@
|
|||
#include "backends/fs/palmos/palmos-fs-factory.h"
|
||||
#include "backends/factories/palmos/palmos-fs-factory.h"
|
||||
#include "backends/fs/palmos/palmos-fs.cpp"
|
||||
#include "backends/file/base-file.h"
|
||||
|
||||
DECLARE_SINGLETON(PalmOSFilesystemFactory);
|
||||
|
||||
|
@ -14,3 +15,7 @@ AbstractFilesystemNode *PalmOSFilesystemFactory::makeCurrentDirectoryFileNode()
|
|||
AbstractFilesystemNode *PalmOSFilesystemFactory::makeFileNodePath(const String &path) const {
|
||||
return new PalmOSFilesystemNode(path);
|
||||
}
|
||||
|
||||
BaseFile *PalmOSFilesystemFactory::makeBaseFile() const {
|
||||
return new BaseFile();
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#define PALMOS_FILESYSTEM_FACTORY_H
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "backends/fs/abstract-fs-factory.h"
|
||||
#include "backends/factories/abstract-fs-factory.h"
|
||||
|
||||
/**
|
||||
* Creates PalmOSFilesystemNode objects.
|
||||
|
@ -16,6 +16,7 @@ public:
|
|||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||
virtual BaseFile *makeBaseFile() const;
|
||||
|
||||
protected:
|
||||
PalmOSFilesystemFactory() {};
|
|
@ -1,5 +1,7 @@
|
|||
#include "backends/fs/posix/posix-fs-factory.h"
|
||||
#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);
|
||||
|
||||
|
@ -16,3 +18,7 @@ AbstractFilesystemNode *POSIXFilesystemFactory::makeCurrentDirectoryFileNode() c
|
|||
AbstractFilesystemNode *POSIXFilesystemFactory::makeFileNodePath(const String &path) const {
|
||||
return new POSIXFilesystemNode(path, true);
|
||||
}
|
||||
|
||||
BaseFile *POSIXFilesystemFactory::makeBaseFile() const {
|
||||
return new POSIXFile();
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#define POSIX_FILESYSTEM_FACTORY_H
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "backends/fs/abstract-fs-factory.h"
|
||||
#include "backends/factories/abstract-fs-factory.h"
|
||||
|
||||
/**
|
||||
* Creates POSIXFilesystemNode objects.
|
||||
|
@ -16,6 +16,7 @@ public:
|
|||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||
virtual BaseFile *makeBaseFile() const;
|
||||
|
||||
protected:
|
||||
POSIXFilesystemFactory() {};
|
|
@ -1,5 +1,6 @@
|
|||
#include "backends/fs/ps2/ps2-fs-factory.h"
|
||||
#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);
|
||||
|
||||
|
@ -14,3 +15,7 @@ AbstractFilesystemNode *Ps2FilesystemFactory::makeCurrentDirectoryFileNode() con
|
|||
AbstractFilesystemNode *Ps2FilesystemFactory::makeFileNodePath(const String &path) const {
|
||||
return new Ps2FilesystemNode(path);
|
||||
}
|
||||
|
||||
BaseFile *Ps2FilesystemFactory::makeBaseFile() const {
|
||||
return new Ps2File();
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#define PS2_FILESYSTEM_FACTORY_H
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "backends/fs/abstract-fs-factory.h"
|
||||
#include "backends/factories/abstract-fs-factory.h"
|
||||
|
||||
/**
|
||||
* Creates PS2FilesystemNode objects.
|
||||
|
@ -16,6 +16,7 @@ public:
|
|||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||
virtual BaseFile *makeBaseFile() const;
|
||||
|
||||
protected:
|
||||
Ps2FilesystemFactory() {};
|
|
@ -1,5 +1,6 @@
|
|||
#include "backends/fs/psp/psp-fs-factory.h"
|
||||
#include "backends/factories/psp/psp-fs-factory.h"
|
||||
#include "backends/fs/psp/psp_fs.cpp"
|
||||
#include "backends/file/base-file.h"
|
||||
|
||||
DECLARE_SINGLETON(PSPFilesystemFactory);
|
||||
|
||||
|
@ -14,3 +15,7 @@ AbstractFilesystemNode *PSPFilesystemFactory::makeCurrentDirectoryFileNode() con
|
|||
AbstractFilesystemNode *PSPFilesystemFactory::makeFileNodePath(const String &path) const {
|
||||
return new PSPFilesystemNode(path, true);
|
||||
}
|
||||
|
||||
BaseFile *PSPFilesystemFactory::makeBaseFile() const {
|
||||
return new BaseFile();
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#define PSP_FILESYSTEM_FACTORY_H
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "backends/fs/abstract-fs-factory.h"
|
||||
#include "backends/factories/abstract-fs-factory.h"
|
||||
|
||||
/**
|
||||
* Creates PSPFilesystemNode objects.
|
||||
|
@ -16,6 +16,7 @@ public:
|
|||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||
virtual BaseFile *makeBaseFile() const;
|
||||
|
||||
protected:
|
||||
PSPFilesystemFactory() {};
|
|
@ -1,5 +1,6 @@
|
|||
#include "backends/fs/symbian/symbian-fs-factory.h"
|
||||
#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);
|
||||
|
||||
|
@ -16,3 +17,7 @@ AbstractFilesystemNode *SymbianFilesystemFactory::makeCurrentDirectoryFileNode()
|
|||
AbstractFilesystemNode *SymbianFilesystemFactory::makeFileNodePath(const String &path) const {
|
||||
return new SymbianFilesystemNode(path);
|
||||
}
|
||||
|
||||
BaseFile *SymbianFilesystemFactory::makeBaseFile() const {
|
||||
return new SymbianFile();
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#define SYMBIAN_FILESYSTEM_FACTORY_H
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "backends/fs/abstract-fs-factory.h"
|
||||
#include "backends/factories/abstract-fs-factory.h"
|
||||
|
||||
/**
|
||||
* Creates SymbianFilesystemNode objects.
|
||||
|
@ -16,6 +16,7 @@ public:
|
|||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||
virtual BaseFile *makeBaseFile() const;
|
||||
|
||||
protected:
|
||||
SymbianFilesystemFactory() {};
|
|
@ -1,5 +1,6 @@
|
|||
#include "backends/fs/windows/windows-fs-factory.h"
|
||||
#include "backends/factories/windows/windows-fs-factory.h"
|
||||
#include "backends/fs/windows/windows-fs.cpp"
|
||||
#include "backends/file/base-file.h"
|
||||
|
||||
DECLARE_SINGLETON(WindowsFilesystemFactory);
|
||||
|
||||
|
@ -14,3 +15,7 @@ AbstractFilesystemNode *WindowsFilesystemFactory::makeCurrentDirectoryFileNode()
|
|||
AbstractFilesystemNode *WindowsFilesystemFactory::makeFileNodePath(const String &path) const {
|
||||
return new WindowsFilesystemNode(path, false);
|
||||
}
|
||||
|
||||
BaseFile *WindowsFilesystemFactory::makeBaseFile() const {
|
||||
return new BaseFile();
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#define WINDOWS_FILESYSTEM_FACTORY_H
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "backends/fs/abstract-fs-factory.h"
|
||||
#include "backends/factories/abstract-fs-factory.h"
|
||||
|
||||
/**
|
||||
* Creates WindowsFilesystemNode objects.
|
||||
|
@ -16,6 +16,7 @@ public:
|
|||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||
virtual BaseFile *makeBaseFile() const;
|
||||
|
||||
protected:
|
||||
WindowsFilesystemFactory() {};
|
226
backends/file/base-file.cpp
Normal file
226
backends/file/base-file.cpp
Normal file
|
@ -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);
|
||||
}
|
180
backends/file/base-file.h
Normal file
180
backends/file/base-file.h
Normal file
|
@ -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
|
0
backends/file/ds/ds-file.cpp
Normal file
0
backends/file/ds/ds-file.cpp
Normal file
46
backends/file/ds/ds-file.h
Normal file
46
backends/file/ds/ds-file.h
Normal file
|
@ -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
|
41
backends/file/posix/posix-file.cpp
Normal file
41
backends/file/posix/posix-file.cpp
Normal file
|
@ -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);
|
||||
}
|
50
backends/file/posix/posix-file.h
Normal file
50
backends/file/posix/posix-file.h
Normal file
|
@ -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
|
0
backends/file/ps2/ps2-file.cpp
Normal file
0
backends/file/ps2/ps2-file.cpp
Normal file
24
backends/file/ps2/ps2-file.h
Normal file
24
backends/file/ps2/ps2-file.h
Normal file
|
@ -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
|
0
backends/file/symbian/symbian-file.cpp
Normal file
0
backends/file/symbian/symbian-file.cpp
Normal file
29
backends/file/symbian/symbian-file.h
Normal file
29
backends/file/symbian/symbian-file.h
Normal file
|
@ -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
|
|
@ -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;
|
||||
|
||||
|
@ -37,6 +39,9 @@ namespace Common {
|
|||
|
||||
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;
|
||||
|
||||
|
@ -52,7 +57,7 @@ private:
|
|||
// 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 {
|
||||
|
|
|
@ -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).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue