mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Remove Plugin::GetLowercasedName()
It should only be used in certain cases, so to avoid misuse don't have it as a method on the object.
This commit is contained in:
@@ -109,11 +109,13 @@ std::optional<std::shared_ptr<const Plugin>> GameCache::GetPlugin(
|
||||
void GameCache::AddPlugin(const Plugin&& plugin) {
|
||||
lock_guard<mutex> lock(mutex_);
|
||||
|
||||
auto it = plugins_.find(plugin.GetLowercasedName());
|
||||
auto lowercasedName = to_lower(plugin.GetName());
|
||||
|
||||
auto it = plugins_.find(lowercasedName);
|
||||
if (it != end(plugins_))
|
||||
plugins_.erase(it);
|
||||
|
||||
plugins_.emplace(plugin.GetLowercasedName(),
|
||||
plugins_.emplace(lowercasedName,
|
||||
std::make_shared<Plugin>(std::move(plugin)));
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,15 @@ template<>
|
||||
struct less<std::shared_ptr<const loot::Plugin>> {
|
||||
bool operator()(const std::shared_ptr<const loot::Plugin>& lhs,
|
||||
const std::shared_ptr<const loot::Plugin>& rhs) const {
|
||||
return lhs->GetLowercasedName() < rhs->GetLowercasedName();
|
||||
if (!lhs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!rhs) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return *lhs < *rhs;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+1
-5
@@ -131,10 +131,6 @@ Plugin::Plugin(const GameType gameType,
|
||||
|
||||
std::string Plugin::GetName() const { return name_; }
|
||||
|
||||
std::string Plugin::GetLowercasedName() const {
|
||||
return boost::locale::to_lower(name_);
|
||||
}
|
||||
|
||||
std::optional<std::string> Plugin::GetVersion() const {
|
||||
std::string version = Version(GetDescription()).AsString();
|
||||
if (version.empty()) {
|
||||
@@ -263,7 +259,7 @@ uintmax_t Plugin::GetFileSize(std::filesystem::path pluginPath) {
|
||||
}
|
||||
|
||||
bool Plugin::operator<(const Plugin& rhs) const {
|
||||
return GetLowercasedName() < rhs.GetLowercasedName();
|
||||
return boost::locale::to_lower(name_) < boost::locale::to_lower(rhs.name_);
|
||||
}
|
||||
|
||||
bool Plugin::IsActive() const { return isActive_; }
|
||||
|
||||
@@ -50,7 +50,6 @@ public:
|
||||
const bool headerOnly);
|
||||
|
||||
std::string GetName() const;
|
||||
std::string GetLowercasedName() const;
|
||||
std::optional<std::string> GetVersion() const;
|
||||
std::vector<std::string> GetMasters() const;
|
||||
std::set<Tag> GetBashTags() const;
|
||||
|
||||
Reference in New Issue
Block a user