HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
TTauri
Text
FontGraphemeID.hpp
1
// Copyright 2020 Pokitec
2
// All rights reserved.
3
4
#pragma once
5
6
#include "TTauri/Foundation/hash.hpp"
7
#include "TTauri/Text/FontID.hpp"
8
#include "TTauri/Text/Grapheme.hpp"
9
10
namespace
tt {
11
14
struct
FontGraphemeID
{
15
FontID
font_id;
16
Grapheme
g;
17
18
[[nodiscard]]
size_t
hash()
const
noexcept
{
19
return
hash_mix(font_id, g);
20
}
21
22
[[nodiscard]]
friend
bool
operator==(
FontGraphemeID
const
&lhs,
FontGraphemeID
const
&rhs)
noexcept
{
23
return
(lhs.font_id == rhs.font_id) && (lhs.g == rhs.g);
24
}
25
};
26
27
}
28
29
namespace
std
{
30
31
template
<>
32
struct
hash
<tt::FontGraphemeID> {
33
[[nodiscard]]
size_t
operator()
(
tt::FontGraphemeID
const
&rhs)
const
noexcept
{
34
return
rhs.hash();
35
}
36
};
37
38
}
std
STL namespace.
tt::tagged_id< uint16_t, font_id_tag, 0x7ffe >
tt::FontGraphemeID
Combined FontID + Grapheme for use as a key in a std::unordered_map.
Definition
FontGraphemeID.hpp:14
tt::Grapheme
Definition
Grapheme.hpp:20
std::hash
std::hash::operator()
T operator()(T... args)
Generated on Mon Apr 22 2024 12:53:56 for HikoGUI by
1.10.0