HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
ttauri
text
font_grapheme_id.hpp
1
// Copyright Take Vos 2021.
2
// Distributed under the Boost Software License, Version 1.0.
3
// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5
#pragma once
6
7
#include "font_id.hpp"
8
#include "grapheme.hpp"
9
#include "../hash.hpp"
10
11
namespace
tt {
12
15
struct
font_grapheme_id
{
16
font_id
font_id
;
17
grapheme
g;
18
19
[[nodiscard]]
size_t
hash()
const
noexcept
{
20
return
hash_mix(
font_id
, g);
21
}
22
23
[[nodiscard]]
friend
bool
operator==(
font_grapheme_id
const
&lhs,
font_grapheme_id
const
&rhs)
noexcept
{
24
return
(lhs.font_id == rhs.font_id) && (lhs.g == rhs.g);
25
}
26
};
27
28
}
29
30
namespace
std
{
31
32
template
<>
33
struct
hash
<tt::font_grapheme_id> {
34
[[nodiscard]]
size_t
operator()
(
tt::font_grapheme_id
const
&rhs)
const
noexcept
{
35
return
rhs.hash();
36
}
37
};
38
39
}
std
STL namespace.
tt::tagged_id< uint16_t, "font_id", 0x7ffe >
tt::font_grapheme_id
Combined font_id + grapheme for use as a key in a std::unordered_map.
Definition
font_grapheme_id.hpp:15
tt::grapheme
Definition
grapheme.hpp:21
std::hash
std::hash::operator()
T operator()(T... args)
Generated on Mon Apr 22 2024 12:53:51 for HikoGUI by
1.10.0