#pragma once #include "case_insensitive_char_traits.h" #include #include #include #include using TCaseInsensitiveString = TBasicString; using TCaseInsensitiveStringBuf = TBasicStringBuf; // WARN: comparison works incorrectly if strings contain null bytes (`TCaseInsensitiveAsciiString{"ab\0c", 4} == TCaseInsensitiveAsciiString{"ab\0d", 4}`). using TCaseInsensitiveAsciiString = TBasicString; // WARN: comparison works incorrectly if strings contain null bytes. using TCaseInsensitiveAsciiStringBuf = TBasicStringBuf; // Convert chars using std::tolower and hash the resulting string. // Locale may affect the result. size_t CaseInsensitiveStringHash(const char* s, size_t n) noexcept; // Convert chars using AsciiToLower and hash the resulting string. size_t CaseInsensitiveAsciiStringHash(const char* s, size_t n) noexcept; template <> struct THash { size_t operator()(TCaseInsensitiveStringBuf str) const noexcept { return CaseInsensitiveStringHash(str.data(), str.size()); } }; template <> struct THash { size_t operator()(TCaseInsensitiveAsciiStringBuf str) const noexcept { return CaseInsensitiveAsciiStringHash(str.data(), str.size()); } }; template <> struct THash : THash {}; template <> struct THash : THash {}; namespace NStringSplitPrivate { template<> struct TStringBufOfImpl { /* * WARN: * StringSplitter does not use TCharTraits properly. * Splitting such strings is explicitly disabled. */ // using type = TCaseInsensitiveStringBuf; }; template<> struct TStringBufOfImpl : TStringBufOfImpl { }; } // namespace NStringSplitPrivate template <> struct TEqualTo: public TEqualTo { using is_transparent = void; }; template <> struct TEqualTo: public TEqualTo { using is_transparent = void; };