forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprimitives.h
More file actions
239 lines (210 loc) · 5.18 KB
/
primitives.h
File metadata and controls
239 lines (210 loc) · 5.18 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <functional>
#include <limits>
namespace facebook {
namespace react {
enum class FontStyle { Normal, Italic, Oblique };
enum class FontWeight : int {
Weight100 = 100,
UltraLight = 100,
Weight200 = 200,
Thin = 200,
Weight300 = 300,
Light = 300,
Weight400 = 400,
Regular = 400,
Weight500 = 500,
Medium = 500,
Weight600 = 600,
Semibold = 600,
Demibold = 600,
Weight700 = 700,
Bold = 700,
Weight800 = 800,
Heavy = 800,
Weight900 = 900,
Black = 900
};
enum class FontVariant : int {
Default = 0,
SmallCaps = 1 << 1,
OldstyleNums = 1 << 2,
LiningNums = 1 << 3,
TabularNums = 1 << 4,
ProportionalNums = 1 << 5
};
enum class EllipsizeMode {
Clip, // Do not add ellipsize, simply clip.
Head, // Truncate at head of line: "...wxyz".
Tail, // Truncate at tail of line: "abcd...".
Middle // Truncate middle of line: "ab...yz".
};
enum class TextBreakStrategy {
Simple, // Simple strategy.
HighQuality, // High-quality strategy, including hyphenation.
Balanced // Balances line lengths.
};
enum class TextAlignment {
Natural, // Indicates the default alignment for script.
Left, // Visually left aligned.
Center, // Visually centered.
Right, // Visually right aligned.
Justified // Fully-justified. The last line in a paragraph is natural-aligned.
};
enum class WritingDirection {
Natural, // Determines direction using the Unicode Bidi Algorithm rules P2 and
// P3.
LeftToRight, // Left to right writing direction.
RightToLeft // Right to left writing direction.
};
enum class LineBreakStrategy {
None, // Don't use any line break strategies
PushOut, // Use the push out line break strategy.
HangulWordPriority, // When specified, it prohibits breaking between Hangul
// characters.
Standard // Use the same configuration of line break strategies that the
// system uses for standard UI labels.
};
enum class TextDecorationLineType {
None,
Underline,
Strikethrough,
UnderlineStrikethrough
};
enum class TextDecorationStyle { Solid, Double, Dotted, Dashed };
enum class AccessibilityRole {
None,
Button,
Link,
Cardinal,
Ordinal,
Decimal,
Fraction,
Measure,
Time,
Date,
Telephone,
Electronic,
Money,
Digits,
Verbatim,
Search,
Image,
Imagebutton,
Keyboardkey,
Text,
Adjustable,
Summary,
Header,
Alert,
Checkbox,
Combobox,
Menu,
Menubar,
Menuitem,
Progressbar,
Radio,
Radiogroup,
Scrollbar,
Spinbutton,
Switch,
Tab,
TabBar,
Tablist,
Timer,
Toolbar,
};
enum class TextTransform {
None,
Uppercase,
Lowercase,
Capitalize,
Unset,
};
enum class HyphenationFrequency {
None, // No hyphenation.
Normal, // Less frequent hyphenation.
Full // Standard amount of hyphenation.
};
} // namespace react
} // namespace facebook
namespace std {
template <>
struct hash<facebook::react::FontVariant> {
size_t operator()(const facebook::react::FontVariant &v) const {
return hash<int>()(static_cast<int>(v));
}
};
template <>
struct hash<facebook::react::TextAlignment> {
size_t operator()(const facebook::react::TextAlignment &v) const {
return hash<int>()(static_cast<int>(v));
}
};
template <>
struct hash<facebook::react::FontStyle> {
size_t operator()(const facebook::react::FontStyle &v) const {
return hash<int>()(static_cast<int>(v));
}
};
template <>
struct hash<facebook::react::TextDecorationLineType> {
size_t operator()(const facebook::react::TextDecorationLineType &v) const {
return hash<int>()(static_cast<int>(v));
}
};
template <>
struct hash<facebook::react::WritingDirection> {
size_t operator()(const facebook::react::WritingDirection &v) const {
return hash<int>()(static_cast<int>(v));
}
};
template <>
struct hash<facebook::react::TextDecorationStyle> {
size_t operator()(const facebook::react::TextDecorationStyle &v) const {
return hash<int>()(static_cast<int>(v));
}
};
template <>
struct hash<facebook::react::FontWeight> {
size_t operator()(const facebook::react::FontWeight &v) const {
return hash<int>()(static_cast<int>(v));
}
};
template <>
struct hash<facebook::react::EllipsizeMode> {
size_t operator()(const facebook::react::EllipsizeMode &v) const {
return hash<int>()(static_cast<int>(v));
}
};
template <>
struct hash<facebook::react::TextBreakStrategy> {
size_t operator()(const facebook::react::TextBreakStrategy &v) const {
return hash<int>()(static_cast<int>(v));
}
};
template <>
struct hash<facebook::react::AccessibilityRole> {
size_t operator()(const facebook::react::AccessibilityRole &v) const {
return hash<int>()(static_cast<int>(v));
}
};
template <>
struct hash<facebook::react::TextTransform> {
size_t operator()(const facebook::react::TextTransform &v) const {
return hash<int>()(static_cast<int>(v));
}
};
template <>
struct hash<facebook::react::HyphenationFrequency> {
size_t operator()(const facebook::react::HyphenationFrequency &v) const {
return hash<int>()(static_cast<int>(v));
}
};
} // namespace std