From ee24f79ca122a82780f03fdf068d5c271cfe82a5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 31 Jul 2010 07:14:47 +0000 Subject: SWORD25: Added and fixed the remaining engine setup/execution/free code svn-id: r53185 --- engines/sword25/kernel/filesystemutil.h | 151 +++++++++++++++----------------- 1 file changed, 73 insertions(+), 78 deletions(-) (limited to 'engines/sword25/kernel') diff --git a/engines/sword25/kernel/filesystemutil.h b/engines/sword25/kernel/filesystemutil.h index 1835698d14..2c650e2af2 100755 --- a/engines/sword25/kernel/filesystemutil.h +++ b/engines/sword25/kernel/filesystemutil.h @@ -1,29 +1,33 @@ -// ----------------------------------------------------------------------------- -// This file is part of Broken Sword 2.5 -// Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdörfer -// -// Broken Sword 2.5 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. -// -// Broken Sword 2.5 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 Broken Sword 2.5; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// ----------------------------------------------------------------------------- +/* 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. -/* - Die Klasse BS_FileSystemUtil stellt einen Wrapper für dateisystemspezifische Operationen dar, die nicht über die C/C++ Bibliotheken - abgedeckt werden. + * 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. - Jede unterstützte Plattform muss dieses Interface implementieren und die Singleton-Methode BS_FileSystemUtil::GetInstance() - implementieren. -*/ + * 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$ + * + * + * The class BS_FileSystemUtil represents a wrapper for file system specific + * operations that do not have equivalents in the C/C++ libraries. + * + * Each supported platform must implement this interface, and the method + * BS_FileSystemUtil Singleton::getInstance() + */ #ifndef SWORD25_FILESYSTEMUTIL_H #define SWORD25_FILESYSTEMUTIL_H @@ -32,71 +36,62 @@ // Includes // ----------------------------------------------------------------------------- +#include "common/str.h" #include "sword25/kernel/common.h" #include "sword25/kernel/bs_stdint.h" -#include "sword25/kernel/memlog_off.h" -#include -#include -#include -#include "sword25/kernel/memlog_on.h" - // ----------------------------------------------------------------------------- -// Klassendefinition +// Class definitions // ----------------------------------------------------------------------------- class BS_FileSystemUtil { public: - static BS_FileSystemUtil & GetInstance(); + static BS_FileSystemUtil &GetInstance(); virtual ~BS_FileSystemUtil() {}; - /* - Diese Funktion gibt den Namen des Verzeichnisses zurück, in dem sämtliche Benutzerdaten gespeichert werden sollen. - - Dieses sind z.B. Screenshots, Spielstände, Konfigurationsdateien, Logdateien, ... - Unter Windows Vista ist dieses beispielsweise: C:\Users\Malte\Documents\Broken Sword 2.5 - Falls dieses Verzeichnis noch nicht existiert, wird es automatisch erstellt. - - @return Gibt den Namen des Verzeichnisses für Benutzerdaten zurück. - */ - virtual std::string GetUserdataDirectory() = 0; - /* - @return Gibt den Pfadtrenner zurück (z.B. \ unter Windows und / unter Linux). - */ - virtual std::string GetPathSeparator() = 0; - /* - @param Filename der Pfad zu einer Datei. - @return Gibt die Größe der angegebenen Datei zurück. Falls die Größe nicht bestimmt werden konnte, oder die Datei nicht existiert wird -1 zurückgegeben. - */ - virtual uint64_t GetFileSize(const std::string & Filename) = 0; - /* - @param Filename der Pfad zu einer Datei. - @return Gibt den Zeitstempel des Zeitpunktes zurück an dem die Datei zuletzt verändert wurde. Bei einem Fehler wird 0 zurückgegeben. - */ - virtual time_t GetFileTime(const std::string & Filename) = 0; - /* - @param Filename der Pfad zu einer Datei. - @return Gibt true zurück, wenn die Datei existiert. - */ - virtual bool FileExists(const std::string & Filename) = 0; - /* - Diese Funktion erstellt einen Verzeichnis mit sämtlichen Unterverzeichnissen. - - Wenn des Parameter "\b\c\d\e" ist und der Pfad "\b\c" bereits existiert, werden die Verzeichnisse - "d" und "e" erstellt. - - @param DirectoryName der Name des zu erstellenden Verzeichnisses. - @return Gibt true zurück, wenn die Verzeichnisse erstellt werden konnten, ansonsten false. - */ - virtual bool CreateDirectory(const std::string & DirectoryName) = 0; - /* - Erstellt eine Liste aller Dateinamen in einem Verzeichnis. - - @param Directory das zu durchsuchende Verzeichnis. - @return Gibt einen vector mit allen gefundenen Dateinamen zurück. - */ - virtual std::vector GetFilesInDirectory(const std::string & Path) = 0; + /** + * This function returns the name of the directory in which all user data is to be stored. + * + * These are for example Screenshots, game saves, configuration files, log files, ... + * @return Returns the name of the directory for user data. + */ + virtual Common::String GetUserdataDirectory() = 0; + /** + * @return Returns the path seperator + */ + virtual Common::String GetPathSeparator() = 0; + /** + * @param Filename The path to a file. + * @return Returns the size of the specified file. If the size could not be + * determined, or the file does not exist, returns -1 + */ + virtual uint64_t GetFileSize(const Common::String &Filename) = 0; + /** + * @param Filename The path to a file. + * @return Returns the timestamp of the specified file. On error it returns 0 + */ + virtual time_t GetFileTime(const Common::String &Filename) = 0; + /** + * @param Filename The path to a file. + * @return Returns true if the file exists. + */ + virtual bool FileExists(const Common::String &Filename) = 0; + /** + * This function creates a directory + * + * If the parameter is "\b\c\d\e" is passed, and "\b\c" already exists, then folder 'd' + * will be created, and subdirectory 'e' under it. + * @param DirectoryName The name of the directory to be created + * @return Returns true if the folder(s) could be created, otherwise false. + */ + virtual bool CreateDirectory(const Common::String &DirectoryName) = 0; + /** + * Creates a list of filenames in a given directory. + * @param Directory The directory to search + * @return Returns a vector containing all of the found filenames + */ + virtual Common::StringArray GetFilesInDirectory(const Common::String &Path) = 0; }; #endif -- cgit v1.2.3