@@ -357,7 +357,7 @@ convertRawProp(const PropsParserContext &context, const RawProps &rawProps, cons
357357 convertRawProp (context, rawProps, " maxHeight" , sourceValue.maxDimension (yoga::Dimension::Height), {}));
358358
359359 {
360- const auto *rawValue = rawProps.at (" aspectRatio" , nullptr , nullptr );
360+ const auto *rawValue = rawProps.at (" aspectRatio" );
361361 if (rawValue != nullptr ) {
362362 yogaStyle.setAspectRatio (rawValue->hasValue () ? convertAspectRatio (context, *rawValue) : yogaStyle.aspectRatio ());
363363 } else {
@@ -371,43 +371,67 @@ convertRawProp(const PropsParserContext &context, const RawProps &rawProps, cons
371371 return yogaStyle;
372372}
373373
374+ struct CascadedRectangleCornersNames {
375+ const char *topLeft;
376+ const char *topRight;
377+ const char *bottomLeft;
378+ const char *bottomRight;
379+ const char *topStart;
380+ const char *topEnd;
381+ const char *bottomStart;
382+ const char *bottomEnd;
383+ const char *endEnd;
384+ const char *endStart;
385+ const char *startEnd;
386+ const char *startStart;
387+ const char *all;
388+ };
389+
390+ struct CascadedRectangleEdgesNames {
391+ const char *left;
392+ const char *right;
393+ const char *top;
394+ const char *bottom;
395+ const char *start;
396+ const char *end;
397+ const char *horizontal;
398+ const char *vertical;
399+ const char *block;
400+ const char *blockEnd;
401+ const char *blockStart;
402+ const char *all;
403+ };
404+
374405// This can be deleted when non-iterator ViewProp parsing is deleted
375406template <typename T>
376407static inline CascadedRectangleCorners<T> convertRawProp (
377408 const PropsParserContext &context,
378409 const RawProps &rawProps,
379- const char *prefix,
380- const char *suffix,
410+ const CascadedRectangleCornersNames &names,
381411 const CascadedRectangleCorners<T> &sourceValue,
382412 const CascadedRectangleCorners<T> &defaultValue)
383413{
384414 CascadedRectangleCorners<T> result;
385415
386- result.topLeft =
387- convertRawProp (context, rawProps, " TopLeft" , sourceValue.topLeft , defaultValue.topLeft , prefix, suffix);
388- result.topRight =
389- convertRawProp (context, rawProps, " TopRight" , sourceValue.topRight , defaultValue.topRight , prefix, suffix);
416+ result.topLeft = convertRawProp (context, rawProps, names.topLeft , sourceValue.topLeft , defaultValue.topLeft );
417+ result.topRight = convertRawProp (context, rawProps, names.topRight , sourceValue.topRight , defaultValue.topRight );
390418 result.bottomLeft =
391- convertRawProp (context, rawProps, " BottomLeft" , sourceValue.bottomLeft , defaultValue.bottomLeft , prefix, suffix);
392- result.bottomRight = convertRawProp (
393- context, rawProps, " BottomRight" , sourceValue.bottomRight , defaultValue.bottomRight , prefix, suffix);
394-
395- result.topStart =
396- convertRawProp (context, rawProps, " TopStart" , sourceValue.topStart , defaultValue.topStart , prefix, suffix);
397- result.topEnd = convertRawProp (context, rawProps, " TopEnd" , sourceValue.topEnd , defaultValue.topEnd , prefix, suffix);
398- result.bottomStart = convertRawProp (
399- context, rawProps, " BottomStart" , sourceValue.bottomStart , defaultValue.bottomStart , prefix, suffix);
400- result.bottomEnd =
401- convertRawProp (context, rawProps, " BottomEnd" , sourceValue.bottomEnd , defaultValue.bottomEnd , prefix, suffix);
402- result.endEnd = convertRawProp (context, rawProps, " EndEnd" , sourceValue.endEnd , defaultValue.endEnd , prefix, suffix);
403- result.endStart =
404- convertRawProp (context, rawProps, " EndStart" , sourceValue.endStart , defaultValue.endStart , prefix, suffix);
405- result.startEnd =
406- convertRawProp (context, rawProps, " StartEnd" , sourceValue.startEnd , defaultValue.startEnd , prefix, suffix);
419+ convertRawProp (context, rawProps, names.bottomLeft , sourceValue.bottomLeft , defaultValue.bottomLeft );
420+ result.bottomRight =
421+ convertRawProp (context, rawProps, names.bottomRight , sourceValue.bottomRight , defaultValue.bottomRight );
422+
423+ result.topStart = convertRawProp (context, rawProps, names.topStart , sourceValue.topStart , defaultValue.topStart );
424+ result.topEnd = convertRawProp (context, rawProps, names.topEnd , sourceValue.topEnd , defaultValue.topEnd );
425+ result.bottomStart =
426+ convertRawProp (context, rawProps, names.bottomStart , sourceValue.bottomStart , defaultValue.bottomStart );
427+ result.bottomEnd = convertRawProp (context, rawProps, names.bottomEnd , sourceValue.bottomEnd , defaultValue.bottomEnd );
428+ result.endEnd = convertRawProp (context, rawProps, names.endEnd , sourceValue.endEnd , defaultValue.endEnd );
429+ result.endStart = convertRawProp (context, rawProps, names.endStart , sourceValue.endStart , defaultValue.endStart );
430+ result.startEnd = convertRawProp (context, rawProps, names.startEnd , sourceValue.startEnd , defaultValue.startEnd );
407431 result.startStart =
408- convertRawProp (context, rawProps, " StartStart " , sourceValue.startStart , defaultValue.startStart , prefix, suffix );
432+ convertRawProp (context, rawProps, names. startStart , sourceValue.startStart , defaultValue.startStart );
409433
410- result.all = convertRawProp (context, rawProps, " " , sourceValue.all , defaultValue.all , prefix, suffix );
434+ result.all = convertRawProp (context, rawProps, names. all , sourceValue.all , defaultValue.all );
411435
412436 return result;
413437}
@@ -416,31 +440,28 @@ template <typename T>
416440static inline CascadedRectangleEdges<T> convertRawProp (
417441 const PropsParserContext &context,
418442 const RawProps &rawProps,
419- const char *prefix,
420- const char *suffix,
443+ const CascadedRectangleEdgesNames &names,
421444 const CascadedRectangleEdges<T> &sourceValue,
422445 const CascadedRectangleEdges<T> &defaultValue)
423446{
424447 CascadedRectangleEdges<T> result;
425448
426- result.left = convertRawProp (context, rawProps, " Left " , sourceValue.left , defaultValue.left , prefix, suffix );
427- result.right = convertRawProp (context, rawProps, " Right " , sourceValue.right , defaultValue.right , prefix, suffix );
428- result.top = convertRawProp (context, rawProps, " Top " , sourceValue.top , defaultValue.top , prefix, suffix );
429- result.bottom = convertRawProp (context, rawProps, " Bottom " , sourceValue.bottom , defaultValue.bottom , prefix, suffix );
449+ result.left = convertRawProp (context, rawProps, names. left , sourceValue.left , defaultValue.left );
450+ result.right = convertRawProp (context, rawProps, names. right , sourceValue.right , defaultValue.right );
451+ result.top = convertRawProp (context, rawProps, names. top , sourceValue.top , defaultValue.top );
452+ result.bottom = convertRawProp (context, rawProps, names. bottom , sourceValue.bottom , defaultValue.bottom );
430453
431- result.start = convertRawProp (context, rawProps, " Start " , sourceValue.start , defaultValue.start , prefix, suffix );
432- result.end = convertRawProp (context, rawProps, " End " , sourceValue.end , defaultValue.end , prefix, suffix );
454+ result.start = convertRawProp (context, rawProps, names. start , sourceValue.start , defaultValue.start );
455+ result.end = convertRawProp (context, rawProps, names. end , sourceValue.end , defaultValue.end );
433456 result.horizontal =
434- convertRawProp (context, rawProps, " Horizontal" , sourceValue.horizontal , defaultValue.horizontal , prefix, suffix);
435- result.vertical =
436- convertRawProp (context, rawProps, " Vertical" , sourceValue.vertical , defaultValue.vertical , prefix, suffix);
437- result.block = convertRawProp (context, rawProps, " Block" , sourceValue.block , defaultValue.block , prefix, suffix);
438- result.blockEnd =
439- convertRawProp (context, rawProps, " BlockEnd" , sourceValue.blockEnd , defaultValue.blockEnd , prefix, suffix);
457+ convertRawProp (context, rawProps, names.horizontal , sourceValue.horizontal , defaultValue.horizontal );
458+ result.vertical = convertRawProp (context, rawProps, names.vertical , sourceValue.vertical , defaultValue.vertical );
459+ result.block = convertRawProp (context, rawProps, names.block , sourceValue.block , defaultValue.block );
460+ result.blockEnd = convertRawProp (context, rawProps, names.blockEnd , sourceValue.blockEnd , defaultValue.blockEnd );
440461 result.blockStart =
441- convertRawProp (context, rawProps, " BlockStart " , sourceValue.blockStart , defaultValue.blockStart , prefix, suffix );
462+ convertRawProp (context, rawProps, names. blockStart , sourceValue.blockStart , defaultValue.blockStart );
442463
443- result.all = convertRawProp (context, rawProps, " " , sourceValue.all , defaultValue.all , prefix, suffix );
464+ result.all = convertRawProp (context, rawProps, names. all , sourceValue.all , defaultValue.all );
444465
445466 return result;
446467}
0 commit comments