From d70660674b6dfde04e6533fbbf6af0a9d334f6b5 Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Fri, 9 Feb 2024 13:29:16 -0800 Subject: [PATCH] [skip ci] Support for (de)serializing config values (#42750) Summary: X-link: https://github.com/facebook/yoga/pull/1571 tsia. This is state we need to capture as it can drastically affect the benchmark times Reviewed By: NickGerleman Differential Revision: D53203385 --- .../com/facebook/yoga/YogaPrintOptions.java | 35 ----------------- .../ReactCommon/yoga/yoga/YGEnums.cpp | 12 ------ .../ReactCommon/yoga/yoga/YGEnums.h | 7 ---- .../yoga/yoga/enums/PrintOptions.h | 38 ------------------- 4 files changed, 92 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaPrintOptions.java delete mode 100644 packages/react-native/ReactCommon/yoga/yoga/enums/PrintOptions.h diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaPrintOptions.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaPrintOptions.java deleted file mode 100644 index 54eacc51d3a19e..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaPrintOptions.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 - -package com.facebook.yoga; - -public enum YogaPrintOptions { - LAYOUT(1), - STYLE(2), - CHILDREN(4); - - private final int mIntValue; - - YogaPrintOptions(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaPrintOptions fromInt(int value) { - switch (value) { - case 1: return LAYOUT; - case 2: return STYLE; - case 4: return CHILDREN; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp index d3365d3a421730..222a5d12a4259d 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp +++ b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp @@ -223,18 +223,6 @@ const char* YGPositionTypeToString(const YGPositionType value) { return "unknown"; } -const char* YGPrintOptionsToString(const YGPrintOptions value) { - switch (value) { - case YGPrintOptionsLayout: - return "layout"; - case YGPrintOptionsStyle: - return "style"; - case YGPrintOptionsChildren: - return "children"; - } - return "unknown"; -} - const char* YGUnitToString(const YGUnit value) { switch (value) { case YGUnitUndefined: diff --git a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h index 18fbe0fe02c970..44335277fc0d1f 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h +++ b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h @@ -120,13 +120,6 @@ YG_ENUM_DECL( YGPositionTypeRelative, YGPositionTypeAbsolute) -YG_ENUM_DECL( - YGPrintOptions, - YGPrintOptionsLayout = 1, - YGPrintOptionsStyle = 2, - YGPrintOptionsChildren = 4) -YG_DEFINE_ENUM_FLAG_OPERATORS(YGPrintOptions) - YG_ENUM_DECL( YGUnit, YGUnitUndefined, diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/PrintOptions.h b/packages/react-native/ReactCommon/yoga/yoga/enums/PrintOptions.h deleted file mode 100644 index 5970bafb47aa0e..00000000000000 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/PrintOptions.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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, -}; - -YG_DEFINE_ENUM_FLAG_OPERATORS(PrintOptions) - -constexpr PrintOptions scopedEnum(YGPrintOptions unscoped) { - return static_cast(unscoped); -} - -constexpr YGPrintOptions unscopedEnum(PrintOptions scoped) { - return static_cast(scoped); -} - -inline const char* toString(PrintOptions e) { - return YGPrintOptionsToString(unscopedEnum(e)); -} - -} // namespace facebook::yoga