mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Enabling clang-format for half of Fabric modules
Summary: All code styles are terribly ugly. We have the only choise - choise something and embrace it. This particular code style was borrowed from a neibour Fabric-friendly project because it follows established Facebook guides and respects client-side traditions. Reviewed By: mdvacca Differential Revision: D10218598 fbshipit-source-id: 8c4cf6713c07768566dadef479191661c79988f0
This commit is contained in:
committed by
Facebook Github Bot
parent
3d31bebbeb
commit
3ad5c9e016
@@ -18,19 +18,12 @@ 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
|
||||
);
|
||||
return std::tie(string, textAttributes, shadowNode, parentShadowNode) ==
|
||||
std::tie(
|
||||
rhs.string,
|
||||
rhs.textAttributes,
|
||||
rhs.shadowNode,
|
||||
rhs.parentShadowNode);
|
||||
}
|
||||
|
||||
bool Fragment::operator!=(const Fragment &rhs) const {
|
||||
@@ -49,14 +42,22 @@ void AttributedString::prependFragment(const Fragment &fragment) {
|
||||
fragments_.insert(fragments_.begin(), fragment);
|
||||
}
|
||||
|
||||
void AttributedString::appendAttributedString(const AttributedString &attributedString) {
|
||||
void AttributedString::appendAttributedString(
|
||||
const AttributedString &attributedString) {
|
||||
ensureUnsealed();
|
||||
fragments_.insert(fragments_.end(), attributedString.fragments_.begin(), attributedString.fragments_.end());
|
||||
fragments_.insert(
|
||||
fragments_.end(),
|
||||
attributedString.fragments_.begin(),
|
||||
attributedString.fragments_.end());
|
||||
}
|
||||
|
||||
void AttributedString::prependAttributedString(const AttributedString &attributedString) {
|
||||
void AttributedString::prependAttributedString(
|
||||
const AttributedString &attributedString) {
|
||||
ensureUnsealed();
|
||||
fragments_.insert(fragments_.begin(), attributedString.fragments_.begin(), attributedString.fragments_.end());
|
||||
fragments_.insert(
|
||||
fragments_.begin(),
|
||||
attributedString.fragments_.begin(),
|
||||
attributedString.fragments_.end());
|
||||
}
|
||||
|
||||
const std::vector<Fragment> &AttributedString::getFragments() const {
|
||||
@@ -64,7 +65,7 @@ const std::vector<Fragment> &AttributedString::getFragments() const {
|
||||
}
|
||||
|
||||
std::string AttributedString::getString() const {
|
||||
auto string = std::string {};
|
||||
auto string = std::string{};
|
||||
for (const auto &fragment : fragments_) {
|
||||
string += fragment.string;
|
||||
}
|
||||
@@ -83,23 +84,22 @@ bool AttributedString::operator!=(const AttributedString &rhs) const {
|
||||
|
||||
#if RN_DEBUG_STRING_CONVERTIBLE
|
||||
SharedDebugStringConvertibleList AttributedString::getDebugChildren() const {
|
||||
auto list = SharedDebugStringConvertibleList {};
|
||||
auto list = SharedDebugStringConvertibleList{};
|
||||
|
||||
for (auto &&fragment : fragments_) {
|
||||
auto propsList = fragment.textAttributes.DebugStringConvertible::getDebugProps();
|
||||
auto propsList =
|
||||
fragment.textAttributes.DebugStringConvertible::getDebugProps();
|
||||
|
||||
if (fragment.shadowNode) {
|
||||
propsList.push_back(std::make_shared<DebugStringConvertibleItem>("shadowNode", fragment.shadowNode->getDebugDescription()));
|
||||
propsList.push_back(std::make_shared<DebugStringConvertibleItem>(
|
||||
"shadowNode", fragment.shadowNode->getDebugDescription()));
|
||||
}
|
||||
|
||||
list.push_back(
|
||||
std::make_shared<DebugStringConvertibleItem>(
|
||||
list.push_back(std::make_shared<DebugStringConvertibleItem>(
|
||||
"Fragment",
|
||||
fragment.string,
|
||||
SharedDebugStringConvertibleList(),
|
||||
propsList
|
||||
)
|
||||
);
|
||||
propsList));
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
Reference in New Issue
Block a user