first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class Align : uint8_t {
Auto = YGAlignAuto,
FlexStart = YGAlignFlexStart,
Center = YGAlignCenter,
FlexEnd = YGAlignFlexEnd,
Stretch = YGAlignStretch,
Baseline = YGAlignBaseline,
SpaceBetween = YGAlignSpaceBetween,
SpaceAround = YGAlignSpaceAround,
SpaceEvenly = YGAlignSpaceEvenly,
};
template <>
constexpr int32_t ordinalCount<Align>() {
return 9;
}
constexpr Align scopedEnum(YGAlign unscoped) {
return static_cast<Align>(unscoped);
}
constexpr YGAlign unscopedEnum(Align scoped) {
return static_cast<YGAlign>(scoped);
}
inline const char* toString(Align e) {
return YGAlignToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,40 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class BoxSizing : uint8_t {
BorderBox = YGBoxSizingBorderBox,
ContentBox = YGBoxSizingContentBox,
};
template <>
constexpr int32_t ordinalCount<BoxSizing>() {
return 2;
}
constexpr BoxSizing scopedEnum(YGBoxSizing unscoped) {
return static_cast<BoxSizing>(unscoped);
}
constexpr YGBoxSizing unscopedEnum(BoxSizing scoped) {
return static_cast<YGBoxSizing>(scoped);
}
inline const char* toString(BoxSizing e) {
return YGBoxSizingToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,40 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class Dimension : uint8_t {
Width = YGDimensionWidth,
Height = YGDimensionHeight,
};
template <>
constexpr int32_t ordinalCount<Dimension>() {
return 2;
}
constexpr Dimension scopedEnum(YGDimension unscoped) {
return static_cast<Dimension>(unscoped);
}
constexpr YGDimension unscopedEnum(Dimension scoped) {
return static_cast<YGDimension>(scoped);
}
inline const char* toString(Dimension e) {
return YGDimensionToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,41 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class Direction : uint8_t {
Inherit = YGDirectionInherit,
LTR = YGDirectionLTR,
RTL = YGDirectionRTL,
};
template <>
constexpr int32_t ordinalCount<Direction>() {
return 3;
}
constexpr Direction scopedEnum(YGDirection unscoped) {
return static_cast<Direction>(unscoped);
}
constexpr YGDirection unscopedEnum(Direction scoped) {
return static_cast<YGDirection>(scoped);
}
inline const char* toString(Direction e) {
return YGDirectionToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,41 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class Display : uint8_t {
Flex = YGDisplayFlex,
None = YGDisplayNone,
Contents = YGDisplayContents,
};
template <>
constexpr int32_t ordinalCount<Display>() {
return 3;
}
constexpr Display scopedEnum(YGDisplay unscoped) {
return static_cast<Display>(unscoped);
}
constexpr YGDisplay unscopedEnum(Display scoped) {
return static_cast<YGDisplay>(scoped);
}
inline const char* toString(Display e) {
return YGDisplayToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
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 int32_t ordinalCount<Edge>() {
return 9;
}
constexpr Edge scopedEnum(YGEdge unscoped) {
return static_cast<Edge>(unscoped);
}
constexpr YGEdge unscopedEnum(Edge scoped) {
return static_cast<YGEdge>(scoped);
}
inline const char* toString(Edge e) {
return YGEdgeToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,41 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class Errata : uint32_t {
None = YGErrataNone,
StretchFlexBasis = YGErrataStretchFlexBasis,
AbsolutePositionWithoutInsetsExcludesPadding = YGErrataAbsolutePositionWithoutInsetsExcludesPadding,
AbsolutePercentAgainstInnerSize = YGErrataAbsolutePercentAgainstInnerSize,
All = YGErrataAll,
Classic = YGErrataClassic,
};
YG_DEFINE_ENUM_FLAG_OPERATORS(Errata)
constexpr Errata scopedEnum(YGErrata unscoped) {
return static_cast<Errata>(unscoped);
}
constexpr YGErrata unscopedEnum(Errata scoped) {
return static_cast<YGErrata>(scoped);
}
inline const char* toString(Errata e) {
return YGErrataToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,39 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class ExperimentalFeature : uint8_t {
WebFlexBasis = YGExperimentalFeatureWebFlexBasis,
};
template <>
constexpr int32_t ordinalCount<ExperimentalFeature>() {
return 1;
}
constexpr ExperimentalFeature scopedEnum(YGExperimentalFeature unscoped) {
return static_cast<ExperimentalFeature>(unscoped);
}
constexpr YGExperimentalFeature unscopedEnum(ExperimentalFeature scoped) {
return static_cast<YGExperimentalFeature>(scoped);
}
inline const char* toString(ExperimentalFeature e) {
return YGExperimentalFeatureToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,42 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class FlexDirection : uint8_t {
Column = YGFlexDirectionColumn,
ColumnReverse = YGFlexDirectionColumnReverse,
Row = YGFlexDirectionRow,
RowReverse = YGFlexDirectionRowReverse,
};
template <>
constexpr int32_t ordinalCount<FlexDirection>() {
return 4;
}
constexpr FlexDirection scopedEnum(YGFlexDirection unscoped) {
return static_cast<FlexDirection>(unscoped);
}
constexpr YGFlexDirection unscopedEnum(FlexDirection scoped) {
return static_cast<YGFlexDirection>(scoped);
}
inline const char* toString(FlexDirection e) {
return YGFlexDirectionToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,41 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class Gutter : uint8_t {
Column = YGGutterColumn,
Row = YGGutterRow,
All = YGGutterAll,
};
template <>
constexpr int32_t ordinalCount<Gutter>() {
return 3;
}
constexpr Gutter scopedEnum(YGGutter unscoped) {
return static_cast<Gutter>(unscoped);
}
constexpr YGGutter unscopedEnum(Gutter scoped) {
return static_cast<YGGutter>(scoped);
}
inline const char* toString(Gutter e) {
return YGGutterToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,44 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class Justify : uint8_t {
FlexStart = YGJustifyFlexStart,
Center = YGJustifyCenter,
FlexEnd = YGJustifyFlexEnd,
SpaceBetween = YGJustifySpaceBetween,
SpaceAround = YGJustifySpaceAround,
SpaceEvenly = YGJustifySpaceEvenly,
};
template <>
constexpr int32_t ordinalCount<Justify>() {
return 6;
}
constexpr Justify scopedEnum(YGJustify unscoped) {
return static_cast<Justify>(unscoped);
}
constexpr YGJustify unscopedEnum(Justify scoped) {
return static_cast<YGJustify>(scoped);
}
inline const char* toString(Justify e) {
return YGJustifyToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,44 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class LogLevel : uint8_t {
Error = YGLogLevelError,
Warn = YGLogLevelWarn,
Info = YGLogLevelInfo,
Debug = YGLogLevelDebug,
Verbose = YGLogLevelVerbose,
Fatal = YGLogLevelFatal,
};
template <>
constexpr int32_t ordinalCount<LogLevel>() {
return 6;
}
constexpr LogLevel scopedEnum(YGLogLevel unscoped) {
return static_cast<LogLevel>(unscoped);
}
constexpr YGLogLevel unscopedEnum(LogLevel scoped) {
return static_cast<YGLogLevel>(scoped);
}
inline const char* toString(LogLevel e) {
return YGLogLevelToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,41 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class MeasureMode : uint8_t {
Undefined = YGMeasureModeUndefined,
Exactly = YGMeasureModeExactly,
AtMost = YGMeasureModeAtMost,
};
template <>
constexpr int32_t ordinalCount<MeasureMode>() {
return 3;
}
constexpr MeasureMode scopedEnum(YGMeasureMode unscoped) {
return static_cast<MeasureMode>(unscoped);
}
constexpr YGMeasureMode unscopedEnum(MeasureMode scoped) {
return static_cast<YGMeasureMode>(scoped);
}
inline const char* toString(MeasureMode e) {
return YGMeasureModeToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,40 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class NodeType : uint8_t {
Default = YGNodeTypeDefault,
Text = YGNodeTypeText,
};
template <>
constexpr int32_t ordinalCount<NodeType>() {
return 2;
}
constexpr NodeType scopedEnum(YGNodeType unscoped) {
return static_cast<NodeType>(unscoped);
}
constexpr YGNodeType unscopedEnum(NodeType scoped) {
return static_cast<YGNodeType>(scoped);
}
inline const char* toString(NodeType e) {
return YGNodeTypeToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,41 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class Overflow : uint8_t {
Visible = YGOverflowVisible,
Hidden = YGOverflowHidden,
Scroll = YGOverflowScroll,
};
template <>
constexpr int32_t ordinalCount<Overflow>() {
return 3;
}
constexpr Overflow scopedEnum(YGOverflow unscoped) {
return static_cast<Overflow>(unscoped);
}
constexpr YGOverflow unscopedEnum(Overflow scoped) {
return static_cast<YGOverflow>(scoped);
}
inline const char* toString(Overflow e) {
return YGOverflowToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,21 @@
/*
* 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 <yoga/enums/Edge.h>
namespace facebook::yoga {
enum class PhysicalEdge : uint32_t {
Left = yoga::to_underlying(Edge::Left),
Top = yoga::to_underlying(Edge::Top),
Right = yoga::to_underlying(Edge::Right),
Bottom = yoga::to_underlying(Edge::Bottom),
};
} // namespace facebook::yoga

View File

@@ -0,0 +1,41 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class PositionType : uint8_t {
Static = YGPositionTypeStatic,
Relative = YGPositionTypeRelative,
Absolute = YGPositionTypeAbsolute,
};
template <>
constexpr int32_t ordinalCount<PositionType>() {
return 3;
}
constexpr PositionType scopedEnum(YGPositionType unscoped) {
return static_cast<PositionType>(unscoped);
}
constexpr YGPositionType unscopedEnum(PositionType scoped) {
return static_cast<YGPositionType>(scoped);
}
inline const char* toString(PositionType e) {
return YGPositionTypeToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class Unit : uint8_t {
Undefined = YGUnitUndefined,
Point = YGUnitPoint,
Percent = YGUnitPercent,
Auto = YGUnitAuto,
MaxContent = YGUnitMaxContent,
FitContent = YGUnitFitContent,
Stretch = YGUnitStretch,
};
template <>
constexpr int32_t ordinalCount<Unit>() {
return 7;
}
constexpr Unit scopedEnum(YGUnit unscoped) {
return static_cast<Unit>(unscoped);
}
constexpr YGUnit unscopedEnum(Unit scoped) {
return static_cast<YGUnit>(scoped);
}
inline const char* toString(Unit e) {
return YGUnitToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,41 @@
/*
* 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 <cstdint>
#include <yoga/YGEnums.h>
#include <yoga/enums/YogaEnums.h>
namespace facebook::yoga {
enum class Wrap : uint8_t {
NoWrap = YGWrapNoWrap,
Wrap = YGWrapWrap,
WrapReverse = YGWrapWrapReverse,
};
template <>
constexpr int32_t ordinalCount<Wrap>() {
return 3;
}
constexpr Wrap scopedEnum(YGWrap unscoped) {
return static_cast<Wrap>(unscoped);
}
constexpr YGWrap unscopedEnum(Wrap scoped) {
return static_cast<YGWrap>(scoped);
}
inline const char* toString(Wrap e) {
return YGWrapToString(unscopedEnum(e));
}
} // namespace facebook::yoga

View File

@@ -0,0 +1,85 @@
/*
* 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 <bit>
#include <iterator>
#include <type_traits>
namespace facebook::yoga {
/**
* Concept for any enum/enum class
*/
template <typename EnumT>
concept Enumeration = std::is_enum_v<EnumT>;
/**
* Count of ordinals in a Yoga enum which is sequential
*/
template <Enumeration EnumT>
constexpr int32_t ordinalCount();
/**
* Concept for a yoga enum which is sequential
*/
template <typename EnumT>
concept HasOrdinality = (ordinalCount<EnumT>() > 0);
/**
* Count of bits needed to represent every ordinal
*/
template <HasOrdinality EnumT>
constexpr int32_t bitCount() {
return std::bit_width(
static_cast<std::underlying_type_t<EnumT>>(ordinalCount<EnumT>() - 1));
}
/**
* Polyfill of C++ 23 to_underlying()
* https://en.cppreference.com/w/cpp/utility/to_underlying
*/
constexpr auto to_underlying(Enumeration auto e) noexcept {
return static_cast<std::underlying_type_t<decltype(e)>>(e);
}
/**
* Convenience function to iterate through every value in a Yoga enum as part of
* a range-based for loop.
*/
template <HasOrdinality EnumT>
auto ordinals() {
struct Iterator {
EnumT e{};
EnumT operator*() const {
return e;
}
Iterator& operator++() {
e = static_cast<EnumT>(to_underlying(e) + 1);
return *this;
}
bool operator==(const Iterator& other) const = default;
bool operator!=(const Iterator& other) const = default;
};
struct Range {
Iterator begin() const {
return Iterator{};
}
Iterator end() const {
return Iterator{static_cast<EnumT>(ordinalCount<EnumT>())};
}
};
return Range{};
}
} // namespace facebook::yoga