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 f172d5d41c
commit f95e3b49e9
6 changed files with 28 additions and 61 deletions

View File

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

View File

@@ -38,5 +38,7 @@ struct YGLayout {
YGLayout(); YGLayout();
bool operator==(YGLayout layout) const; 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]); 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) { YGNode& YGNode::operator=(const YGNode& node) {
if (&node == this) { if (&node == this) {
return *this; return *this;
@@ -360,11 +337,6 @@ void YGNode::clearChildren() {
children_.shrink_to_fit(); children_.shrink_to_fit();
} }
YGNode::~YGNode() {
// All the member variables are deallocated externally, so no need to
// deallocate here
}
// Other Methods // Other Methods
void YGNode::cloneChildrenIfNeeded() { void YGNode::cloneChildrenIfNeeded() {

View File

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

View File

@@ -98,9 +98,3 @@ bool YGStyle::operator==(const YGStyle& style) {
return areNonFloatValuesEqual; 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> dimensions;
std::array<YGValue, 2> minDimensions; std::array<YGValue, 2> minDimensions;
std::array<YGValue, 2> maxDimensions; std::array<YGValue, 2> maxDimensions;
// Yoga specific properties, not compatible with flexbox specification
YGFloatOptional aspectRatio; YGFloatOptional aspectRatio;
YGStyle(); YGStyle();
// Yoga specific properties, not compatible with flexbox specification
bool operator==(const YGStyle& style); bool operator==(const YGStyle& style);
bool operator!=(YGStyle style); bool operator!=(YGStyle style) {
~YGStyle(); return !(*this == style);
}
~YGStyle() = default;
}; };