COMMON: Add case-insensitive comparator and hash for Common::Path

This commit is contained in:
Vladimir Serbinenko 2022-12-09 05:11:33 +01:00
parent 43d7259ff9
commit ab517cc577
2 changed files with 26 additions and 0 deletions

View file

@ -22,6 +22,7 @@
#include "common/path.h"
#include "common/tokenizer.h"
#include "common/punycode.h"
#include "common/hash-str.h"
namespace Common {
@ -232,4 +233,12 @@ bool Path::matchPattern(const Path& pattern) const {
return punycodeDecode()._str.matchString(pattern.punycodeDecode()._str, true, wildcardExclusions);
}
bool Path::IgnoreCaseAndMac_EqualsTo::operator()(const Path& x, const Path& y) const {
return x.punycodeDecode()._str.equalsIgnoreCase(y.punycodeDecode()._str);
}
uint Path::IgnoreCaseAndMac_Hash::operator()(const Path& x) const {
return hashit_lower(x.punycodeDecode()._str.c_str());
}
} // End of namespace Common