Skip to content

Commit

Permalink
Reuse Yoga enum ToString functions
Browse files Browse the repository at this point in the history
Summary:
Yoga has generated public `ToString` functions for enums already. Don't duplicate in Fabric.

Changelog: [Internal]

Differential Revision: D50347728

fbshipit-source-id: 15a5dc62d384cd055a1628e0b4045f82b1fe8743
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Oct 17, 2023
1 parent 6c04a24 commit 21d7566
Showing 1 changed file with 6 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -723,27 +723,11 @@ inline std::string toString(const std::array<float, N> vec) {
}

inline std::string toString(const yoga::Direction& value) {
switch (value) {
case yoga::Direction::Inherit:
return "inherit";
case yoga::Direction::LTR:
return "ltr";
case yoga::Direction::RTL:
return "rtl";
}
return YGDirectionToString(yoga::unscopedEnum(value));
}

inline std::string toString(const yoga::FlexDirection& value) {
switch (value) {
case yoga::FlexDirection::Column:
return "column";
case yoga::FlexDirection::ColumnReverse:
return "column-reverse";
case yoga::FlexDirection::Row:
return "row";
case yoga::FlexDirection::RowReverse:
return "row-reverse";
}
return YGFlexDirectionToString(yoga::unscopedEnum(value));
}

inline std::string toString(const yoga::Justify& value) {
Expand All @@ -755,45 +739,19 @@ inline std::string toString(const yoga::Align& value) {
}

inline std::string toString(const yoga::PositionType& value) {
switch (value) {
case yoga::PositionType::Static:
return "static";
case yoga::PositionType::Relative:
return "relative";
case yoga::PositionType::Absolute:
return "absolute";
}
return YGPositionTypeToString(yoga::unscopedEnum(value));
}

inline std::string toString(const yoga::Wrap& value) {
switch (value) {
case yoga::Wrap::NoWrap:
return "no-wrap";
case yoga::Wrap::Wrap:
return "wrap";
case yoga::Wrap::WrapReverse:
return "wrap-reverse";
}
return YGWrapToString(yoga::unscopedEnum(value));
}

inline std::string toString(const yoga::Overflow& value) {
switch (value) {
case yoga::Overflow::Visible:
return "visible";
case yoga::Overflow::Scroll:
return "scroll";
case yoga::Overflow::Hidden:
return "hidden";
}
return YGOverflowToString(yoga::unscopedEnum(value));
}

inline std::string toString(const yoga::Display& value) {
switch (value) {
case yoga::Display::Flex:
return "flex";
case yoga::Display::None:
return "none";
}
return YGDisplayToString(yoga::unscopedEnum(value));
}

inline std::string toString(const YGValue& value) {
Expand Down

0 comments on commit 21d7566

Please sign in to comment.