mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Equality operators for AttributedString and derivatives
Summary: We will need this eventually. Reviewed By: mdvacca Differential Revision: D9799852 fbshipit-source-id: 0411e2f41540273c80f425e04c877fe51b9b2374
This commit is contained in:
committed by
Facebook Github Bot
parent
4eb9b40979
commit
e663b1ed59
@@ -15,6 +15,30 @@ namespace react {
|
||||
using Fragment = AttributedString::Fragment;
|
||||
using Fragments = AttributedString::Fragments;
|
||||
|
||||
#pragma mark - Fragment
|
||||
|
||||
bool Fragment::operator==(const Fragment &rhs) const {
|
||||
return
|
||||
std::tie(
|
||||
string,
|
||||
textAttributes,
|
||||
shadowNode,
|
||||
parentShadowNode
|
||||
) ==
|
||||
std::tie(
|
||||
rhs.string,
|
||||
rhs.textAttributes,
|
||||
rhs.shadowNode,
|
||||
rhs.parentShadowNode
|
||||
);
|
||||
}
|
||||
|
||||
bool Fragment::operator!=(const Fragment &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
#pragma mark - AttributedString
|
||||
|
||||
void AttributedString::appendFragment(const Fragment &fragment) {
|
||||
ensureUnsealed();
|
||||
fragments_.push_back(fragment);
|
||||
@@ -47,6 +71,14 @@ std::string AttributedString::getString() const {
|
||||
return string;
|
||||
}
|
||||
|
||||
bool AttributedString::operator==(const AttributedString &rhs) const {
|
||||
return fragments_ != rhs.fragments_;
|
||||
}
|
||||
|
||||
bool AttributedString::operator!=(const AttributedString &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
#pragma mark - DebugStringConvertible
|
||||
|
||||
SharedDebugStringConvertibleList AttributedString::getDebugChildren() const {
|
||||
|
||||
Reference in New Issue
Block a user