-
Notifications
You must be signed in to change notification settings - Fork 1
/
enums.go
454 lines (402 loc) · 8.77 KB
/
enums.go
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
package flex
// port of YGEnums.h
// Align describes align flex attribute
type Align int
const (
// AlignAuto is "auto"
AlignAuto Align = iota
// AlignFlexStart is "flex-start"
AlignFlexStart
// AlignCenter if "center"
AlignCenter
// AlignFlexEnd is "flex-end"
AlignFlexEnd
// AlignStretch is "strech"
AlignStretch
// AlignBaseline is "baseline"
AlignBaseline
// AlignSpaceBetween is "space-between"
AlignSpaceBetween
// AlignSpaceAround is "space-around"
AlignSpaceAround
)
// Dimension represents dimention
type Dimension int
const (
// DimensionWidth is width
DimensionWidth Dimension = iota
// DimensionHeight is height
DimensionHeight
)
// Direction represents right-to-left or left-to-right direction
type Direction int
const (
// DirectionInherit is "inherit"
DirectionInherit Direction = iota
// DirectionLTR is "ltr"
DirectionLTR
// DirectionRTL is "rtl"
DirectionRTL
)
// Display is "display" property
type Display int
const (
// DisplayFlex is "flex"
DisplayFlex Display = iota
// DisplayNone is "none"
DisplayNone
)
// Edge represents an edge
type Edge int
const (
// EdgeLeft is left edge
EdgeLeft Edge = iota
// EdgeTop is top edge
EdgeTop
// EdgeRight is right edge
EdgeRight
// EdgeBottom is bottom edge
EdgeBottom
// EdgeStart is start edge
EdgeStart
// EdgeEnd is end edge
EdgeEnd
// EdgeHorizontal is horizontal edge
EdgeHorizontal
// EdgeVertical is vertical edge
EdgeVertical
// EdgeAll is all edge
EdgeAll
)
const (
// EdgeCount is count of edges
EdgeCount = 9
)
// ExperimentalFeature defines experimental features
type ExperimentalFeature int
const (
// ExperimentalFeatureWebFlexBasis is web flex basis
ExperimentalFeatureWebFlexBasis ExperimentalFeature = iota
)
const (
experimentalFeatureCount = 1
)
// FlexDirection describes "flex-direction" property
type FlexDirection int
const (
// FlexDirectionColumn is "column"
FlexDirectionColumn FlexDirection = iota
// FlexDirectionColumnReverse is "column-reverse"
FlexDirectionColumnReverse
// FlexDirectionRow is "row"
FlexDirectionRow
// FlexDirectionRowReverse is "row-reverse"
FlexDirectionRowReverse
)
// Justify is "justify" property
type Justify int
const (
// JustifyFlexStart is "flex-start"
JustifyFlexStart Justify = iota
// JustifyCenter is "center"
JustifyCenter
// JustifyFlexEnd is "flex-end"
JustifyFlexEnd
// JustifySpaceBetween is "space-between"
JustifySpaceBetween
// JustifySpaceAround is "space-around"
JustifySpaceAround
)
// LogLevel represents log level
type LogLevel int
const (
LogLevelError LogLevel = iota
LogLevelWarn
LogLevelInfo
LogLevelDebug
LogLevelVerbose
LogLevelFatal
)
// MeasureMode defines measurement mode
type MeasureMode int
const (
// MeasureModeUndefined is undefined
MeasureModeUndefined MeasureMode = iota
// MeasureModeExactly is exactly
MeasureModeExactly
// MeasureModeAtMost is at-most
MeasureModeAtMost
)
const (
measureModeCount = 3
)
// NodeType defines node type
type NodeType int
const (
// NodeTypeDefault is default node
NodeTypeDefault NodeType = iota
// NodeTypeText is text node
NodeTypeText
)
// Overflow describes "overflow" property
type Overflow int
const (
// OverflowVisible is "visible"
OverflowVisible Overflow = iota
// OverflowHidden is "hidden"
OverflowHidden
// OverflowScroll is "scroll"
OverflowScroll
)
// PositionType is "position" property
type PositionType int
const (
// PositionTypeRelative is "relative"
PositionTypeRelative PositionType = iota
// PositionTypeAbsolute is "absolute"
PositionTypeAbsolute
)
type PrintOptions int
const (
PrintOptionsLayout PrintOptions = 1 << iota
PrintOptionsStyle
PrintOptionsChildren
)
// Unit is "unit" property
type Unit int
const (
// UnitUndefined is "undefined"
UnitUndefined Unit = iota
// UnitPoint is "point"
UnitPoint
// UnitPercent is "percent"
UnitPercent
// UnitAuto is "auto"
UnitAuto
)
// Wrap is "wrap" property
type Wrap int
const (
// WrapNoWrap is "no-wrap"
WrapNoWrap Wrap = iota
// WrapWrap is "wrap"
WrapWrap
// WrapWrapReverse is "reverse"
WrapWrapReverse
)
// AlignToString returns string version of Align enum
func AlignToString(value Align) string {
switch value {
case AlignAuto:
return "auto"
case AlignFlexStart:
return "flex-start"
case AlignCenter:
return "center"
case AlignFlexEnd:
return "flex-end"
case AlignStretch:
return "stretch"
case AlignBaseline:
return "baseline"
case AlignSpaceBetween:
return "space-between"
case AlignSpaceAround:
return "space-around"
}
return "unknown"
}
// DimensionToString returns string version of Dimension enum
func DimensionToString(value Dimension) string {
switch value {
case DimensionWidth:
return "width"
case DimensionHeight:
return "height"
}
return "unknown"
}
// DirectionToString returns string version of Direction enum
func DirectionToString(value Direction) string {
switch value {
case DirectionInherit:
return "inherit"
case DirectionLTR:
return "ltr"
case DirectionRTL:
return "rtl"
}
return "unknown"
}
// DisplayToString returns string version of Display enum
func DisplayToString(value Display) string {
switch value {
case DisplayFlex:
return "flex"
case DisplayNone:
return "none"
}
return "unknown"
}
// EdgeToString returns string version of Edge enum
func EdgeToString(value Edge) string {
switch value {
case EdgeLeft:
return "left"
case EdgeTop:
return "top"
case EdgeRight:
return "right"
case EdgeBottom:
return "bottom"
case EdgeStart:
return "start"
case EdgeEnd:
return "end"
case EdgeHorizontal:
return "horizontal"
case EdgeVertical:
return "vertical"
case EdgeAll:
return "all"
}
return "unknown"
}
// ExperimentalFeatureToString returns string version of ExperimentalFeature enum
func ExperimentalFeatureToString(value ExperimentalFeature) string {
switch value {
case ExperimentalFeatureWebFlexBasis:
return "web-flex-basis"
}
return "unknown"
}
// FlexDirectionToString returns string version of FlexDirection enum
func FlexDirectionToString(value FlexDirection) string {
switch value {
case FlexDirectionColumn:
return "column"
case FlexDirectionColumnReverse:
return "column-reverse"
case FlexDirectionRow:
return "row"
case FlexDirectionRowReverse:
return "row-reverse"
}
return "unknown"
}
// JustifyToString returns string version of Justify enum
func JustifyToString(value Justify) string {
switch value {
case JustifyFlexStart:
return "flex-start"
case JustifyCenter:
return "center"
case JustifyFlexEnd:
return "flex-end"
case JustifySpaceBetween:
return "space-between"
case JustifySpaceAround:
return "space-around"
}
return "unknown"
}
// LogLevelToString returns string version of LogLevel enum
func LogLevelToString(value LogLevel) string {
switch value {
case LogLevelError:
return "error"
case LogLevelWarn:
return "warn"
case LogLevelInfo:
return "info"
case LogLevelDebug:
return "debug"
case LogLevelVerbose:
return "verbose"
case LogLevelFatal:
return "fatal"
}
return "unknown"
}
// MeasureModeToString returns string version of MeasureMode enum
func MeasureModeToString(value MeasureMode) string {
switch value {
case MeasureModeUndefined:
return "undefined"
case MeasureModeExactly:
return "exactly"
case MeasureModeAtMost:
return "at-most"
}
return "unknown"
}
// NodeTypeToString returns string version of NodeType enum
func NodeTypeToString(value NodeType) string {
switch value {
case NodeTypeDefault:
return "default"
case NodeTypeText:
return "text"
}
return "unknown"
}
// OverflowToString returns string version of Overflow enum
func OverflowToString(value Overflow) string {
switch value {
case OverflowVisible:
return "visible"
case OverflowHidden:
return "hidden"
case OverflowScroll:
return "scroll"
}
return "unknown"
}
// PositionTypeToString returns string version of PositionType enum
func PositionTypeToString(value PositionType) string {
switch value {
case PositionTypeRelative:
return "relative"
case PositionTypeAbsolute:
return "absolute"
}
return "unknown"
}
// PrintOptionsToString returns string version of PrintOptions enum
func PrintOptionsToString(value PrintOptions) string {
switch value {
case PrintOptionsLayout:
return "layout"
case PrintOptionsStyle:
return "style"
case PrintOptionsChildren:
return "children"
}
return "unknown"
}
// UnitToString returns string version of Unit enum
func UnitToString(value Unit) string {
switch value {
case UnitUndefined:
return "undefined"
case UnitPoint:
return "point"
case UnitPercent:
return "percent"
case UnitAuto:
return "auto"
}
return "unknown"
}
// WrapToString returns string version of Wrap enum
func WrapToString(value Wrap) string {
switch value {
case WrapNoWrap:
return "no-wrap"
case WrapWrap:
return "wrap"
case WrapWrapReverse:
return "wrap-reverse"
}
return "unknown"
}