inline trivial constructors / methods

Summary:
@public

inlines some trivial constructors, destructors, and methods.

Reviewed By: astreet

Differential Revision: D8912691

fbshipit-source-id: 79840ef3322676deebed99391390d6c1796963b5
This commit is contained in:
David Aurelio 2018-07-19 09:51:25 -07:00 committed by Facebook Github Bot
parent dfc7b2fd03
commit 1d7a24ff0c
6 changed files with 28 additions and 61 deletions

View File

@ -61,7 +61,3 @@ bool YGLayout::operator==(YGLayout layout) const {
return isEqual;
}
bool YGLayout::operator!=(YGLayout layout) const {
return !(*this == layout);
}

View File

@ -38,5 +38,7 @@ struct YGLayout {
YGLayout();
bool operator==(YGLayout layout) const;
bool operator!=(YGLayout layout) const;
bool operator!=(YGLayout layout) const {
return !(*this == layout);
}
};

View File

@ -254,29 +254,6 @@ void YGNode::setPosition(
trailing[crossAxis]);
}
YGNode::YGNode()
: context_(nullptr),
print_(nullptr),
hasNewLayout_(true),
nodeType_(YGNodeTypeDefault),
measure_(nullptr),
baseline_(nullptr),
dirtied_(nullptr),
style_(YGStyle()),
layout_(YGLayout()),
lineIndex_(0),
owner_(nullptr),
children_(YGVector()),
config_(nullptr),
isDirty_(false),
resolvedDimensions_({{YGValueUndefined, YGValueUndefined}}) {}
YGNode::YGNode(const YGNode& node) = default;
YGNode::YGNode(const YGConfigRef newConfig) : YGNode() {
config_ = newConfig;
}
YGNode& YGNode::operator=(const YGNode& node) {
if (&node == this) {
return *this;
@ -360,11 +337,6 @@ void YGNode::clearChildren() {
children_.shrink_to_fit();
}
YGNode::~YGNode() {
// All the member variables are deallocated externally, so no need to
// deallocate here
}
// Other Methods
void YGNode::cloneChildrenIfNeeded() {

View File

@ -14,31 +14,32 @@
struct YGNode {
private:
void* context_;
YGPrintFunc print_;
bool hasNewLayout_;
YGNodeType nodeType_;
YGMeasureFunc measure_;
YGBaselineFunc baseline_;
YGDirtiedFunc dirtied_;
YGStyle style_;
YGLayout layout_;
uint32_t lineIndex_;
YGNodeRef owner_;
YGVector children_;
YGConfigRef config_;
bool isDirty_;
std::array<YGValue, 2> resolvedDimensions_;
void* context_ = nullptr;
YGPrintFunc print_ = nullptr;
bool hasNewLayout_ = true;
YGNodeType nodeType_ = YGNodeTypeDefault;
YGMeasureFunc measure_ = nullptr;
YGBaselineFunc baseline_ = nullptr;
YGDirtiedFunc dirtied_ = nullptr;
YGStyle style_ = {};
YGLayout layout_ = {};
uint32_t lineIndex_ = 0;
YGNodeRef owner_ = nullptr;
YGVector children_ = {};
YGConfigRef config_ = nullptr;
bool isDirty_ = false;
std::array<YGValue, 2> resolvedDimensions_ = {
{YGValueUndefined, YGValueUndefined}};
YGFloatOptional relativePosition(
const YGFlexDirection& axis,
const float& axisSize) const;
public:
YGNode();
~YGNode();
explicit YGNode(const YGConfigRef newConfig);
YGNode(const YGNode& node);
YGNode() = default;
~YGNode() = default; // cleanup of owner/children relationships in YGNodeFree
explicit YGNode(const YGConfigRef newConfig) : config_(newConfig){};
YGNode(const YGNode& node) = default;
YGNode& operator=(const YGNode& node);
// Getters

View File

@ -98,9 +98,3 @@ bool YGStyle::operator==(const YGStyle& style) {
return areNonFloatValuesEqual;
}
bool YGStyle::operator!=(YGStyle style) {
return !(*this == style);
}
YGStyle::~YGStyle() {}

View File

@ -32,12 +32,14 @@ struct YGStyle {
std::array<YGValue, 2> dimensions;
std::array<YGValue, 2> minDimensions;
std::array<YGValue, 2> maxDimensions;
// Yoga specific properties, not compatible with flexbox specification
YGFloatOptional aspectRatio;
YGStyle();
// Yoga specific properties, not compatible with flexbox specification
bool operator==(const YGStyle& style);
bool operator!=(YGStyle style);
~YGStyle();
bool operator!=(YGStyle style) {
return !(*this == style);
}
~YGStyle() = default;
};