ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

savefile.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef COMMON_SAVEFILE_H
00024 #define COMMON_SAVEFILE_H
00025 
00026 #include "common/noncopyable.h"
00027 #include "common/scummsys.h"
00028 #include "common/stream.h"
00029 #include "common/str-array.h"
00030 #include "common/error.h"
00031 
00032 namespace Common {
00033 
00034 
00040 typedef SeekableReadStream InSaveFile;
00041 
00047 class OutSaveFile: public WriteStream {
00048 protected:
00049     WriteStream *_wrapped;
00050 
00051 public:
00052     OutSaveFile(WriteStream *w);
00053     virtual ~OutSaveFile();
00054 
00055     virtual bool err() const;
00056     virtual void clearErr();
00057     virtual void finalize();
00058     virtual bool flush();
00059     virtual uint32 write(const void *dataPtr, uint32 dataSize);
00060     virtual int32 pos() const;
00061 };
00062 
00082 class SaveFileManager : NonCopyable {
00083 
00084 protected:
00085     Error _error;
00086     String _errorDesc;
00087 
00093     virtual void setError(Error error, const String &errorDesc) { _error = error; _errorDesc = errorDesc; }
00094 
00095 public:
00096     virtual ~SaveFileManager() {}
00097 
00101     virtual void clearError() { _error = kNoError; _errorDesc.clear(); }
00102 
00108     virtual Error getError() { return _error; }
00109 
00115     virtual String getErrorDesc() { return _errorDesc; }
00116 
00123     virtual String popErrorDesc();
00124 
00142     virtual OutSaveFile *openForSaving(const String &name, bool compress = true) = 0;
00143 
00150     virtual InSaveFile *openForLoading(const String &name) = 0;
00151 
00159     virtual InSaveFile *openRawFile(const String &name) = 0;
00160 
00167     virtual bool removeSavefile(const String &name) = 0;
00168 
00176     virtual bool renameSavefile(const String &oldName, const String &newName);
00177 
00185     virtual bool copySavefile(const String &oldName, const String &newName);
00186 
00198     virtual StringArray listSavefiles(const String &pattern) = 0;
00199 
00205     virtual void updateSavefilesList(StringArray &lockedFiles) = 0;
00206 };
00207 
00208 } // End of namespace Common
00209 
00210 #endif


Generated on Sat Mar 16 2019 05:01:52 for ResidualVM by doxygen 1.7.1
curved edge   curved edge