diff options
author | Max Horn | 2007-09-18 20:02:04 +0000 |
---|---|---|
committer | Max Horn | 2007-09-18 20:02:04 +0000 |
commit | c3d3aebe87d16d4fc3b7ac8581b99fb97241c9ac (patch) | |
tree | 17b2ba9f45743d2cf8f8e5faa6c9511e213f15f3 /common/savefile.h | |
parent | 5c08cb1bcf84828cc93114fadbc89dd6f9909d06 (diff) | |
parent | 1dc13a641dd82825334e81bb3eb3b4ebd69d2552 (diff) | |
download | scummvm-rg350-c3d3aebe87d16d4fc3b7ac8581b99fb97241c9ac.tar.gz scummvm-rg350-c3d3aebe87d16d4fc3b7ac8581b99fb97241c9ac.tar.bz2 scummvm-rg350-c3d3aebe87d16d4fc3b7ac8581b99fb97241c9ac.zip |
Patch #1768757: Merge fsnode-gsoc into trunk (MAJOR change, will break compilation on some ports)
svn-id: r28944
Diffstat (limited to 'common/savefile.h')
-rw-r--r-- | common/savefile.h | 52 |
1 files changed, 45 insertions, 7 deletions
diff --git a/common/savefile.h b/common/savefile.h index e1a54638b5..9fdd76ae15 100644 --- a/common/savefile.h +++ b/common/savefile.h @@ -30,6 +30,8 @@ #include "common/noncopyable.h" #include "common/scummsys.h" #include "common/stream.h" +#include "common/str.h" +#include "common/error.h" namespace Common { @@ -75,10 +77,40 @@ public: * returning the single SaveFileManager instances to be used. */ class SaveFileManager : NonCopyable { - + +protected: + SFMError _error; + String _errorDesc; + public: virtual ~SaveFileManager() {} - + + /** + * Clears the last set error code and string. + */ + virtual void clearError() { _error = SFM_NO_ERROR; _errorDesc = ""; } + + /** + * Returns the last ocurred error code. If none ocurred, returns SFM_NO_ERROR. + * + * @return A SFMError indicating the type of the last error. + */ + virtual SFMError getError() { return _error; } + + /** + * Returns the last ocurred error description. If none ocurred, returns 0. + * + * @return A string describing the last error. + */ + virtual String getErrorDesc() { return _errorDesc; } + + /** + * Sets the last ocurred error. + * @param error Code identifying the last error. + * @param errorDesc String describing the last error. + */ + virtual void setError(SFMError error, String errorDesc) { _error = error; _errorDesc = errorDesc; } + /** * Open the file with name filename in the given directory for saving. * @param filename the filename @@ -94,12 +126,18 @@ public: virtual InSaveFile *openForLoading(const char *filename) = 0; /** - * Request a list of available savegames with a given prefix. - * TODO: Document this better! - * TODO: Or even replace it with a better API. For example, one that - * returns a list of strings for all present file names. + * Removes the given savefile from the filesystem. + * @param filename Filename path pointing to the savefile. + * @return true if no error ocurred. false otherwise. + */ + virtual bool removeSavefile(const char *filename) = 0; + + /** + * Request a list of available savegames with a given regex. + * @param regex Regular expression to match. Wildcards like * or ? are available. + * returns a list of strings for all present file names. */ - virtual void listSavefiles(const char * /* prefix */, bool *marks, int num) = 0; + virtual Common::StringList listSavefiles(const char *regex) = 0; /** * Get the path to the save game directory. |