2002-12-17 01:15:13 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2002-2006 The ScummVM project
|
2002-12-17 01:15:13 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-12-17 01:15:13 +00:00
|
|
|
*
|
2006-02-11 09:53:53 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2002-12-17 01:15:13 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef COMMON_SAVEFILE_H
|
|
|
|
#define COMMON_SAVEFILE_H
|
|
|
|
|
2005-06-24 15:23:51 +00:00
|
|
|
#include "common/stdafx.h"
|
2003-08-10 20:49:13 +00:00
|
|
|
#include "common/scummsys.h"
|
2004-04-17 09:57:15 +00:00
|
|
|
#include "common/stream.h"
|
2003-08-10 20:49:13 +00:00
|
|
|
|
2005-05-10 23:17:38 +00:00
|
|
|
namespace Common {
|
|
|
|
|
2005-04-10 15:13:40 +00:00
|
|
|
/**
|
|
|
|
* A class which allows game engines to load game state data.
|
|
|
|
* That typically means "save games", but also includes things like the
|
|
|
|
* IQ points in Indy3.
|
|
|
|
*/
|
|
|
|
class InSaveFile : public Common::ReadStream {
|
2002-12-17 01:15:13 +00:00
|
|
|
public:
|
2005-04-10 15:13:40 +00:00
|
|
|
virtual ~InSaveFile() {}
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-05-08 23:32:31 +00:00
|
|
|
/**
|
|
|
|
* Skip over the specified (positive) amount of bytes in the input stream.
|
|
|
|
*/
|
|
|
|
virtual void skip(uint32 offset) = 0;
|
2005-04-10 15:13:40 +00:00
|
|
|
};
|
2003-08-10 20:49:13 +00:00
|
|
|
|
2005-04-10 15:13:40 +00:00
|
|
|
/**
|
|
|
|
* A class which allows game engines to save game state data.
|
|
|
|
* That typically means "save games", but also includes things like the
|
|
|
|
* IQ points in Indy3.
|
|
|
|
*/
|
|
|
|
class OutSaveFile : public Common::WriteStream {
|
|
|
|
public:
|
|
|
|
virtual ~OutSaveFile() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convenience intermediate class, to be removed.
|
|
|
|
*/
|
|
|
|
class SaveFile : public InSaveFile, public OutSaveFile {
|
|
|
|
public:
|
2002-12-17 01:15:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SaveFileManager {
|
2004-11-27 00:26:11 +00:00
|
|
|
|
2002-12-17 01:15:13 +00:00
|
|
|
public:
|
|
|
|
virtual ~SaveFileManager() {}
|
|
|
|
|
2004-06-25 22:11:48 +00:00
|
|
|
/**
|
2005-04-10 15:13:40 +00:00
|
|
|
* Open the file with name filename in the given directory for saving.
|
2004-06-25 22:11:48 +00:00
|
|
|
* @param filename the filename
|
2005-04-10 15:13:40 +00:00
|
|
|
* @return pointer to a SaveFile object, or NULL if an error occured.
|
2004-06-25 22:11:48 +00:00
|
|
|
*/
|
2005-04-10 15:13:40 +00:00
|
|
|
virtual OutSaveFile *openForSaving(const char *filename) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open the file with name filename in the given directory for loading.
|
|
|
|
* @param filename the filename
|
|
|
|
* @return pointer to a SaveFile object, or NULL if an error occured.
|
|
|
|
*/
|
|
|
|
virtual InSaveFile *openForLoading(const char *filename) = 0;
|
|
|
|
|
2004-11-27 00:26:11 +00:00
|
|
|
virtual void listSavefiles(const char * /* prefix */, bool *marks, int num) = 0;
|
|
|
|
|
|
|
|
/** Get the path to the save game directory. */
|
|
|
|
virtual const char *getSavePath() const;
|
2004-06-25 22:11:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DefaultSaveFileManager : public SaveFileManager {
|
|
|
|
public:
|
2005-04-10 15:13:40 +00:00
|
|
|
virtual OutSaveFile *openForSaving(const char *filename);
|
|
|
|
virtual InSaveFile *openForLoading(const char *filename);
|
2004-11-27 00:26:11 +00:00
|
|
|
virtual void listSavefiles(const char * /* prefix */, bool *marks, int num);
|
2002-12-17 01:15:13 +00:00
|
|
|
|
2003-08-10 20:49:13 +00:00
|
|
|
protected:
|
2005-04-10 15:13:40 +00:00
|
|
|
SaveFile *makeSaveFile(const char *filename, bool saveOrLoad);
|
2002-12-17 01:15:13 +00:00
|
|
|
};
|
|
|
|
|
2005-05-10 23:17:38 +00:00
|
|
|
} // End of namespace Common
|
|
|
|
|
2003-08-07 14:57:55 +00:00
|
|
|
#endif
|