Tidy up YGFloatOptional
Summary: Just some convention/weird style things. `float` should be passed by value, weird use of ?: operator instead of ||. Reviewed By: priteshrnandgaonkar Differential Revision: D8804407 fbshipit-source-id: e0d67363ccde36ec5bccec7497ed0ffd364b3fcf
This commit is contained in:
committed by
Facebook Github Bot
parent
4ed3dd4b82
commit
e9e2ae28e0
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
/*
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct YGFloatOptional {
|
||||
@@ -13,7 +13,7 @@ struct YGFloatOptional {
|
||||
bool isUndefined_;
|
||||
|
||||
public:
|
||||
explicit YGFloatOptional(const float& value);
|
||||
explicit YGFloatOptional(float value);
|
||||
explicit YGFloatOptional();
|
||||
|
||||
// Program will terminate if the value of an undefined is accessed. Please
|
||||
@@ -22,9 +22,14 @@ struct YGFloatOptional {
|
||||
const float& getValue() const;
|
||||
|
||||
// Sets the value of float optional, and thus isUndefined is assigned false.
|
||||
void setValue(const float& val);
|
||||
void setValue(float val) {
|
||||
value_ = val;
|
||||
isUndefined_ = false;
|
||||
}
|
||||
|
||||
const bool& isUndefined() const;
|
||||
bool isUndefined() const {
|
||||
return isUndefined_;
|
||||
}
|
||||
|
||||
YGFloatOptional operator+(const YGFloatOptional& op);
|
||||
bool operator>(const YGFloatOptional& op) const;
|
||||
@@ -34,6 +39,6 @@ struct YGFloatOptional {
|
||||
bool operator==(const YGFloatOptional& op) const;
|
||||
bool operator!=(const YGFloatOptional& op) const;
|
||||
|
||||
bool operator==(const float& val) const;
|
||||
bool operator!=(const float& val) const;
|
||||
bool operator==(float val) const;
|
||||
bool operator!=(float val) const;
|
||||
};
|
||||
|
Reference in New Issue
Block a user