Remove enum count macros

Summary:
@public
Removes all `YG...Count` macros for enums and replaces them with `facebook::yoga::enums::count<YG...>()`.
This removes the need to manually maintain enum counts.

Reviewed By: shergin

Differential Revision: D13597449

fbshipit-source-id: edcee225ada4058e94f3a727246763e3cc45873d
This commit is contained in:
David Aurelio
2019-01-10 07:35:55 -08:00
committed by Facebook Github Bot
parent efac22a508
commit ef2c693b05
7 changed files with 86 additions and 47 deletions

View File

@@ -20,8 +20,7 @@ static void indent(string& base, uint32_t level) {
}
}
static bool areFourValuesEqual(
const facebook::yoga::detail::Values<YGEdgeCount>& four) {
static bool areFourValuesEqual(const YGStyle::Edges& four) {
return YGValueEqual(four[0], four[1]) && YGValueEqual(four[0], four[2]) &&
YGValueEqual(four[0], four[3]);
}
@@ -86,7 +85,7 @@ static void appendNumberIfNotZero(
static void appendEdges(
string& base,
const string& key,
const facebook::yoga::detail::Values<YGEdgeCount>& edges) {
const YGStyle::Edges& edges) {
if (areFourValuesEqual(edges)) {
appendNumberIfNotZero(base, key, edges[YGEdgeLeft]);
} else {
@@ -100,7 +99,7 @@ static void appendEdges(
static void appendEdgeIfNotUndefined(
string& base,
const string& str,
const facebook::yoga::detail::Values<YGEdgeCount>& edges,
const YGStyle::Edges& edges,
const YGEdge edge) {
appendNumberIfNotUndefined(
base,