userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
str_icase.hpp
Go to the documentation of this file.
1
#pragma once
2
6
7
#include <cstdint>
8
#include <string_view>
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
utils
{
13
15
struct
HashSeed
final {
16
std::uint64_t k0;
17
std::uint64_t k1;
18
};
19
21
class
StrCaseHash
{
22
public
:
23
using
is_transparent [[maybe_unused]] = void;
24
26
StrCaseHash
();
27
30
explicit
StrCaseHash
(
HashSeed
seed)
noexcept
;
31
32
std::size_t operator()(std::string_view s)
const
&
noexcept
;
33
34
template
<
class
StringStrongTypedef>
35
auto
operator()(
const
StringStrongTypedef& s
36
)
const
&
noexcept
->
decltype
(operator()(std::string_view{s.GetUnderlying()})) {
37
static_assert
(
38
noexcept
((*this)(std::string_view{s.GetUnderlying()})),
39
"GetUnderlying() should not throw as this affects efficiency "
40
"on some platforms"
41
);
42
43
return
(*
this
)(std::string_view{s.GetUnderlying()});
44
}
45
46
HashSeed GetSeed() const noexcept {
return
seed_; }
47
48
private
:
49
HashSeed seed_;
50
};
51
53
class
StrIcaseHash
{
54
public
:
55
using
is_transparent [[maybe_unused]] = void;
56
58
StrIcaseHash
();
59
62
explicit
StrIcaseHash
(
HashSeed
seed)
noexcept
;
63
64
std::size_t operator()(std::string_view s)
const
&
noexcept
;
65
66
private
:
67
HashSeed
seed_;
68
};
69
71
class
StrIcaseCompareThreeWay
{
72
public
:
73
// TODO: std::weak_ordering
74
76
int
operator()
(std::string_view lhs, std::string_view rhs)
const
noexcept
;
77
};
78
80
class
StrIcaseEqual
{
81
public
:
82
using
is_transparent [[maybe_unused]] = void;
83
84
bool
operator()(std::string_view lhs, std::string_view rhs)
const
noexcept
;
85
};
86
88
class
StrIcaseLess
{
89
public
:
90
using
is_transparent [[maybe_unused]] = void;
91
92
bool
operator()(std::string_view lhs, std::string_view rhs)
const
noexcept
;
93
};
94
95
}
// namespace utils
96
97
USERVER_NAMESPACE_END
userver
utils
str_icase.hpp
Generated on
for userver by
Doxygen
1.17.0