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: ad6c88ee861b9ce322badc0009a7a1c4642e8272
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Oct 17, 2023
1 parent 16a848f commit c53cc2d
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 c53cc2d

Please sign in to comment.