#include <mods.h>
Public Member Functions | |
ModMetadata ()=delete | |
ModMetadata (const std::string &mod_name) | |
~ModMetadata ()=default | |
virtual void | clear () |
bool | save (const std::string &root_path) |
bool | load (const std::string &root_path) |
bool | isModified () const |
const std::string & | getModName () const |
virtual bool | setString (const std::string &name, const std::string &var) |
Sets var to name key in the metadata storage. More... | |
Public Member Functions inherited from Metadata | |
virtual | ~Metadata ()=default |
virtual bool | empty () const |
bool | operator== (const Metadata &other) const |
bool | operator!= (const Metadata &other) const |
size_t | size () const |
bool | contains (const std::string &name) const |
const std::string & | getString (const std::string &name, u16 recursion=0) const |
bool | getStringToRef (const std::string &name, std::string &str, u16 recursion=0) const |
bool | removeString (const std::string &name) |
const StringMap & | getStrings () const |
const std::string & | resolveString (const std::string &str, u16 recursion=0) const |
bool | isModified () const |
void | setModified (bool v) |
Private Attributes | |
std::string | m_mod_name |
bool | m_modified = false |
Additional Inherited Members | |
Protected Attributes inherited from Metadata | |
StringMap | m_stringvars |
|
delete |
ModMetadata::ModMetadata | ( | const std::string & | mod_name | ) |
|
default |
|
virtual |
Reimplemented from Metadata.
References Metadata::clear(), and m_modified.
Referenced by StorageRef::clearMeta().
|
inline |
References m_mod_name.
Referenced by StorageRef::gc_object(), Client::registerModStorage(), and Server::registerModStorage().
|
inline |
References m_modified.
bool ModMetadata::load | ( | const std::string & | root_path | ) |
References DIR_DELIM, errorstream, m_mod_name, and Metadata::m_stringvars.
Referenced by ModApiStorage::l_get_mod_storage().
bool ModMetadata::save | ( | const std::string & | root_path | ) |
References fs::CreateAllDirs(), DIR_DELIM, errorstream, fastWriteJson(), fs::IsDir(), m_mod_name, m_modified, Metadata::m_stringvars, fs::PathExists(), and fs::safeWriteToFile().
|
virtual |
Sets var to name key in the metadata storage.
name | |
var |
Reimplemented from Metadata.
References m_modified, and Metadata::setString().
|
private |
Referenced by getModName(), load(), and save().
|
private |
Referenced by clear(), isModified(), save(), and setString().