mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-06 09:31:11 +08:00
Inline YGFloatOptional completely
Summary: @public `YGFLoatOptional` only contains trivial functionality. Make it header-only. Reviewed By: SidharthGuglani Differential Revision: D13439609 fbshipit-source-id: 3f3c6c3a15e05ac55da2af30eb629f786ecb90a9
This commit is contained in:
committed by
Facebook Github Bot
parent
688b3195c3
commit
a56b67fa9b
@@ -846,8 +846,6 @@
|
||||
53D1239F1FBF1EFB001B8A10 /* Yoga-internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 53CBF1851FB4FE80002CBB31 /* Yoga-internal.h */; };
|
||||
53D123A01FBF1EFF001B8A10 /* Yoga.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53CBF1871FB4FE80002CBB31 /* Yoga.cpp */; };
|
||||
53D123A11FBF1EFF001B8A10 /* Yoga.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53CBF1871FB4FE80002CBB31 /* Yoga.cpp */; };
|
||||
53DEF6EA205AE5A0006A3890 /* YGFloatOptional.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53DEF6E6205AE59B006A3890 /* YGFloatOptional.cpp */; };
|
||||
53DEF6EB205AE5A1006A3890 /* YGFloatOptional.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53DEF6E6205AE59B006A3890 /* YGFloatOptional.cpp */; };
|
||||
53DEF6EC205AE5A6006A3890 /* YGFloatOptional.h in Headers */ = {isa = PBXBuildFile; fileRef = 53DEF6E7205AE59C006A3890 /* YGFloatOptional.h */; };
|
||||
53DEF6ED205AE5A7006A3890 /* YGFloatOptional.h in Headers */ = {isa = PBXBuildFile; fileRef = 53DEF6E7205AE59C006A3890 /* YGFloatOptional.h */; };
|
||||
53EC85E21FDEC75F0051B2B5 /* YGNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53EC85DF1FDEC75A0051B2B5 /* YGNode.cpp */; };
|
||||
@@ -4376,7 +4374,6 @@
|
||||
files = (
|
||||
AC6B69E721B146B400B2B68A /* YGValue.cpp in Sources */,
|
||||
AC8360D121B025BC00FC46B9 /* YGConfig.cpp in Sources */,
|
||||
53DEF6EA205AE5A0006A3890 /* YGFloatOptional.cpp in Sources */,
|
||||
53D123A01FBF1EFF001B8A10 /* Yoga.cpp in Sources */,
|
||||
5352C5752038FF9500A3B97E /* YGStyle.cpp in Sources */,
|
||||
53EC85E21FDEC75F0051B2B5 /* YGNode.cpp in Sources */,
|
||||
@@ -4393,7 +4390,6 @@
|
||||
files = (
|
||||
AC6B69EA21B146E700B2B68A /* YGValue.cpp in Sources */,
|
||||
BA0501B02109DD1800A6BBC4 /* YGConfig.cpp in Sources */,
|
||||
53DEF6EB205AE5A1006A3890 /* YGFloatOptional.cpp in Sources */,
|
||||
53D123A11FBF1EFF001B8A10 /* Yoga.cpp in Sources */,
|
||||
5352C5762038FF9700A3B97E /* YGStyle.cpp in Sources */,
|
||||
53EC85E31FDEC75F0051B2B5 /* YGNode.cpp in Sources */,
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
#include "YGFloatOptional.h"
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include "Yoga-internal.h"
|
||||
#include "Yoga.h"
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
bool YGFloatOptional::operator==(YGFloatOptional op) const {
|
||||
return value_ == op.value_ || (isUndefined() && op.isUndefined());
|
||||
}
|
||||
|
||||
bool YGFloatOptional::operator!=(YGFloatOptional op) const {
|
||||
return !(*this == op);
|
||||
}
|
||||
|
||||
bool YGFloatOptional::operator==(float val) const {
|
||||
return value_ == val || (isUndefined() && yoga::isUndefined(val));
|
||||
}
|
||||
|
||||
bool YGFloatOptional::operator!=(float val) const {
|
||||
return !(*this == val);
|
||||
}
|
||||
|
||||
YGFloatOptional YGFloatOptional::operator+(YGFloatOptional op) const {
|
||||
return YGFloatOptional{value_ + op.value_};
|
||||
}
|
||||
|
||||
bool YGFloatOptional::operator>(YGFloatOptional op) const {
|
||||
return value_ > op.value_;
|
||||
}
|
||||
|
||||
bool YGFloatOptional::operator<(YGFloatOptional op) const {
|
||||
return value_ < op.value_;
|
||||
}
|
||||
|
||||
bool YGFloatOptional::operator>=(YGFloatOptional op) const {
|
||||
return *this > op || *this == op;
|
||||
}
|
||||
|
||||
bool YGFloatOptional::operator<=(YGFloatOptional op) const {
|
||||
return *this < op || *this == op;
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include "Yoga-internal.h"
|
||||
|
||||
struct YGFloatOptional {
|
||||
private:
|
||||
@@ -18,7 +19,7 @@ struct YGFloatOptional {
|
||||
constexpr YGFloatOptional() = default;
|
||||
|
||||
// returns the wrapped value, or a value x with YGIsUndefined(x) == true
|
||||
float unwrap() const {
|
||||
constexpr float unwrap() const {
|
||||
return value_;
|
||||
}
|
||||
|
||||
@@ -26,14 +27,32 @@ struct YGFloatOptional {
|
||||
return std::isnan(value_);
|
||||
}
|
||||
|
||||
YGFloatOptional operator+(YGFloatOptional op) const;
|
||||
bool operator>(YGFloatOptional op) const;
|
||||
bool operator<(YGFloatOptional op) const;
|
||||
bool operator>=(YGFloatOptional op) const;
|
||||
bool operator<=(YGFloatOptional op) const;
|
||||
bool operator==(YGFloatOptional op) const;
|
||||
bool operator!=(YGFloatOptional op) const;
|
||||
YGFloatOptional operator+(YGFloatOptional op) const {
|
||||
return YGFloatOptional{value_ + op.value_};
|
||||
}
|
||||
bool operator>(YGFloatOptional op) const {
|
||||
return value_ > op.value_;
|
||||
}
|
||||
bool operator<(YGFloatOptional op) const {
|
||||
return value_ < op.value_;
|
||||
}
|
||||
bool operator>=(YGFloatOptional op) const {
|
||||
return *this > op || *this == op;
|
||||
}
|
||||
bool operator<=(YGFloatOptional op) const {
|
||||
return *this < op || *this == op;
|
||||
}
|
||||
bool operator==(YGFloatOptional op) const {
|
||||
return value_ == op.value_ || (isUndefined() && op.isUndefined());
|
||||
}
|
||||
bool operator!=(YGFloatOptional op) const {
|
||||
return !(*this == op);
|
||||
}
|
||||
|
||||
bool operator==(float val) const;
|
||||
bool operator!=(float val) const;
|
||||
bool operator==(float val) const {
|
||||
return value_ == val || (isUndefined() && yoga::isUndefined(val));
|
||||
}
|
||||
bool operator!=(float val) const {
|
||||
return !(*this == val);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user