loot/libloot

Consider introducing a new API type to represent case-insensitive filenames

Ortham opened this issue · 1 comments

LOOT has to perform some case-insensitive string comparisons when working with filenames that may not correspond to files that actually exist, but it's not obvious when a string is treated case-insensitively. Introducing a new wrapper type could help with that.

The wrapper type would look something like:

class Filename {
public:
  explicit Filename();
  explicit Filename(const std::string& filename);

  std::string ToString() const; // Or overload operator<< for ostream, or implement an explicit cast operator.
private:
  std::string filename_;
};

// Also implement comparison operators using CompareFilename and specialise 
// std::hash using NormalizeFilename.

Things that would use this new Filename class:

  • File::name_
  • PluginMetadata::name_
  • PluginInterface::name_
  • PluginInterface::GetMasters()
  • PluginSortingData::GetMasters()
  • PluginSortingData::GetAfterGroupPlugins()
  • LoadOrderHandler::GetImplicitlyActivePlugins()

Done in 15d98c9 and 062ab24.