Guitar
src
texteditor
UnicodeWidth.h
Go to the documentation of this file.
1
#ifndef UNICODEWIDTH_H
2
#define UNICODEWIDTH_H
3
4
#include <cstdint>
5
6
7
8
class
UnicodeWidth
{
9
public
:
10
enum class
Type
{
11
Unknown
,
12
Control
,
13
Neutral
,
14
Narrow
,
15
Half
,
16
Full
,
17
Wide
,
18
Ambigous
,
19
};
20
private
:
21
struct
Range
{
22
uint32_t
lo
;
23
uint32_t
hi
;
24
Type
type
;
25
};
26
public
:
27
UnicodeWidth
() =
delete
;
28
static
Type
type
(uint32_t c);
29
static
int
width
(
Type
t)
30
{
31
switch
(t) {
32
case
Type::Neutral
:
33
case
Type::Narrow
:
34
case
Type::Half
:
35
return
1;
36
case
Type::Full
:
37
case
Type::Wide
:
38
case
Type::Ambigous
:
39
return
2;
40
}
41
return
0;
42
}
43
};
44
45
#endif // UNICODEWIDTH_H
UnicodeWidth::Type::Neutral
@ Neutral
UnicodeWidth::type
static Type type(uint32_t c)
Definition:
UnicodeWidth.cpp:6
UnicodeWidth::Type::Full
@ Full
UnicodeWidth::UnicodeWidth
UnicodeWidth()=delete
UnicodeWidth::Range::lo
uint32_t lo
Definition:
UnicodeWidth.h:22
UnicodeWidth::width
static int width(Type t)
Definition:
UnicodeWidth.h:29
UnicodeWidth::Range::type
Type type
Definition:
UnicodeWidth.h:24
UnicodeWidth::Type::Ambigous
@ Ambigous
UnicodeWidth::Type::Wide
@ Wide
UnicodeWidth.h
UnicodeWidth::Range::hi
uint32_t hi
Definition:
UnicodeWidth.h:23
UnicodeWidth::Type::Control
@ Control
UnicodeWidth::Type::Unknown
@ Unknown
UnicodeWidth::Type::Half
@ Half
UnicodeWidth
Definition:
UnicodeWidth.h:8
UnicodeWidth::Type
Type
Definition:
UnicodeWidth.h:10
UnicodeWidth::Range
Definition:
UnicodeWidth.h:21
UnicodeWidth::Type::Narrow
@ Narrow
Generated by
1.8.17