2019-06-06 19:36:56 -07:00
|
|
|
/*
|
2021-12-30 15:08:43 -08:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2017-04-03 09:34:42 -07:00
|
|
|
*
|
2019-10-15 10:30:08 -07:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-04-03 09:34:42 -07:00
|
|
|
*/
|
2019-10-15 10:30:08 -07:00
|
|
|
|
2022-09-29 22:25:24 -07:00
|
|
|
// @generated by enums.py
|
2023-09-14 23:06:34 -07:00
|
|
|
// clang-format off
|
2023-05-04 00:41:12 -07:00
|
|
|
#include <yoga/YGEnums.h>
|
2017-04-03 09:34:42 -07:00
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGAlignToString(const YGAlign value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGAlignAuto:
|
|
|
|
return "auto";
|
|
|
|
case YGAlignFlexStart:
|
|
|
|
return "flex-start";
|
|
|
|
case YGAlignCenter:
|
|
|
|
return "center";
|
|
|
|
case YGAlignFlexEnd:
|
|
|
|
return "flex-end";
|
|
|
|
case YGAlignStretch:
|
|
|
|
return "stretch";
|
|
|
|
case YGAlignBaseline:
|
|
|
|
return "baseline";
|
|
|
|
case YGAlignSpaceBetween:
|
|
|
|
return "space-between";
|
|
|
|
case YGAlignSpaceAround:
|
|
|
|
return "space-around";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGDimensionToString(const YGDimension value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGDimensionWidth:
|
|
|
|
return "width";
|
|
|
|
case YGDimensionHeight:
|
|
|
|
return "height";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGDirectionToString(const YGDirection value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGDirectionInherit:
|
|
|
|
return "inherit";
|
|
|
|
case YGDirectionLTR:
|
|
|
|
return "ltr";
|
|
|
|
case YGDirectionRTL:
|
|
|
|
return "rtl";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGDisplayToString(const YGDisplay value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGDisplayFlex:
|
|
|
|
return "flex";
|
|
|
|
case YGDisplayNone:
|
|
|
|
return "none";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGEdgeToString(const YGEdge value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGEdgeLeft:
|
|
|
|
return "left";
|
|
|
|
case YGEdgeTop:
|
|
|
|
return "top";
|
|
|
|
case YGEdgeRight:
|
|
|
|
return "right";
|
|
|
|
case YGEdgeBottom:
|
|
|
|
return "bottom";
|
|
|
|
case YGEdgeStart:
|
|
|
|
return "start";
|
|
|
|
case YGEdgeEnd:
|
|
|
|
return "end";
|
|
|
|
case YGEdgeHorizontal:
|
|
|
|
return "horizontal";
|
|
|
|
case YGEdgeVertical:
|
|
|
|
return "vertical";
|
|
|
|
case YGEdgeAll:
|
|
|
|
return "all";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2023-04-27 03:15:14 -07:00
|
|
|
const char* YGErrataToString(const YGErrata value) {
|
|
|
|
switch (value) {
|
|
|
|
case YGErrataNone:
|
|
|
|
return "none";
|
|
|
|
case YGErrataStretchFlexBasis:
|
|
|
|
return "stretch-flex-basis";
|
|
|
|
case YGErrataAll:
|
|
|
|
return "all";
|
|
|
|
case YGErrataClassic:
|
|
|
|
return "classic";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGExperimentalFeatureToString(const YGExperimentalFeature value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGExperimentalFeatureWebFlexBasis:
|
|
|
|
return "web-flex-basis";
|
2023-01-08 13:41:27 -08:00
|
|
|
case YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge:
|
|
|
|
return "absolute-percentage-against-padding-edge";
|
2017-04-03 09:34:42 -07:00
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGFlexDirectionToString(const YGFlexDirection value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGFlexDirectionColumn:
|
|
|
|
return "column";
|
|
|
|
case YGFlexDirectionColumnReverse:
|
|
|
|
return "column-reverse";
|
|
|
|
case YGFlexDirectionRow:
|
|
|
|
return "row";
|
|
|
|
case YGFlexDirectionRowReverse:
|
|
|
|
return "row-reverse";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
Add YGGutter Enum
Summary:
This adds the YGGutter enum, used to choose between row/column gap variants (row-gap, column-gap, gap).
This used later in changes from https://github.com/facebook/yoga/pull/1116, in the APIs which deal with setting gap on style on yoga node.
Note the original PR called this `YGGap`, but this ending up leading to a couple public method signatures that could appear ambiguous:
1. `SetGap(YGGap gap, float gapLength)`: Enums like `YGAlign` are the vaues for an `align` prop. `YGGap` controls the variant of the gap (like `YGEdge` does for left/right/top/bottom variants). So the enum reads as if it is the `gapValue`, and it looks like we have two of the same parameter.
2. `SetGap(YGGap gapDirection, float gap)`: This is misleading, because the direction gaps flow is the cross-axis of flex-direction.
3. `GetGap(YGGap gap)`: `gap` is the variant, but looks like an out param.
The [CSS Box Alignment](https://www.w3.org/TR/css-align-3/#column-row-gap) spec refers to these gaps as "Gutters", which removes the ambiguity.
Changelog:
[General][Added] - Add YGGutter Enum
Reviewed By: yungsters
Differential Revision: D39922412
fbshipit-source-id: 4b0baf800fecb3d03560a4267c7fb4c4330fd39e
2022-09-29 22:25:24 -07:00
|
|
|
const char* YGGutterToString(const YGGutter value) {
|
|
|
|
switch (value) {
|
|
|
|
case YGGutterColumn:
|
|
|
|
return "column";
|
|
|
|
case YGGutterRow:
|
|
|
|
return "row";
|
|
|
|
case YGGutterAll:
|
|
|
|
return "all";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGJustifyToString(const YGJustify value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGJustifyFlexStart:
|
|
|
|
return "flex-start";
|
|
|
|
case YGJustifyCenter:
|
|
|
|
return "center";
|
|
|
|
case YGJustifyFlexEnd:
|
|
|
|
return "flex-end";
|
|
|
|
case YGJustifySpaceBetween:
|
|
|
|
return "space-between";
|
|
|
|
case YGJustifySpaceAround:
|
|
|
|
return "space-around";
|
2017-11-27 03:40:01 -08:00
|
|
|
case YGJustifySpaceEvenly:
|
|
|
|
return "space-evenly";
|
2017-04-03 09:34:42 -07:00
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGLogLevelToString(const YGLogLevel value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGLogLevelError:
|
|
|
|
return "error";
|
|
|
|
case YGLogLevelWarn:
|
|
|
|
return "warn";
|
|
|
|
case YGLogLevelInfo:
|
|
|
|
return "info";
|
|
|
|
case YGLogLevelDebug:
|
|
|
|
return "debug";
|
|
|
|
case YGLogLevelVerbose:
|
|
|
|
return "verbose";
|
2017-05-03 09:22:35 -07:00
|
|
|
case YGLogLevelFatal:
|
|
|
|
return "fatal";
|
2017-04-03 09:34:42 -07:00
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGMeasureModeToString(const YGMeasureMode value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGMeasureModeUndefined:
|
|
|
|
return "undefined";
|
|
|
|
case YGMeasureModeExactly:
|
|
|
|
return "exactly";
|
|
|
|
case YGMeasureModeAtMost:
|
|
|
|
return "at-most";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGNodeTypeToString(const YGNodeType value) {
|
|
|
|
switch (value) {
|
2017-05-11 08:09:30 -07:00
|
|
|
case YGNodeTypeDefault:
|
|
|
|
return "default";
|
|
|
|
case YGNodeTypeText:
|
|
|
|
return "text";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGOverflowToString(const YGOverflow value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGOverflowVisible:
|
|
|
|
return "visible";
|
|
|
|
case YGOverflowHidden:
|
|
|
|
return "hidden";
|
|
|
|
case YGOverflowScroll:
|
|
|
|
return "scroll";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGPositionTypeToString(const YGPositionType value) {
|
|
|
|
switch (value) {
|
2020-07-20 00:31:15 -07:00
|
|
|
case YGPositionTypeStatic:
|
|
|
|
return "static";
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGPositionTypeRelative:
|
|
|
|
return "relative";
|
|
|
|
case YGPositionTypeAbsolute:
|
|
|
|
return "absolute";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGPrintOptionsToString(const YGPrintOptions value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGPrintOptionsLayout:
|
|
|
|
return "layout";
|
|
|
|
case YGPrintOptionsStyle:
|
|
|
|
return "style";
|
|
|
|
case YGPrintOptionsChildren:
|
|
|
|
return "children";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGUnitToString(const YGUnit value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGUnitUndefined:
|
|
|
|
return "undefined";
|
|
|
|
case YGUnitPoint:
|
|
|
|
return "point";
|
|
|
|
case YGUnitPercent:
|
|
|
|
return "percent";
|
|
|
|
case YGUnitAuto:
|
|
|
|
return "auto";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2019-01-08 12:47:53 -08:00
|
|
|
const char* YGWrapToString(const YGWrap value) {
|
|
|
|
switch (value) {
|
2017-04-03 09:34:42 -07:00
|
|
|
case YGWrapNoWrap:
|
|
|
|
return "no-wrap";
|
|
|
|
case YGWrapWrap:
|
|
|
|
return "wrap";
|
|
|
|
case YGWrapWrapReverse:
|
|
|
|
return "wrap-reverse";
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|