From 6a1184c8da735fce92639e2a6e985e9855e64465 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 25 May 2019 21:16:01 +0100 Subject: [PATCH] Remove GetLowercasedName(), GetNormalizedName() from PluginMetadata Also remove the std::hash specialisation for PluginMetadata from the public API. --- include/loot/metadata/plugin_metadata.h | 30 ------------------------- src/api/metadata/plugin_metadata.cpp | 8 ------- src/api/metadata_list.h | 18 +++++++++++++++ 3 files changed, 18 insertions(+), 38 deletions(-) diff --git a/include/loot/metadata/plugin_metadata.h b/include/loot/metadata/plugin_metadata.h index c6de32d2..88c819df 100644 --- a/include/loot/metadata/plugin_metadata.h +++ b/include/loot/metadata/plugin_metadata.h @@ -89,19 +89,6 @@ public: */ LOOT_API std::string GetName() const; - /** - * Get the lowercased plugin name. - * @return The lowercased plugin name. - */ - LOOT_API std::string GetLowercasedName() const; - - /** - * Get the plugin name, normalized to be suitable for case-insensitive - * filename comparison. - * @return The normalized plugin name. - */ - LOOT_API std::string GetNormalizedName() const; - /** * Check if the plugin metadata is enabled for use during sorting. * @return True if the metadata will be used during sorting, false otherwise. @@ -307,21 +294,4 @@ private: }; } -namespace std { -/** - * A specialisation of std::hash for loot::PluginMetadata. - */ -template<> -struct hash { - /** - * Calculate a hash value for an object of a class that implements - * loot::PluginMetadata. - * @return The hash generated from the plugin's lowercased filename. - */ - size_t operator()(const loot::PluginMetadata& plugin) const { - return hash()(plugin.GetNormalizedName()); - } -}; -} - #endif diff --git a/src/api/metadata/plugin_metadata.cpp b/src/api/metadata/plugin_metadata.cpp index 3444a9e3..39a41fb8 100644 --- a/src/api/metadata/plugin_metadata.cpp +++ b/src/api/metadata/plugin_metadata.cpp @@ -172,14 +172,6 @@ PluginMetadata PluginMetadata::NewMetadata(const PluginMetadata& plugin) const { std::string PluginMetadata::GetName() const { return name_; } -std::string PluginMetadata::GetLowercasedName() const { - return boost::locale::to_lower(name_); -} - -std::string PluginMetadata::GetNormalizedName() const { - return NormalizeFilename(name_); -} - bool PluginMetadata::IsEnabled() const { return enabled_; } std::optional PluginMetadata::GetGroup() const { return group_; } diff --git a/src/api/metadata_list.h b/src/api/metadata_list.h index 729bb390..a3e5c3a2 100644 --- a/src/api/metadata_list.h +++ b/src/api/metadata_list.h @@ -31,10 +31,28 @@ #include #include +#include "api/helpers/text.h" #include "api/metadata/condition_evaluator.h" #include "loot/metadata/group.h" #include "loot/metadata/plugin_metadata.h" +namespace std { + /** + * A specialisation of std::hash for loot::PluginMetadata. + */ + template<> + struct hash { + /** + * Calculate a hash value for an object of a class that implements + * loot::PluginMetadata. + * @return The hash generated from the plugin's normalized filename. + */ + size_t operator()(const loot::PluginMetadata& plugin) const { + return hash()(loot::NormalizeFilename(plugin.GetName())); + } + }; +} + namespace loot { class MetadataList { public: