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

Provides a default savefile manager implementation for common platforms. More...

#include <default-saves.h>

Inheritance diagram for DefaultSaveFileManager:
Collaboration diagram for DefaultSaveFileManager:

List of all members.

Public Member Functions

 DefaultSaveFileManager ()
 DefaultSaveFileManager (const Common::String &defaultSavepath)
virtual void updateSavefilesList (Common::StringArray &lockedFiles)
 Refreshes the save files list (because some new files could've been added) and remembers the "locked" files list.
virtual Common::StringArray listSavefiles (const Common::String &pattern)
 List available savegames matching a given pattern.
virtual Common::InSaveFileopenRawFile (const Common::String &filename)
 Open the file with the specified name in the given directory for loading.
virtual Common::InSaveFileopenForLoading (const Common::String &filename)
 Open the file with the specified name in the given directory for loading.
virtual Common::OutSaveFileopenForSaving (const Common::String &filename, bool compress=true)
 Open the savefile with the specified name in the given directory for saving.
virtual bool removeSavefile (const Common::String &filename)
 Removes the given savefile from the system.

Protected Types

typedef Common::HashMap
< Common::String,
Common::FSNode,
Common::IgnoreCase_Hash,
Common::IgnoreCase_EqualTo
SaveFileCache

Protected Member Functions

virtual Common::String getSavePath () const
 Get the path to the savegame directory.
virtual void checkPath (const Common::FSNode &dir)
 Checks the given path for read access, existence, etc.
void assureCached (const Common::String &savePathName)
 Assure that the given save path is cached.

Protected Attributes

SaveFileCache _saveFileCache
 Cache of all the save files in the currently cached directory.
Common::StringArray _lockedFiles
 List of "locked" files.

Private Attributes

Common::String _cachedDirectory
 The currently cached directory.

Detailed Description

Provides a default savefile manager implementation for common platforms.

Definition at line 36 of file default-saves.h.


Member Typedef Documentation


Constructor & Destructor Documentation

DefaultSaveFileManager::DefaultSaveFileManager (  ) 

Definition at line 54 of file default-saves.cpp.

DefaultSaveFileManager::DefaultSaveFileManager ( const Common::String defaultSavepath  ) 

Definition at line 57 of file default-saves.cpp.


Member Function Documentation

void DefaultSaveFileManager::assureCached ( const Common::String savePathName  )  [protected]

Assure that the given save path is cached.

Parameters:
savePathName String representation of save path to cache.

Definition at line 246 of file default-saves.cpp.

void DefaultSaveFileManager::checkPath ( const Common::FSNode dir  )  [protected, virtual]

Checks the given path for read access, existence, etc.

Sets the internal error and error message accordingly.

Definition at line 62 of file default-saves.cpp.

Common::String DefaultSaveFileManager::getSavePath (  )  const [protected, virtual]

Get the path to the savegame directory.

Should only be used internally since some platforms might implement savefiles in a completely different way.

Definition at line 223 of file default-saves.cpp.

Common::StringArray DefaultSaveFileManager::listSavefiles ( const Common::String pattern  )  [virtual]

List available savegames matching a given pattern.

Our pattern format is based on DOS paterns, also known as "glob" in the POSIX world. Please refer to the Common::matchString() function to learn about the precise pattern format.

Parameters:
pattern Pattern to match. Wildcards like * or ? are available.
Returns:
List of strings for all present file names.
See also:
Common::matchString()

Implements Common::SaveFileManager.

Definition at line 79 of file default-saves.cpp.

Common::InSaveFile * DefaultSaveFileManager::openForLoading ( const Common::String name  )  [virtual]

Open the file with the specified name in the given directory for loading.

Parameters:
name The name of the savefile.
Returns:
Pointer to an InSaveFile, or NULL if an error occurred.

Implements Common::SaveFileManager.

Reimplemented in RecorderSaveFileManager.

Definition at line 115 of file default-saves.cpp.

Common::OutSaveFile * DefaultSaveFileManager::openForSaving ( const Common::String name,
bool  compress = true 
) [virtual]

Open the savefile with the specified name in the given directory for saving.

Saved games are compressed by default, and engines are expected to always write compressed saves.

A notable exception is if uncompressed files are needed for compatibility with games not supported by ScummVM, such as character exports from the Quest for Glory series. QfG5 is a 3D game and won't be supported by ScummVM.

Parameters:
name The name of the savefile.
compress Toggles whether to compress the resulting save file (default) or not.
Returns:
Pointer to an OutSaveFile, or NULL if an error occurred.

Implements Common::SaveFileManager.

Definition at line 137 of file default-saves.cpp.

Common::InSaveFile * DefaultSaveFileManager::openRawFile ( const Common::String name  )  [virtual]

Open the file with the specified name in the given directory for loading.

In contrast to openForLoading(), it returns raw file instead of unpacked.

Parameters:
name The name of the savefile.
Returns:
Pointer to an InSaveFile, or NULL if an error occurred.

Implements Common::SaveFileManager.

Definition at line 99 of file default-saves.cpp.

bool DefaultSaveFileManager::removeSavefile ( const Common::String name  )  [virtual]

Removes the given savefile from the system.

Parameters:
name The name of the savefile to be removed.
Returns:
true if no error occurred, false otherwise.

Implements Common::SaveFileManager.

Definition at line 179 of file default-saves.cpp.

void DefaultSaveFileManager::updateSavefilesList ( Common::StringArray lockedFiles  )  [virtual]

Refreshes the save files list (because some new files could've been added) and remembers the "locked" files list.

These files could not be used for saving or loading because they are being synced by CloudManager.

Implements Common::SaveFileManager.

Definition at line 71 of file default-saves.cpp.


Member Data Documentation

The currently cached directory.

Definition at line 101 of file default-saves.h.

List of "locked" files.

These cannot be used for saving/loading because CloudManager is downloading those.

Definition at line 95 of file default-saves.h.

Cache of all the save files in the currently cached directory.

Modify with caution because we only re-cache when the save path changed! This needs to be updated inside at least openForSaving and removeSavefile.

Definition at line 89 of file default-saves.h.


The documentation for this class was generated from the following files:


Generated on Sat Jan 12 2019 05:03:20 for ResidualVM by doxygen 1.7.1
curved edge   curved edge