diff --git a/.clang-format-ignore b/.clang-format-ignore deleted file mode 100644 index 51430a06..00000000 --- a/.clang-format-ignore +++ /dev/null @@ -1 +0,0 @@ -^lib/.* diff --git a/enums.py b/enums.py index 0ae51722..d12c3d5f 100755 --- a/enums.py +++ b/enums.py @@ -4,6 +4,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +import math import os ENUMS = { @@ -88,7 +89,7 @@ def get_license(ext): */ // @{"generated"} by enums.py - +{"// clang-format off" if ext == "cpp" else ""} """ @@ -121,7 +122,6 @@ with open(root + "/yoga/YGEnums.h", "w") as f: f.write(get_license("cpp")) f.write("#pragma once\n") f.write("#include \n\n") - f.write("// clang-format off\n\n\n") f.write("YG_EXTERN_C_BEGIN\n\n") items = sorted(ENUMS.items()) @@ -146,6 +146,49 @@ with open(root + "/yoga/YGEnums.h", "w") as f: f.write("\n") f.write("YG_EXTERN_C_END\n") +# Write out C++ scoped enums +for name, values in sorted(ENUMS.items()): + with open(f"{root}/yoga/enums/{name}.h", "w") as f: + f.write(get_license("cpp")) + f.write("#pragma once\n\n") + + f.write("#include \n") + f.write("#include \n") + f.write("#include \n\n") + + f.write("namespace facebook::yoga {\n\n") + + width = "uint32_t" if name in BITSET_ENUMS else "uint8_t" + f.write(f"enum class {name} : {width} {{\n") + for value in values: + ordinal = value[0] if isinstance(value, tuple) else value + f.write(f" {ordinal} = YG{name}{ordinal},\n") + f.write("};\n\n") + + f.write("template <>\n") + f.write(f"constexpr inline int32_t ordinalCount<{name}>() {{\n") + f.write(f" return {len(values)};\n") + f.write("} \n\n") + + f.write("template <>\n") + f.write(f"constexpr inline int32_t bitCount<{name}>() {{\n") + f.write(f" return {math.ceil(math.log(len(values), 2))};\n") + f.write("} \n\n") + + f.write(f"constexpr inline {name} scopedEnum(YG{name} unscoped) {{\n") + f.write(f" return static_cast<{name}>(unscoped);\n") + f.write("}\n\n") + + f.write(f"constexpr inline YG{name} unscopedEnum({name} scoped) {{\n") + f.write(f" return static_cast(scoped);\n") + f.write("}\n\n") + + f.write(f"inline const char* toString({name} e) {{\n") + f.write(f" return YG{name}ToString(unscopedEnum(e));\n") + f.write("}\n\n") + + f.write("} // namespace facebook::yoga\n") + # write out C body for printing with open(root + "/yoga/YGEnums.cpp", "w") as f: f.write(get_license("cpp")) diff --git a/yoga/YGEnums.cpp b/yoga/YGEnums.cpp index f7220eff..a7b1990e 100644 --- a/yoga/YGEnums.cpp +++ b/yoga/YGEnums.cpp @@ -6,7 +6,7 @@ */ // @generated by enums.py - +// clang-format off #include const char* YGAlignToString(const YGAlign value) { diff --git a/yoga/YGEnums.h b/yoga/YGEnums.h index 7abe5d92..53d24531 100644 --- a/yoga/YGEnums.h +++ b/yoga/YGEnums.h @@ -6,13 +6,10 @@ */ // @generated by enums.py - +// clang-format off #pragma once #include -// clang-format off - - YG_EXTERN_C_BEGIN YG_ENUM_SEQ_DECL( diff --git a/yoga/enums/Align.h b/yoga/enums/Align.h new file mode 100644 index 00000000..95df12a7 --- /dev/null +++ b/yoga/enums/Align.h @@ -0,0 +1,51 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class Align : uint8_t { + Auto = YGAlignAuto, + FlexStart = YGAlignFlexStart, + Center = YGAlignCenter, + FlexEnd = YGAlignFlexEnd, + Stretch = YGAlignStretch, + Baseline = YGAlignBaseline, + SpaceBetween = YGAlignSpaceBetween, + SpaceAround = YGAlignSpaceAround, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 8; +} + +template <> +constexpr inline int32_t bitCount() { + return 3; +} + +constexpr inline Align scopedEnum(YGAlign unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGAlign unscopedEnum(Align scoped) { + return static_cast(scoped); +} + +inline const char* toString(Align e) { + return YGAlignToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/Dimension.h b/yoga/enums/Dimension.h new file mode 100644 index 00000000..2274a980 --- /dev/null +++ b/yoga/enums/Dimension.h @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class Dimension : uint8_t { + Width = YGDimensionWidth, + Height = YGDimensionHeight, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 2; +} + +template <> +constexpr inline int32_t bitCount() { + return 1; +} + +constexpr inline Dimension scopedEnum(YGDimension unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGDimension unscopedEnum(Dimension scoped) { + return static_cast(scoped); +} + +inline const char* toString(Dimension e) { + return YGDimensionToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/Direction.h b/yoga/enums/Direction.h new file mode 100644 index 00000000..1b5e19c9 --- /dev/null +++ b/yoga/enums/Direction.h @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class Direction : uint8_t { + Inherit = YGDirectionInherit, + LTR = YGDirectionLTR, + RTL = YGDirectionRTL, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 3; +} + +template <> +constexpr inline int32_t bitCount() { + return 2; +} + +constexpr inline Direction scopedEnum(YGDirection unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGDirection unscopedEnum(Direction scoped) { + return static_cast(scoped); +} + +inline const char* toString(Direction e) { + return YGDirectionToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/Display.h b/yoga/enums/Display.h new file mode 100644 index 00000000..c1d8c7a8 --- /dev/null +++ b/yoga/enums/Display.h @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class Display : uint8_t { + Flex = YGDisplayFlex, + None = YGDisplayNone, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 2; +} + +template <> +constexpr inline int32_t bitCount() { + return 1; +} + +constexpr inline Display scopedEnum(YGDisplay unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGDisplay unscopedEnum(Display scoped) { + return static_cast(scoped); +} + +inline const char* toString(Display e) { + return YGDisplayToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/Edge.h b/yoga/enums/Edge.h new file mode 100644 index 00000000..d6d2b0ee --- /dev/null +++ b/yoga/enums/Edge.h @@ -0,0 +1,52 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class Edge : uint8_t { + Left = YGEdgeLeft, + Top = YGEdgeTop, + Right = YGEdgeRight, + Bottom = YGEdgeBottom, + Start = YGEdgeStart, + End = YGEdgeEnd, + Horizontal = YGEdgeHorizontal, + Vertical = YGEdgeVertical, + All = YGEdgeAll, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 9; +} + +template <> +constexpr inline int32_t bitCount() { + return 4; +} + +constexpr inline Edge scopedEnum(YGEdge unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGEdge unscopedEnum(Edge scoped) { + return static_cast(scoped); +} + +inline const char* toString(Edge e) { + return YGEdgeToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/Errata.h b/yoga/enums/Errata.h new file mode 100644 index 00000000..a96b2967 --- /dev/null +++ b/yoga/enums/Errata.h @@ -0,0 +1,47 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class Errata : uint32_t { + None = YGErrataNone, + StretchFlexBasis = YGErrataStretchFlexBasis, + All = YGErrataAll, + Classic = YGErrataClassic, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 4; +} + +template <> +constexpr inline int32_t bitCount() { + return 2; +} + +constexpr inline Errata scopedEnum(YGErrata unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGErrata unscopedEnum(Errata scoped) { + return static_cast(scoped); +} + +inline const char* toString(Errata e) { + return YGErrataToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/ExperimentalFeature.h b/yoga/enums/ExperimentalFeature.h new file mode 100644 index 00000000..6ed35815 --- /dev/null +++ b/yoga/enums/ExperimentalFeature.h @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class ExperimentalFeature : uint8_t { + WebFlexBasis = YGExperimentalFeatureWebFlexBasis, + AbsolutePercentageAgainstPaddingEdge = YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 2; +} + +template <> +constexpr inline int32_t bitCount() { + return 1; +} + +constexpr inline ExperimentalFeature scopedEnum(YGExperimentalFeature unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGExperimentalFeature unscopedEnum(ExperimentalFeature scoped) { + return static_cast(scoped); +} + +inline const char* toString(ExperimentalFeature e) { + return YGExperimentalFeatureToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/FlexDirection.h b/yoga/enums/FlexDirection.h new file mode 100644 index 00000000..45f6497c --- /dev/null +++ b/yoga/enums/FlexDirection.h @@ -0,0 +1,47 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class FlexDirection : uint8_t { + Column = YGFlexDirectionColumn, + ColumnReverse = YGFlexDirectionColumnReverse, + Row = YGFlexDirectionRow, + RowReverse = YGFlexDirectionRowReverse, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 4; +} + +template <> +constexpr inline int32_t bitCount() { + return 2; +} + +constexpr inline FlexDirection scopedEnum(YGFlexDirection unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGFlexDirection unscopedEnum(FlexDirection scoped) { + return static_cast(scoped); +} + +inline const char* toString(FlexDirection e) { + return YGFlexDirectionToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/Gutter.h b/yoga/enums/Gutter.h new file mode 100644 index 00000000..5c0f4a25 --- /dev/null +++ b/yoga/enums/Gutter.h @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class Gutter : uint8_t { + Column = YGGutterColumn, + Row = YGGutterRow, + All = YGGutterAll, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 3; +} + +template <> +constexpr inline int32_t bitCount() { + return 2; +} + +constexpr inline Gutter scopedEnum(YGGutter unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGGutter unscopedEnum(Gutter scoped) { + return static_cast(scoped); +} + +inline const char* toString(Gutter e) { + return YGGutterToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/Justify.h b/yoga/enums/Justify.h new file mode 100644 index 00000000..870a3cb2 --- /dev/null +++ b/yoga/enums/Justify.h @@ -0,0 +1,49 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class Justify : uint8_t { + FlexStart = YGJustifyFlexStart, + Center = YGJustifyCenter, + FlexEnd = YGJustifyFlexEnd, + SpaceBetween = YGJustifySpaceBetween, + SpaceAround = YGJustifySpaceAround, + SpaceEvenly = YGJustifySpaceEvenly, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 6; +} + +template <> +constexpr inline int32_t bitCount() { + return 3; +} + +constexpr inline Justify scopedEnum(YGJustify unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGJustify unscopedEnum(Justify scoped) { + return static_cast(scoped); +} + +inline const char* toString(Justify e) { + return YGJustifyToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/LogLevel.h b/yoga/enums/LogLevel.h new file mode 100644 index 00000000..45cac9fe --- /dev/null +++ b/yoga/enums/LogLevel.h @@ -0,0 +1,49 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class LogLevel : uint8_t { + Error = YGLogLevelError, + Warn = YGLogLevelWarn, + Info = YGLogLevelInfo, + Debug = YGLogLevelDebug, + Verbose = YGLogLevelVerbose, + Fatal = YGLogLevelFatal, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 6; +} + +template <> +constexpr inline int32_t bitCount() { + return 3; +} + +constexpr inline LogLevel scopedEnum(YGLogLevel unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGLogLevel unscopedEnum(LogLevel scoped) { + return static_cast(scoped); +} + +inline const char* toString(LogLevel e) { + return YGLogLevelToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/MeasureMode.h b/yoga/enums/MeasureMode.h new file mode 100644 index 00000000..80fbcc59 --- /dev/null +++ b/yoga/enums/MeasureMode.h @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class MeasureMode : uint8_t { + Undefined = YGMeasureModeUndefined, + Exactly = YGMeasureModeExactly, + AtMost = YGMeasureModeAtMost, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 3; +} + +template <> +constexpr inline int32_t bitCount() { + return 2; +} + +constexpr inline MeasureMode scopedEnum(YGMeasureMode unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGMeasureMode unscopedEnum(MeasureMode scoped) { + return static_cast(scoped); +} + +inline const char* toString(MeasureMode e) { + return YGMeasureModeToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/NodeType.h b/yoga/enums/NodeType.h new file mode 100644 index 00000000..782b163c --- /dev/null +++ b/yoga/enums/NodeType.h @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class NodeType : uint8_t { + Default = YGNodeTypeDefault, + Text = YGNodeTypeText, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 2; +} + +template <> +constexpr inline int32_t bitCount() { + return 1; +} + +constexpr inline NodeType scopedEnum(YGNodeType unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGNodeType unscopedEnum(NodeType scoped) { + return static_cast(scoped); +} + +inline const char* toString(NodeType e) { + return YGNodeTypeToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/Overflow.h b/yoga/enums/Overflow.h new file mode 100644 index 00000000..1d29103e --- /dev/null +++ b/yoga/enums/Overflow.h @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class Overflow : uint8_t { + Visible = YGOverflowVisible, + Hidden = YGOverflowHidden, + Scroll = YGOverflowScroll, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 3; +} + +template <> +constexpr inline int32_t bitCount() { + return 2; +} + +constexpr inline Overflow scopedEnum(YGOverflow unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGOverflow unscopedEnum(Overflow scoped) { + return static_cast(scoped); +} + +inline const char* toString(Overflow e) { + return YGOverflowToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/PositionType.h b/yoga/enums/PositionType.h new file mode 100644 index 00000000..bde2b189 --- /dev/null +++ b/yoga/enums/PositionType.h @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class PositionType : uint8_t { + Static = YGPositionTypeStatic, + Relative = YGPositionTypeRelative, + Absolute = YGPositionTypeAbsolute, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 3; +} + +template <> +constexpr inline int32_t bitCount() { + return 2; +} + +constexpr inline PositionType scopedEnum(YGPositionType unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGPositionType unscopedEnum(PositionType scoped) { + return static_cast(scoped); +} + +inline const char* toString(PositionType e) { + return YGPositionTypeToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/PrintOptions.h b/yoga/enums/PrintOptions.h new file mode 100644 index 00000000..603c91aa --- /dev/null +++ b/yoga/enums/PrintOptions.h @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class PrintOptions : uint32_t { + Layout = YGPrintOptionsLayout, + Style = YGPrintOptionsStyle, + Children = YGPrintOptionsChildren, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 3; +} + +template <> +constexpr inline int32_t bitCount() { + return 2; +} + +constexpr inline PrintOptions scopedEnum(YGPrintOptions unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGPrintOptions unscopedEnum(PrintOptions scoped) { + return static_cast(scoped); +} + +inline const char* toString(PrintOptions e) { + return YGPrintOptionsToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/Unit.h b/yoga/enums/Unit.h new file mode 100644 index 00000000..36efe95a --- /dev/null +++ b/yoga/enums/Unit.h @@ -0,0 +1,47 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class Unit : uint8_t { + Undefined = YGUnitUndefined, + Point = YGUnitPoint, + Percent = YGUnitPercent, + Auto = YGUnitAuto, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 4; +} + +template <> +constexpr inline int32_t bitCount() { + return 2; +} + +constexpr inline Unit scopedEnum(YGUnit unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGUnit unscopedEnum(Unit scoped) { + return static_cast(scoped); +} + +inline const char* toString(Unit e) { + return YGUnitToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/Wrap.h b/yoga/enums/Wrap.h new file mode 100644 index 00000000..ae380a44 --- /dev/null +++ b/yoga/enums/Wrap.h @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// @generated by enums.py +// clang-format off +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +enum class Wrap : uint8_t { + NoWrap = YGWrapNoWrap, + Wrap = YGWrapWrap, + WrapReverse = YGWrapWrapReverse, +}; + +template <> +constexpr inline int32_t ordinalCount() { + return 3; +} + +template <> +constexpr inline int32_t bitCount() { + return 2; +} + +constexpr inline Wrap scopedEnum(YGWrap unscoped) { + return static_cast(unscoped); +} + +constexpr inline YGWrap unscopedEnum(Wrap scoped) { + return static_cast(scoped); +} + +inline const char* toString(Wrap e) { + return YGWrapToString(unscopedEnum(e)); +} + +} // namespace facebook::yoga diff --git a/yoga/enums/YogaEnums.h b/yoga/enums/YogaEnums.h new file mode 100644 index 00000000..cc7223bf --- /dev/null +++ b/yoga/enums/YogaEnums.h @@ -0,0 +1,18 @@ +/* + * 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 + +namespace facebook::yoga { + +template +constexpr inline int32_t ordinalCount() = delete; + +template +constexpr inline int32_t bitCount() = delete; + +} // namespace facebook::yoga