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:
committed by
Facebook Github Bot
parent
efac22a508
commit
ef2c693b05
@@ -105,7 +105,7 @@ bool YGFloatIsUndefined(const float value) {
|
||||
}
|
||||
|
||||
detail::CompactValue YGComputedEdgeValue(
|
||||
const facebook::yoga::detail::Values<YGEdgeCount>& edges,
|
||||
const YGStyle::Edges& edges,
|
||||
YGEdge edge,
|
||||
detail::CompactValue defaultValue) {
|
||||
if (!edges[edge].isUndefined()) {
|
||||
@@ -3546,14 +3546,12 @@ static const char* YGSpacer(const unsigned long level) {
|
||||
static const char* YGMeasureModeName(
|
||||
const YGMeasureMode mode,
|
||||
const bool performLayout) {
|
||||
const char* kMeasureModeNames[YGMeasureModeCount] = {
|
||||
"UNDEFINED", "EXACTLY", "AT_MOST"};
|
||||
const char* kLayoutModeNames[YGMeasureModeCount] = {"LAY_UNDEFINED",
|
||||
"LAY_EXACTLY",
|
||||
"LAY_AT_"
|
||||
"MOST"};
|
||||
constexpr auto N = enums::count<YGMeasureMode>();
|
||||
const char* kMeasureModeNames[N] = {"UNDEFINED", "EXACTLY", "AT_MOST"};
|
||||
const char* kLayoutModeNames[N] = {
|
||||
"LAY_UNDEFINED", "LAY_EXACTLY", "LAY_AT_MOST"};
|
||||
|
||||
if (mode >= YGMeasureModeCount) {
|
||||
if (mode >= N) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user