mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Make some DatabaseInterface methods const
This commit is contained in:
@@ -75,7 +75,7 @@ public:
|
||||
* written. Otherwise, data will be written.
|
||||
*/
|
||||
virtual void WriteUserMetadata(const std::string& outputFile,
|
||||
const bool overwrite) = 0;
|
||||
const bool overwrite) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Writes a minimal metadata file that only contains plugins with
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
* written. Otherwise, data will be written.
|
||||
*/
|
||||
virtual void WriteMinimalList(const std::string& outputFile,
|
||||
const bool overwrite) = 0;
|
||||
const bool overwrite) const = 0;
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
* @returns The revision data.
|
||||
*/
|
||||
virtual MasterlistInfo GetMasterlistRevision(const std::string& masterlist_path,
|
||||
const bool get_short_id) = 0;
|
||||
const bool get_short_id) const = 0;
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -160,14 +160,14 @@ public:
|
||||
* @details Bash Tag suggestions can include plugins not in this list.
|
||||
* @returns A set of Bash Tag names.
|
||||
*/
|
||||
virtual std::set<std::string> GetKnownBashTags() = 0;
|
||||
virtual std::set<std::string> GetKnownBashTags() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Get all general messages listen in the loaded metadata lists.
|
||||
* @returns A vector of messages supplied in the metadata lists but not
|
||||
* attached to any particular plugin.
|
||||
*/
|
||||
virtual std::vector<Message> GetGeneralMessages() = 0;
|
||||
virtual std::vector<Message> GetGeneralMessages() const = 0;
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
* will return true.
|
||||
*/
|
||||
virtual PluginMetadata GetPluginMetadata(const std::string& plugin,
|
||||
bool includeUserMetadata = true) = 0;
|
||||
bool includeUserMetadata = true) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Get a plugin's metadata loaded from the given userlist.
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
* metadata. If the plugin has no metadata,
|
||||
* PluginMetadata.IsNameOnly() will return true.
|
||||
*/
|
||||
virtual PluginMetadata GetPluginUserMetadata(const std::string& plugin) = 0;
|
||||
virtual PluginMetadata GetPluginUserMetadata(const std::string& plugin) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Sets a plugin's user metadata, overwriting any existing user
|
||||
@@ -232,7 +232,7 @@ public:
|
||||
* The filename of the plugin to look up Bash Tag suggestions for.
|
||||
* @returns Bash Tag data for the plugin.
|
||||
*/
|
||||
virtual PluginTags GetPluginTags(const std::string& plugin) = 0;
|
||||
virtual PluginTags GetPluginTags(const std::string& plugin) const = 0;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
@@ -247,7 +247,7 @@ public:
|
||||
* if the plugin has no messages associated with it.
|
||||
*/
|
||||
virtual std::vector<SimpleMessage> GetPluginMessages(const std::string& plugin,
|
||||
const LanguageCode language) = 0;
|
||||
const LanguageCode language) const = 0;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
@@ -263,7 +263,7 @@ public:
|
||||
* The plugin to look up the cleanliness state for.
|
||||
* @returns A plugin cleanliness code.
|
||||
*/
|
||||
virtual PluginCleanliness GetPluginCleanliness(const std::string& plugin) = 0;
|
||||
virtual PluginCleanliness GetPluginCleanliness(const std::string& plugin) const = 0;
|
||||
|
||||
/** @} */
|
||||
};
|
||||
|
||||
+10
-10
@@ -81,7 +81,7 @@ void ApiDatabase::EvalLists() {
|
||||
game_.GetUserlist() = userTemp;
|
||||
}
|
||||
|
||||
void ApiDatabase::WriteUserMetadata(const std::string& outputFile, const bool overwrite) {
|
||||
void ApiDatabase::WriteUserMetadata(const std::string& outputFile, const bool overwrite) const {
|
||||
if (!boost::filesystem::exists(boost::filesystem::path(outputFile).parent_path()))
|
||||
throw std::invalid_argument("Output directory does not exist.");
|
||||
|
||||
@@ -107,11 +107,11 @@ bool ApiDatabase::UpdateMasterlist(const std::string& masterlistPath,
|
||||
}
|
||||
|
||||
MasterlistInfo ApiDatabase::GetMasterlistRevision(const std::string& masterlistPath,
|
||||
const bool getShortID) {
|
||||
const bool getShortID) const {
|
||||
return Masterlist::GetInfo(masterlistPath, getShortID);
|
||||
}
|
||||
|
||||
std::set<std::string> ApiDatabase::GetKnownBashTags() {
|
||||
std::set<std::string> ApiDatabase::GetKnownBashTags() const {
|
||||
auto masterlistTags = game_.GetMasterlist().BashTags();
|
||||
auto userlistTags = game_.GetUserlist().BashTags();
|
||||
|
||||
@@ -122,7 +122,7 @@ std::set<std::string> ApiDatabase::GetKnownBashTags() {
|
||||
return masterlistTags;
|
||||
}
|
||||
|
||||
std::vector<Message> ApiDatabase::GetGeneralMessages() {
|
||||
std::vector<Message> ApiDatabase::GetGeneralMessages() const {
|
||||
auto masterlistMessages = game_.GetMasterlist().Messages();
|
||||
auto userlistMessages = game_.GetUserlist().Messages();
|
||||
|
||||
@@ -134,7 +134,7 @@ std::vector<Message> ApiDatabase::GetGeneralMessages() {
|
||||
}
|
||||
|
||||
PluginMetadata ApiDatabase::GetPluginMetadata(const std::string& plugin,
|
||||
bool includeUserMetadata) {
|
||||
bool includeUserMetadata) const {
|
||||
PluginMetadata metadata = game_.GetMasterlist().FindPlugin(plugin);
|
||||
|
||||
if (includeUserMetadata) {
|
||||
@@ -144,7 +144,7 @@ PluginMetadata ApiDatabase::GetPluginMetadata(const std::string& plugin,
|
||||
return metadata;
|
||||
}
|
||||
|
||||
PluginMetadata ApiDatabase::GetPluginUserMetadata(const std::string& plugin) {
|
||||
PluginMetadata ApiDatabase::GetPluginUserMetadata(const std::string& plugin) const {
|
||||
return game_.GetUserlist().FindPlugin(plugin);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ void ApiDatabase::DiscardAllUserMetadata() {
|
||||
// DB Access Functions
|
||||
//////////////////////////
|
||||
|
||||
PluginTags ApiDatabase::GetPluginTags(const std::string& plugin) {
|
||||
PluginTags ApiDatabase::GetPluginTags(const std::string& plugin) const {
|
||||
PluginTags tags;
|
||||
|
||||
PluginMetadata pluginMetadata = game_.GetMasterlist().FindPlugin(PluginMetadata(plugin));
|
||||
@@ -189,7 +189,7 @@ PluginTags ApiDatabase::GetPluginTags(const std::string& plugin) {
|
||||
}
|
||||
|
||||
std::vector<SimpleMessage> ApiDatabase::GetPluginMessages(const std::string& plugin,
|
||||
const LanguageCode language) {
|
||||
const LanguageCode language) const {
|
||||
std::vector<SimpleMessage> messages;
|
||||
|
||||
PluginMetadata pluginMetadata = game_.GetMasterlist().FindPlugin(PluginMetadata(plugin));
|
||||
@@ -205,7 +205,7 @@ std::vector<SimpleMessage> ApiDatabase::GetPluginMessages(const std::string& plu
|
||||
return messages;
|
||||
}
|
||||
|
||||
PluginCleanliness ApiDatabase::GetPluginCleanliness(const std::string& plugin) {
|
||||
PluginCleanliness ApiDatabase::GetPluginCleanliness(const std::string& plugin) const {
|
||||
// Is there any dirty info? Testing for applicability happens in loot_eval_lists().
|
||||
if (!game_.GetMasterlist().FindPlugin(PluginMetadata(plugin)).DirtyInfo().empty()
|
||||
|| !game_.GetUserlist().FindPlugin(PluginMetadata(plugin)).DirtyInfo().empty()) {
|
||||
@@ -239,7 +239,7 @@ PluginCleanliness ApiDatabase::GetPluginCleanliness(const std::string& plugin) {
|
||||
// and/or dirty messages, plus the Tag suggestions and/or messages themselves and their
|
||||
// conditions, in order to create the Wrye Bash taglist. outputFile is the path to use
|
||||
// for output. If outputFile already exists, it will only be overwritten if overwrite is true.
|
||||
void ApiDatabase::WriteMinimalList(const std::string& outputFile, const bool overwrite) {
|
||||
void ApiDatabase::WriteMinimalList(const std::string& outputFile, const bool overwrite) const {
|
||||
if (!boost::filesystem::exists(boost::filesystem::path(outputFile).parent_path()))
|
||||
throw std::invalid_argument("Output directory does not exist.");
|
||||
|
||||
|
||||
+10
-10
@@ -42,10 +42,10 @@ struct ApiDatabase : public DatabaseInterface {
|
||||
void EvalLists();
|
||||
|
||||
void WriteUserMetadata(const std::string& outputFile,
|
||||
const bool overwrite);
|
||||
const bool overwrite) const;
|
||||
|
||||
void WriteMinimalList(const std::string& outputFile,
|
||||
const bool overwrite);
|
||||
const bool overwrite) const;
|
||||
|
||||
void IdentifyMainMasterFile(const std::string& masterFile);
|
||||
|
||||
@@ -56,16 +56,16 @@ struct ApiDatabase : public DatabaseInterface {
|
||||
const std::string& remote_branch);
|
||||
|
||||
MasterlistInfo GetMasterlistRevision(const std::string& masterlist_path,
|
||||
const bool get_short_id);
|
||||
const bool get_short_id) const;
|
||||
|
||||
std::set<std::string> GetKnownBashTags();
|
||||
std::set<std::string> GetKnownBashTags() const;
|
||||
|
||||
std::vector<Message> GetGeneralMessages();
|
||||
std::vector<Message> GetGeneralMessages() const;
|
||||
|
||||
PluginMetadata GetPluginMetadata(const std::string& plugin,
|
||||
bool includeUserMetadata = true);
|
||||
bool includeUserMetadata = true) const;
|
||||
|
||||
PluginMetadata GetPluginUserMetadata(const std::string& plugin);
|
||||
PluginMetadata GetPluginUserMetadata(const std::string& plugin) const;
|
||||
|
||||
void SetPluginUserMetadata(const PluginMetadata& pluginMetadata);
|
||||
|
||||
@@ -73,12 +73,12 @@ struct ApiDatabase : public DatabaseInterface {
|
||||
|
||||
void DiscardAllUserMetadata();
|
||||
|
||||
PluginTags GetPluginTags(const std::string& plugin);
|
||||
PluginTags GetPluginTags(const std::string& plugin) const;
|
||||
|
||||
std::vector<SimpleMessage> GetPluginMessages(const std::string& plugin,
|
||||
const LanguageCode language);
|
||||
const LanguageCode language) const;
|
||||
|
||||
PluginCleanliness GetPluginCleanliness(const std::string& plugin);
|
||||
PluginCleanliness GetPluginCleanliness(const std::string& plugin) const;
|
||||
private:
|
||||
Game& game_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user