Remove the use of YGUnwrapOptional from YGConstrainedMaxSizeForMode
Summary: Remove the use of YGUnwrapOptional from YGConstrainedMaxSizeForMode Reviewed By: emilsjolander Differential Revision: D7322743 fbshipit-source-id: d825c60bcdc9ecdc0c784a215dc6b1b8a7a7860e
This commit is contained in:
committed by
Facebook Github Bot
parent
08743a42e2
commit
bb139d3f91
@@ -10,8 +10,16 @@
|
||||
#include <iostream>
|
||||
#include "Yoga.h"
|
||||
|
||||
YGFloatOptional::YGFloatOptional(const float& value)
|
||||
: value_(value), isUndefined_(false) {}
|
||||
YGFloatOptional::YGFloatOptional(const float& value) {
|
||||
if (YGFloatIsUndefined(value)) {
|
||||
isUndefined_ = true;
|
||||
value_ = 0;
|
||||
} else {
|
||||
value_ = value;
|
||||
isUndefined_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
YGFloatOptional::YGFloatOptional() : value_(0), isUndefined_(true) {}
|
||||
|
||||
const float& YGFloatOptional::getValue() const {
|
||||
@@ -53,3 +61,10 @@ bool YGFloatOptional::operator==(const float& val) const {
|
||||
bool YGFloatOptional::operator!=(const float& val) const {
|
||||
return !(*this == val);
|
||||
}
|
||||
|
||||
YGFloatOptional YGFloatOptional::operator+(const YGFloatOptional& op) {
|
||||
if (!isUndefined_ && !op.isUndefined_) {
|
||||
return YGFloatOptional(value_ + op.value_);
|
||||
}
|
||||
return YGFloatOptional();
|
||||
}
|
||||
|
Reference in New Issue
Block a user