1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (c) Meta Platforms, Inc. and affiliates.
3//
4// SPDX-License-Identifier: MIT
5
6#include <yoga/YGEnums.h>
7
8USE_QT_YOGA_NAMESPACE
9
10const char* YGAlignToString(const YGAlign value) {
11 switch (value) {
12 case YGAlignAuto:
13 return "auto";
14 case YGAlignFlexStart:
15 return "flex-start";
16 case YGAlignCenter:
17 return "center";
18 case YGAlignFlexEnd:
19 return "flex-end";
20 case YGAlignStretch:
21 return "stretch";
22 case YGAlignBaseline:
23 return "baseline";
24 case YGAlignSpaceBetween:
25 return "space-between";
26 case YGAlignSpaceAround:
27 return "space-around";
28 }
29 return "unknown";
30}
31
32const char* YGDimensionToString(const YGDimension value) {
33 switch (value) {
34 case YGDimensionWidth:
35 return "width";
36 case YGDimensionHeight:
37 return "height";
38 }
39 return "unknown";
40}
41
42const char* YGDirectionToString(const YGDirection value) {
43 switch (value) {
44 case YGDirectionInherit:
45 return "inherit";
46 case YGDirectionLTR:
47 return "ltr";
48 case YGDirectionRTL:
49 return "rtl";
50 }
51 return "unknown";
52}
53
54const char* YGDisplayToString(const YGDisplay value) {
55 switch (value) {
56 case YGDisplayFlex:
57 return "flex";
58 case YGDisplayNone:
59 return "none";
60 }
61 return "unknown";
62}
63
64const char* YGEdgeToString(const YGEdge value) {
65 switch (value) {
66 case YGEdgeLeft:
67 return "left";
68 case YGEdgeTop:
69 return "top";
70 case YGEdgeRight:
71 return "right";
72 case YGEdgeBottom:
73 return "bottom";
74 case YGEdgeStart:
75 return "start";
76 case YGEdgeEnd:
77 return "end";
78 case YGEdgeHorizontal:
79 return "horizontal";
80 case YGEdgeVertical:
81 return "vertical";
82 case YGEdgeAll:
83 return "all";
84 }
85 return "unknown";
86}
87
88const char* YGErrataToString(const YGErrata value) {
89 switch (value) {
90 case YGErrataNone:
91 return "none";
92 case YGErrataStretchFlexBasis:
93 return "stretch-flex-basis";
94 case YGErrataAll:
95 return "all";
96 case YGErrataClassic:
97 return "classic";
98 }
99 return "unknown";
100}
101
102const char* YGExperimentalFeatureToString(const YGExperimentalFeature value) {
103 switch (value) {
104 case YGExperimentalFeatureWebFlexBasis:
105 return "web-flex-basis";
106 case YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge:
107 return "absolute-percentage-against-padding-edge";
108 case YGExperimentalFeatureFixJNILocalRefOverflows:
109 return "fix-jnilocal-ref-overflows";
110 }
111 return "unknown";
112}
113
114const char* YGFlexDirectionToString(const YGFlexDirection value) {
115 switch (value) {
116 case YGFlexDirectionColumn:
117 return "column";
118 case YGFlexDirectionColumnReverse:
119 return "column-reverse";
120 case YGFlexDirectionRow:
121 return "row";
122 case YGFlexDirectionRowReverse:
123 return "row-reverse";
124 }
125 return "unknown";
126}
127
128const char* YGGutterToString(const YGGutter value) {
129 switch (value) {
130 case YGGutterColumn:
131 return "column";
132 case YGGutterRow:
133 return "row";
134 case YGGutterAll:
135 return "all";
136 }
137 return "unknown";
138}
139
140const char* YGJustifyToString(const YGJustify value) {
141 switch (value) {
142 case YGJustifyFlexStart:
143 return "flex-start";
144 case YGJustifyCenter:
145 return "center";
146 case YGJustifyFlexEnd:
147 return "flex-end";
148 case YGJustifySpaceBetween:
149 return "space-between";
150 case YGJustifySpaceAround:
151 return "space-around";
152 case YGJustifySpaceEvenly:
153 return "space-evenly";
154 }
155 return "unknown";
156}
157
158const char* YGLogLevelToString(const YGLogLevel value) {
159 switch (value) {
160 case YGLogLevelError:
161 return "error";
162 case YGLogLevelWarn:
163 return "warn";
164 case YGLogLevelInfo:
165 return "info";
166 case YGLogLevelDebug:
167 return "debug";
168 case YGLogLevelVerbose:
169 return "verbose";
170 case YGLogLevelFatal:
171 return "fatal";
172 }
173 return "unknown";
174}
175
176const char* YGMeasureModeToString(const YGMeasureMode value) {
177 switch (value) {
178 case YGMeasureModeUndefined:
179 return "undefined";
180 case YGMeasureModeExactly:
181 return "exactly";
182 case YGMeasureModeAtMost:
183 return "at-most";
184 }
185 return "unknown";
186}
187
188const char* YGNodeTypeToString(const YGNodeType value) {
189 switch (value) {
190 case YGNodeTypeDefault:
191 return "default";
192 case YGNodeTypeText:
193 return "text";
194 }
195 return "unknown";
196}
197
198const char* YGOverflowToString(const YGOverflow value) {
199 switch (value) {
200 case YGOverflowVisible:
201 return "visible";
202 case YGOverflowHidden:
203 return "hidden";
204 case YGOverflowScroll:
205 return "scroll";
206 }
207 return "unknown";
208}
209
210const char* YGPositionTypeToString(const YGPositionType value) {
211 switch (value) {
212 case YGPositionTypeStatic:
213 return "static";
214 case YGPositionTypeRelative:
215 return "relative";
216 case YGPositionTypeAbsolute:
217 return "absolute";
218 }
219 return "unknown";
220}
221
222const char* YGPrintOptionsToString(const YGPrintOptions value) {
223 switch (value) {
224 case YGPrintOptionsLayout:
225 return "layout";
226 case YGPrintOptionsStyle:
227 return "style";
228 case YGPrintOptionsChildren:
229 return "children";
230 }
231 return "unknown";
232}
233
234const char* YGUnitToString(const YGUnit value) {
235 switch (value) {
236 case YGUnitUndefined:
237 return "undefined";
238 case YGUnitPoint:
239 return "point";
240 case YGUnitPercent:
241 return "percent";
242 case YGUnitAuto:
243 return "auto";
244 }
245 return "unknown";
246}
247
248const char* YGWrapToString(const YGWrap value) {
249 switch (value) {
250 case YGWrapNoWrap:
251 return "no-wrap";
252 case YGWrapWrap:
253 return "wrap";
254 case YGWrapWrapReverse:
255 return "wrap-reverse";
256 }
257 return "unknown";
258}
259

source code of qtdeclarative/src/3rdparty/yoga/YGEnums.cpp