aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/case_insensitive_string/case_insensitive_string.h
blob: 443de3e5f94ed66f3eeb89b3d2ce21ee130ab754 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include "case_insensitive_char_traits.h"

#include <util/generic/strbuf.h>
#include <util/generic/string.h>
#include <util/generic/hash.h>
#include <util/string/split.h>

using TCaseInsensitiveString = TBasicString<char, TCaseInsensitiveCharTraits>;
using TCaseInsensitiveStringBuf = TBasicStringBuf<char, TCaseInsensitiveCharTraits>;

template <>
struct THash<TCaseInsensitiveStringBuf> {
    size_t operator()(TCaseInsensitiveStringBuf str) const noexcept;
};

template <>
struct THash<TCaseInsensitiveString> : THash<TCaseInsensitiveStringBuf> {};

namespace NStringSplitPrivate {

    template<>
    struct TStringBufOfImpl<TCaseInsensitiveStringBuf> {
        /*
         * WARN:
         * StringSplitter does not use TCharTraits properly.
         * Splitting such strings is explicitly disabled.
         */
        // using type = TCaseInsensitiveStringBuf;
    };

    template<>
    struct TStringBufOfImpl<TCaseInsensitiveString> : TStringBufOfImpl<TCaseInsensitiveStringBuf> {
    };

} // namespace NStringSplitPrivate