Remove GetLowercasedName(), GetNormalizedName() from PluginMetadata

Also remove the std::hash specialisation for PluginMetadata from the
public API.
This commit is contained in:
Oliver Hamlet
2019-11-05 20:46:32 +00:00
parent bf6a202870
commit 6a1184c8da
3 changed files with 18 additions and 38 deletions
-30
View File
@@ -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<loot::PluginMetadata> {
/**
* 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<string>()(plugin.GetNormalizedName());
}
};
}
#endif
-8
View File
@@ -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<std::string> PluginMetadata::GetGroup() const { return group_; }
+18
View File
@@ -31,10 +31,28 @@
#include <unordered_set>
#include <vector>
#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<loot::PluginMetadata> {
/**
* 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<string>()(loot::NormalizeFilename(plugin.GetName()));
}
};
}
namespace loot {
class MetadataList {
public: