From 1dc13a641dd82825334e81bb3eb3b4ebd69d2552 Mon Sep 17 00:00:00 2001 From: David Corrales Date: Sat, 18 Aug 2007 05:24:18 +0000 Subject: Merged some of the changes from the trunk patch back in to the GSoC fsnode branch. svn-id: r28649 --- backends/factories/abstract-fs-factory.h | 26 ++++- .../factories/amigaos4/amigaos4-fs-factory.cpp | 24 ++++ backends/factories/amigaos4/amigaos4-fs-factory.h | 24 ++++ backends/factories/dc/ronincd-fs-factory.cpp | 24 ++++ backends/factories/dc/ronincd-fs-factory.h | 24 ++++ backends/factories/ds/ds-fs-factory.cpp | 24 ++++ backends/factories/ds/ds-fs-factory.h | 24 ++++ backends/factories/fs-factory-maker.cpp | 128 ++++++--------------- backends/factories/fs-factory-maker.h | 76 ++++++++++++ backends/factories/gp32/gp32-fs-factory.cpp | 24 ++++ backends/factories/morphos/abox-fs-factory.cpp | 24 ++++ backends/factories/morphos/abox-fs-factory.h | 24 ++++ backends/factories/palmos/palmos-fs-factory.cpp | 24 ++++ backends/factories/posix/posix-fs-factory.cpp | 28 ++++- backends/factories/posix/posix-fs-factory.h | 2 +- backends/factories/ps2/ps2-fs-factory.cpp | 24 ++++ backends/factories/ps2/ps2-fs-factory.h | 24 ++++ backends/factories/psp/psp-fs-factory.cpp | 24 ++++ backends/factories/psp/psp-fs-factory.h | 24 ++++ backends/factories/symbian/symbian-fs-factory.cpp | 24 ++++ backends/factories/symbian/symbian-fs-factory.h | 24 ++++ backends/factories/windows/windows-fs-factory.cpp | 24 ++++ backends/factories/windows/windows-fs-factory.h | 24 ++++ backends/file/base-file.cpp | 4 + backends/file/base-file.h | 8 +- backends/file/posix/posix-file.cpp | 4 + backends/file/posix/posix-file.h | 4 + backends/fs/abstract-fs.h | 36 +++++- backends/fs/dc/dc-fs.cpp | 2 +- backends/fs/posix/posix-fs.cpp | 37 +++--- 30 files changed, 658 insertions(+), 129 deletions(-) create mode 100644 backends/factories/fs-factory-maker.h (limited to 'backends') diff --git a/backends/factories/abstract-fs-factory.h b/backends/factories/abstract-fs-factory.h index b06ad63228..4238baf5c2 100644 --- a/backends/factories/abstract-fs-factory.h +++ b/backends/factories/abstract-fs-factory.h @@ -1,3 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: $ + * $Id: $ + */ + #ifndef ABSTRACT_FILESYSTEM_FACTORY_H #define ABSTRACT_FILESYSTEM_FACTORY_H @@ -50,7 +74,7 @@ public: * Creates a base file usable by the Common::File wrapper to implement several * methods. */ - virtual BaseFile *makeBaseFile() const = 0; + virtual Common::BaseFile *makeBaseFile() const = 0; }; #endif /*ABSTRACT_FILESYSTEM_FACTORY_H*/ diff --git a/backends/factories/amigaos4/amigaos4-fs-factory.cpp b/backends/factories/amigaos4/amigaos4-fs-factory.cpp index 2d73c4dbdc..15847e37fc 100644 --- a/backends/factories/amigaos4/amigaos4-fs-factory.cpp +++ b/backends/factories/amigaos4/amigaos4-fs-factory.cpp @@ -1,3 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: $ + * $Id: $ + */ + #include "backends/factories/amigaos4/amigaos4-fs-factory.h" #include "backends/fs/amigaos4/amigaos4-fs.cpp" #include "backends/file/amigaos4/amigaos4-file.h" diff --git a/backends/factories/amigaos4/amigaos4-fs-factory.h b/backends/factories/amigaos4/amigaos4-fs-factory.h index 86f77ca6fa..6243303166 100644 --- a/backends/factories/amigaos4/amigaos4-fs-factory.h +++ b/backends/factories/amigaos4/amigaos4-fs-factory.h @@ -1,3 +1,27 @@ +/* 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 AMIGAOS_FILESYSTEM_FACTORY_H #define AMIGAOS_FILESYSTEM_FACTORY_H diff --git a/backends/factories/dc/ronincd-fs-factory.cpp b/backends/factories/dc/ronincd-fs-factory.cpp index c28d735aec..f87aa0b9d5 100644 --- a/backends/factories/dc/ronincd-fs-factory.cpp +++ b/backends/factories/dc/ronincd-fs-factory.cpp @@ -1,3 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: $ + * $Id: $ + */ + #include "backends/factories/dc/ronincd-fs-factory.h" #include "backends/fs/dc/dc-fs.cpp" #include "backends/file/base-file.h" diff --git a/backends/factories/dc/ronincd-fs-factory.h b/backends/factories/dc/ronincd-fs-factory.h index 5aa6f7a91f..f41c3e81f0 100644 --- a/backends/factories/dc/ronincd-fs-factory.h +++ b/backends/factories/dc/ronincd-fs-factory.h @@ -1,3 +1,27 @@ +/* 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 RONINCD_FILESYSTEM_FACTORY_H #define RONINCD_FILESYSTEM_FACTORY_H diff --git a/backends/factories/ds/ds-fs-factory.cpp b/backends/factories/ds/ds-fs-factory.cpp index 94bf8e75d0..fab45c92e9 100644 --- a/backends/factories/ds/ds-fs-factory.cpp +++ b/backends/factories/ds/ds-fs-factory.cpp @@ -1,3 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: $ + * $Id: $ + */ + #include "backends/factories/ds/ds-fs-factory.h" #include "backends/fs/ds/ds-fs.cpp" #include "backends/file/ds/ds-file.h" diff --git a/backends/factories/ds/ds-fs-factory.h b/backends/factories/ds/ds-fs-factory.h index eecd406682..c076f1cb99 100644 --- a/backends/factories/ds/ds-fs-factory.h +++ b/backends/factories/ds/ds-fs-factory.h @@ -1,3 +1,27 @@ +/* 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 DS_FILESYSTEM_FACTORY_H #define DS_FILESYSTEM_FACTORY_H diff --git a/backends/factories/fs-factory-maker.cpp b/backends/factories/fs-factory-maker.cpp index 8bef982f37..1056726887 100644 --- a/backends/factories/fs-factory-maker.cpp +++ b/backends/factories/fs-factory-maker.cpp @@ -1,113 +1,51 @@ -#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. +/* 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: $ */ -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 -}; +#include "backends/factories/fs-factory-maker.h" AbstractFilesystemFactory *FilesystemFactoryMaker::makeFactory(){ #if defined(__amigaos4__) return &AmigaOSFilesystemFactory::instance(); - #endif - - #if defined(__DC__) + #elif defined(__DC__) return &RoninCDFilesystemFactory::instance(); - #endif - - #if defined(__DS__) + #elif defined(__DS__) return &DSFilesystemFactory::instance(); - #endif - - #if defined(__GP32__) + #elif defined(__GP32__) return &GP32FilesystemFactory::instance(); - #endif - - #if defined(__MORPHOS__) + #elif defined(__MORPHOS__) return &ABoxFilesystemFactory::instance(); - #endif - - #if defined(PALMOS_MODE) + #elif defined(PALMOS_MODE) return &PalmOSFilesystemFactory::instance(); - #endif - - #if defined(__PLAYSTATION2__) + #elif defined(__PLAYSTATION2__) return &Ps2FilesystemFactory::instance(); - #endif - - #if defined(__PSP__) + #elif defined(__PSP__) return &PSPFilesystemFactory::instance(); - #endif - - #if defined(__SYMBIAN32__) + #elif defined(__SYMBIAN32__) return &SymbianFilesystemFactory::instance(); - #endif - - #if defined(UNIX) + #elif defined(UNIX) return &POSIXFilesystemFactory::instance(); - #endif - - #if defined(WIN32) + #elif defined(WIN32) return &WindowsFilesystemFactory::instance(); #endif } diff --git a/backends/factories/fs-factory-maker.h b/backends/factories/fs-factory-maker.h new file mode 100644 index 0000000000..f9fc0ff85f --- /dev/null +++ b/backends/factories/fs-factory-maker.h @@ -0,0 +1,76 @@ +/* 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 FS_FACTORY_MAKER_H +#define FS_FACTORY_MAKER_H + +#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" +#elif defined(__DC__) + #include "backends/factories/dc/ronincd-fs-factory.cpp" +#elif defined(__DS__) + #include "backends/factories/ds/ds-fs-factory.cpp" +#elif defined(__GP32__) + #include "backends/factories/gp32/gp32-fs-factory.cpp" +#elif defined(__MORPHOS__) + #include "backends/factories/morphos/abox-fs-factory.cpp" +#elif defined(PALMOS_MODE) + #include "backends/factories/palmos/palmos-fs-factory.cpp" +#elif defined(__PLAYSTATION2__) + #include "backends/factories/ps2/ps2-fs-factory.cpp" +#elif defined(__PSP__) + #include "backends/factories/psp/psp-fs-factory.cpp" +#elif defined(__SYMBIAN32__) + #include "backends/factories/symbian/symbian-fs-factory.cpp" +#elif defined(UNIX) + #include "backends/factories/posix/posix-fs-factory.cpp" +#elif 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 +}; + +#endif //FS_FACTORY_MAKER_H diff --git a/backends/factories/gp32/gp32-fs-factory.cpp b/backends/factories/gp32/gp32-fs-factory.cpp index bffbffa21d..43d6a5330c 100644 --- a/backends/factories/gp32/gp32-fs-factory.cpp +++ b/backends/factories/gp32/gp32-fs-factory.cpp @@ -1,3 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: $ + * $Id: $ + */ + #include "backends/factories/gp32/gp32-fs-factory.h" #include "backends/fs/gp32/gp32-fs.cpp" #include "backends/file/base-file.h" diff --git a/backends/factories/morphos/abox-fs-factory.cpp b/backends/factories/morphos/abox-fs-factory.cpp index 5659baf6f9..961a7cbb9d 100644 --- a/backends/factories/morphos/abox-fs-factory.cpp +++ b/backends/factories/morphos/abox-fs-factory.cpp @@ -1,3 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: $ + * $Id: $ + */ + #include "backends/factories/morphos/abox-fs-factory.h" #include "backends/fs/morphos/abox-fs.cpp" #include "backends/file/base-file.h" diff --git a/backends/factories/morphos/abox-fs-factory.h b/backends/factories/morphos/abox-fs-factory.h index ff282b5bb9..c265b464a4 100644 --- a/backends/factories/morphos/abox-fs-factory.h +++ b/backends/factories/morphos/abox-fs-factory.h @@ -1,3 +1,27 @@ +/* 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 ABOX_FILESYSTEM_FACTORY_H #define ABOX_FILESYSTEM_FACTORY_H diff --git a/backends/factories/palmos/palmos-fs-factory.cpp b/backends/factories/palmos/palmos-fs-factory.cpp index 275118b518..bb90857eac 100644 --- a/backends/factories/palmos/palmos-fs-factory.cpp +++ b/backends/factories/palmos/palmos-fs-factory.cpp @@ -1,3 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: $ + * $Id: $ + */ + #include "backends/factories/palmos/palmos-fs-factory.h" #include "backends/fs/palmos/palmos-fs.cpp" #include "backends/file/base-file.h" diff --git a/backends/factories/posix/posix-fs-factory.cpp b/backends/factories/posix/posix-fs-factory.cpp index 9b77e31557..1887aa8d5f 100644 --- a/backends/factories/posix/posix-fs-factory.cpp +++ b/backends/factories/posix/posix-fs-factory.cpp @@ -1,3 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: $ + * $Id: $ + */ + #include "backends/factories/posix/posix-fs-factory.h" #include "backends/fs/posix/posix-fs.cpp" #include "backends/file/posix/posix-file.cpp" @@ -19,6 +43,6 @@ AbstractFilesystemNode *POSIXFilesystemFactory::makeFileNodePath(const String &p return new POSIXFilesystemNode(path, true); } -BaseFile *POSIXFilesystemFactory::makeBaseFile() const { - return new POSIXFile(); +Common::BaseFile *POSIXFilesystemFactory::makeBaseFile() const { + return new Common::POSIXFile(); } diff --git a/backends/factories/posix/posix-fs-factory.h b/backends/factories/posix/posix-fs-factory.h index aef411c92b..0122f7ac58 100644 --- a/backends/factories/posix/posix-fs-factory.h +++ b/backends/factories/posix/posix-fs-factory.h @@ -16,7 +16,7 @@ public: virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; - virtual BaseFile *makeBaseFile() const; + virtual Common::BaseFile *makeBaseFile() const; protected: POSIXFilesystemFactory() {}; diff --git a/backends/factories/ps2/ps2-fs-factory.cpp b/backends/factories/ps2/ps2-fs-factory.cpp index cd6f293794..a56f376ec8 100644 --- a/backends/factories/ps2/ps2-fs-factory.cpp +++ b/backends/factories/ps2/ps2-fs-factory.cpp @@ -1,3 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: $ + * $Id: $ + */ + #include "backends/factories/ps2/ps2-fs-factory.h" #include "backends/fs/ps2/ps2-fs.cpp" #include "backends/file/ps2/ps2-file.h" diff --git a/backends/factories/ps2/ps2-fs-factory.h b/backends/factories/ps2/ps2-fs-factory.h index e1ddee9677..413842789f 100644 --- a/backends/factories/ps2/ps2-fs-factory.h +++ b/backends/factories/ps2/ps2-fs-factory.h @@ -1,3 +1,27 @@ +/* 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 PS2_FILESYSTEM_FACTORY_H #define PS2_FILESYSTEM_FACTORY_H diff --git a/backends/factories/psp/psp-fs-factory.cpp b/backends/factories/psp/psp-fs-factory.cpp index 9c9bef21e7..0791904d96 100644 --- a/backends/factories/psp/psp-fs-factory.cpp +++ b/backends/factories/psp/psp-fs-factory.cpp @@ -1,3 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: $ + * $Id: $ + */ + #include "backends/factories/psp/psp-fs-factory.h" #include "backends/fs/psp/psp_fs.cpp" #include "backends/file/base-file.h" diff --git a/backends/factories/psp/psp-fs-factory.h b/backends/factories/psp/psp-fs-factory.h index 0d30efd5ad..10a9bcc711 100644 --- a/backends/factories/psp/psp-fs-factory.h +++ b/backends/factories/psp/psp-fs-factory.h @@ -1,3 +1,27 @@ +/* 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 PSP_FILESYSTEM_FACTORY_H #define PSP_FILESYSTEM_FACTORY_H diff --git a/backends/factories/symbian/symbian-fs-factory.cpp b/backends/factories/symbian/symbian-fs-factory.cpp index a21b40a095..04fb3195d9 100644 --- a/backends/factories/symbian/symbian-fs-factory.cpp +++ b/backends/factories/symbian/symbian-fs-factory.cpp @@ -1,3 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: $ + * $Id: $ + */ + #include "backends/factories/symbian/symbian-fs-factory.h" #include "backends/fs/symbian/symbian-fs.cpp" #include "backends/file/symbian/symbian-file.h" diff --git a/backends/factories/symbian/symbian-fs-factory.h b/backends/factories/symbian/symbian-fs-factory.h index 49f92410ce..edf39969d2 100644 --- a/backends/factories/symbian/symbian-fs-factory.h +++ b/backends/factories/symbian/symbian-fs-factory.h @@ -1,3 +1,27 @@ +/* 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 SYMBIAN_FILESYSTEM_FACTORY_H #define SYMBIAN_FILESYSTEM_FACTORY_H diff --git a/backends/factories/windows/windows-fs-factory.cpp b/backends/factories/windows/windows-fs-factory.cpp index 55c48c3b9c..57976b6ad9 100644 --- a/backends/factories/windows/windows-fs-factory.cpp +++ b/backends/factories/windows/windows-fs-factory.cpp @@ -1,3 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: $ + * $Id: $ + */ + #include "backends/factories/windows/windows-fs-factory.h" #include "backends/fs/windows/windows-fs.cpp" #include "backends/file/base-file.h" diff --git a/backends/factories/windows/windows-fs-factory.h b/backends/factories/windows/windows-fs-factory.h index 1f85d8f1c3..b1272a6bcb 100644 --- a/backends/factories/windows/windows-fs-factory.h +++ b/backends/factories/windows/windows-fs-factory.h @@ -1,3 +1,27 @@ +/* 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 WINDOWS_FILESYSTEM_FACTORY_H #define WINDOWS_FILESYSTEM_FACTORY_H diff --git a/backends/file/base-file.cpp b/backends/file/base-file.cpp index 3174f5828c..e42f50ce98 100644 --- a/backends/file/base-file.cpp +++ b/backends/file/base-file.cpp @@ -37,6 +37,8 @@ #include "CoreFoundation/CoreFoundation.h" #endif +namespace Common { + BaseFile::BaseFile() { _handle = 0; _ioFailed = false; @@ -224,3 +226,5 @@ long BaseFile::_ftell(FILE *stream) const { int BaseFile::_fwrite(const void * ptr, size_t obj_size, size_t count, FILE * stream) { return fwrite(ptr, obj_size, count, stream); } + +} // End of namespace Common diff --git a/backends/file/base-file.h b/backends/file/base-file.h index f383a1a453..d28655b31e 100644 --- a/backends/file/base-file.h +++ b/backends/file/base-file.h @@ -30,12 +30,14 @@ #include "common/str.h" #include "common/stream.h" -using namespace Common; +//using namespace Common; + +namespace Common { /** * Implements several file related functions used by the Common::File wrapper. */ -class BaseFile : public Common::SeekableReadStream { +class BaseFile : public SeekableReadStream { protected: /** File handle to the actual file; 0 if no file is open. */ void *_handle; @@ -177,4 +179,6 @@ public: //uint32 write(const void *dataPtr, uint32 dataSize); }; +} // End of namespace Common + #endif //BACKENDS_BASE_FILE_H diff --git a/backends/file/posix/posix-file.cpp b/backends/file/posix/posix-file.cpp index 84c82fa5c5..7419161ccd 100644 --- a/backends/file/posix/posix-file.cpp +++ b/backends/file/posix/posix-file.cpp @@ -1,5 +1,7 @@ #include "backends/file/posix/posix-file.h" +namespace Common { + POSIXFile::POSIXFile() : BaseFile() { // } @@ -39,3 +41,5 @@ long POSIXFile::_ftell(FILE *stream) const { int POSIXFile::_fwrite(const void * ptr, size_t obj_size, size_t count, FILE * stream) { return fwrite(ptr, obj_size, count, stream); } + +} // End of namespace Common diff --git a/backends/file/posix/posix-file.h b/backends/file/posix/posix-file.h index 00ce307df5..e74338b8d8 100644 --- a/backends/file/posix/posix-file.h +++ b/backends/file/posix/posix-file.h @@ -27,6 +27,8 @@ #include "backends/file/base-file.cpp" +namespace Common { + /** * Implements several POSIX specific file related functions used by the Common::File wrapper. * @@ -47,4 +49,6 @@ protected: int _fwrite(const void * ptr, size_t obj_size, size_t count, FILE * stream); }; +} // End of namespace Common + #endif //BACKENDS_POSIX_FILE_H diff --git a/backends/fs/abstract-fs.h b/backends/fs/abstract-fs.h index 85fcbcdebb..e506d96a0b 100644 --- a/backends/fs/abstract-fs.h +++ b/backends/fs/abstract-fs.h @@ -79,7 +79,7 @@ public: virtual ~AbstractFilesystemNode() {} /* - * Indicates whether the object refered by this path exists in the filesystem or not. + * Indicates whether the object referred by this path exists in the filesystem or not. */ virtual bool exists() const = 0; @@ -102,6 +102,18 @@ public: */ virtual String getDisplayName() const { return getName(); } + /** + * Returns the last component of a given path. + * + * Examples: + * /foo/bar.txt would return /bar.txt + * /foo/bar/ would return /bar/ + * + * @param str String containing the path. + * @return Pointer to the first char of the last component inside str. + */ + virtual const char *getLastPathComponent(const Common::String &str) const = 0; + /** * Returns a string with an architecture dependent path description. */ @@ -118,12 +130,28 @@ public: virtual bool isDirectory() const = 0; /** - * Indicates whether this path can be read from or not. + * Indicates whether the object referred by this path can be read from or not. + * + * If the path refers to a directory, readability implies being able to read + * and list the directory entries. + * + * If the path refers to a file, readability implies being able to read the + * contents of the file. + * + * @return bool true if the object can be read, false otherwise. */ virtual bool isReadable() const = 0; /** - * Indicates whether this path can be written to or not. + * Indicates whether the object referred by this path can be written to or not. + * + * If the path refers to a directory, writability implies being able to modify + * the directory entry (i.e. rename the directory, remove it or write files inside of it). + * + * If the path refers to a file, writability implies being able to write data + * to the file. + * + * @return bool true if the object can be written to, false otherwise. */ virtual bool isWritable() const = 0; @@ -132,4 +160,4 @@ public: */ }; -#endif +#endif //BACKENDS_ABSTRACT_FS_H diff --git a/backends/fs/dc/dc-fs.cpp b/backends/fs/dc/dc-fs.cpp index e1228c7ff2..6554544c7f 100644 --- a/backends/fs/dc/dc-fs.cpp +++ b/backends/fs/dc/dc-fs.cpp @@ -32,7 +32,7 @@ #include /** - * Implementation of the ScummVM file system API based on POSIX. + * Implementation of the ScummVM file system API based on Ronin. * * Parts of this class are documented in the base interface class, AbstractFilesystemNode. */ diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 3708acd2a8..9fd5b8a185 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -64,6 +64,7 @@ public: virtual bool exists() const { return access(_path.c_str(), F_OK) == 0; } virtual String getDisplayName() const { return _displayName; } + virtual const char *getLastPathComponent(const Common::String &str) const; virtual String getName() const { return _displayName; } virtual String getPath() const { return _path; } virtual bool isDirectory() const { return _isDirectory; } @@ -81,27 +82,6 @@ private: virtual void setFlags(); }; -/** - * Returns the last component of a given path. - * - * Examples: - * /foo/bar.txt would return /bar.txt - * /foo/bar/ would return /bar/ - * - * @param str String containing the path. - * @return Pointer to the first char of the last component inside str. - */ -static const char *lastPathComponent(const Common::String &str) { - const char *start = str.c_str(); - const char *cur = start + str.size() - 2; - - while (cur >= start && *cur != '/') { - --cur; - } - - return cur + 1; -} - void POSIXFilesystemNode::setFlags() { struct stat st; @@ -142,7 +122,7 @@ POSIXFilesystemNode::POSIXFilesystemNode(const String &p, bool verify) { assert(p.size() > 0); _path = p; - _displayName = lastPathComponent(_path); + _displayName = getLastPathComponent(_path); if (verify) { setFlags(); @@ -236,12 +216,23 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo return true; } +const char *POSIXFilesystemNode::getLastPathComponent(const Common::String &str) const { + const char *start = str.c_str(); + const char *cur = start + str.size() - 2; + + while (cur >= start && *cur != '/') { + --cur; + } + + return cur + 1; +} + AbstractFilesystemNode *POSIXFilesystemNode::getParent() const { if (_path == "/") return 0; const char *start = _path.c_str(); - const char *end = lastPathComponent(_path); + const char *end = getLastPathComponent(_path); return new POSIXFilesystemNode(String(start, end - start), true); } -- cgit v1.2.3