22 class save_index_class;
38 const std::string&
name()
const
68 void read_save_file(
const std::string& dir,
const std::string& name,
config& cfg, std::string* error_log);
92 std::vector<save_info>
get_saves_list(
const std::string* filter=
nullptr);
97 void rebuild(
const std::string& name);
98 void rebuild(
const std::string& name,
const std::time_t& modified);
101 void remove(
const std::string& name);
102 void set_modified(
const std::string& name,
const std::time_t& modified);
105 const std::string&
dir()
const;
A config object defines a single node in a WML file, with access to child nodes.
std::shared_ptr< save_index_class > manager_
save_info operator()(const std::string &filename) const
create_save_info(const std::shared_ptr< save_index_class > &)
void clean_up_index()
Deletes non-existent save files from the index.
create_for_default_saves_dir
Syntatic sugar for choosing which constructor to use.
static std::shared_ptr< save_index_class > default_saves_dir()
Returns an instance for managing saves in filesystem::get_saves_dir()
std::vector< save_info > get_saves_list(const std::string *filter=nullptr)
Get a list of available saves.
void remove(const std::string &name)
Delete a savegame from the index, without deleting the underlying file.
bool read_only_
The instance for default_saves_dir() writes a cache file.
void write_save_index()
Sync to disk, no-op if read_only_ is set.
const std::string & dir() const
void set_modified(const std::string &name, const std::time_t &modified)
config & get(const std::string &name)
void delete_old_auto_saves(const int autosavemax, const int infinite_auto_saves)
Delete autosaves that are no longer needed (according to the autosave policy in the preferences).
bool read_only()
If true, all of delete_game, delete_old_auto_saves and write_save_index will be no-ops.
std::map< std::string, std::time_t > modified_
void delete_game(const std::string &name)
Delete a savegame, including deleting the underlying file.
void rebuild(const std::string &name)
save_index_class(const std::string &dir)
Constructor for a read-only instance.
bool clean_up_index_
Flag to only run the clean_up_index method once.
static void fix_leader_image_path(config &data)
Filename and modification date for a file list.
save_info(const std::string &name, const std::shared_ptr< save_index_class > &index, const std::time_t &modified)
const std::string & name() const
const config & summary() const
std::string format_time_local() const
std::string format_time_summary() const
std::shared_ptr< save_index_class > save_index_
const std::time_t & modified() const
Definitions for the interface to Wesnoth Markup Language (WML).
void read_save_file(const std::string &dir, const std::string &name, config &cfg, std::string *error_log)
Read the complete config information out of a savefile.
std::size_t index(std::string_view str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
std::string filename
Filename.
A structure for comparing to save_info objects based on their modified time.
bool operator()(const save_info &a, const save_info &b) const