omni::extras::PathHash

Defined in omni/extras/PathMap.h

using omni::extras::PathHash = std::hash<std::string>

Custom hash functor for a case sensitive or insensitive hash based on the OS.

On Windows this allows the keys with any casing to hash to the same bucket for lookup. This reimplements the std::hash<std::string> FNV1 functor except that it first lower-cases each character. This intentionally avoids allocating a new string that is lower-cased for performance reasons. On Linux, this just uses std::hash<> directly which implements a case sensitive hash.

On Windows, note that this uses the Win32 function LCMapStringW() to do the lower case conversion. This is done because functions such as towlower() do not properly lower case codepoints outside of the ASCII range unless the current codepage for the calling thread is set to one that specifically uses those extended characters. Since changing the codepage for the thread is potentially destructive, we need to use another way to lower case the string’s codepoints for hashing.