Skip to content

Commit

Permalink
C++ style enums 9/N: FlexDirection (facebook#1394)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#1394

X-link: facebook/react-native#39484

Moves internal usages of YGDirection to Direction.

Changelog: [Internal]

Differential Revision: D49336066

fbshipit-source-id: d7555c9621b073cf772155662f6a66519f1860df
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Sep 18, 2023
1 parent 545494f commit 62fa434
Show file tree
Hide file tree
Showing 11 changed files with 168 additions and 165 deletions.
1 change: 1 addition & 0 deletions Yoga.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ Pod::Spec.new do |spec|

all_header_files = 'yoga/**/*.h'
spec.private_header_files = Dir.glob(all_header_files) - Dir.glob(public_header_files)
spec.preserve_paths = [all_header_files]
end
8 changes: 4 additions & 4 deletions tests/YGStyleAccessorsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ ACCESSOR_TEST(

ACCESSOR_TEST(
flexDirection,
YGFlexDirectionColumn,
YGFlexDirectionColumnReverse,
YGFlexDirectionRowReverse,
YGFlexDirectionRow)
FlexDirection::Column,
FlexDirection::ColumnReverse,
FlexDirection::RowReverse,
FlexDirection::Row)

ACCESSOR_TEST(
justifyContent,
Expand Down
4 changes: 2 additions & 2 deletions yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,10 @@ void YGNodeStyleSetFlexDirection(
const YGNodeRef node,
const YGFlexDirection flexDirection) {
updateStyle<MSVC_HINT(flexDirection)>(
node, &Style::flexDirection, flexDirection);
node, &Style::flexDirection, scopedEnum(flexDirection));
}
YGFlexDirection YGNodeStyleGetFlexDirection(const YGNodeConstRef node) {
return resolveRef(node)->getStyle().flexDirection();
return unscopedEnum(resolveRef(node)->getStyle().flexDirection());
}

void YGNodeStyleSetJustifyContent(
Expand Down
7 changes: 4 additions & 3 deletions yoga/algorithm/BoundAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <yoga/algorithm/FlexDirection.h>
#include <yoga/algorithm/ResolveValue.h>
#include <yoga/enums/FlexDirection.h>
#include <yoga/node/Node.h>
#include <yoga/numeric/Comparison.h>
#include <yoga/numeric/FloatOptional.h>
Expand All @@ -17,7 +18,7 @@ namespace facebook::yoga {

inline float paddingAndBorderForAxis(
const yoga::Node* const node,
const YGFlexDirection axis,
const FlexDirection axis,
const float widthSize) {
return (node->getLeadingPaddingAndBorder(axis, widthSize) +
node->getTrailingPaddingAndBorder(axis, widthSize))
Expand All @@ -26,7 +27,7 @@ inline float paddingAndBorderForAxis(

inline FloatOptional boundAxisWithinMinAndMax(
const yoga::Node* const node,
const YGFlexDirection axis,
const FlexDirection axis,
const FloatOptional value,
const float axisSize) {
FloatOptional min;
Expand Down Expand Up @@ -59,7 +60,7 @@ inline FloatOptional boundAxisWithinMinAndMax(
// go below the padding and border amount.
inline float boundAxis(
const yoga::Node* const node,
const YGFlexDirection axis,
const FlexDirection axis,
const float value,
const float axisSize,
const float widthSize) {
Expand Down
Loading

0 comments on commit 62fa434

Please sign in to comment.