Fabric: Enabling clang-format for the rest of Fabric

Summary: This is the second and the final part of adopting clang-format.

Reviewed By: mdvacca

Differential Revision: D10229624

fbshipit-source-id: d97670b716800ea2488b84bd0aacaf54d8bd2e31
This commit is contained in:
Valentin Shergin
2018-10-09 16:31:48 -07:00
committed by Facebook Github Bot
parent 01af828d16
commit 8f51243957
78 changed files with 1719 additions and 1345 deletions
@@ -12,7 +12,9 @@ namespace react {
#if RN_DEBUG_STRING_CONVERTIBLE
std::string DebugStringConvertible::getDebugChildrenDescription(DebugStringConvertibleOptions options, int depth) const {
std::string DebugStringConvertible::getDebugChildrenDescription(
DebugStringConvertibleOptions options,
int depth) const {
if (depth >= options.maximumDepth) {
return "";
}
@@ -30,7 +32,9 @@ std::string DebugStringConvertible::getDebugChildrenDescription(DebugStringConve
return childrenString;
}
std::string DebugStringConvertible::getDebugPropsDescription(DebugStringConvertibleOptions options, int depth) const {
std::string DebugStringConvertible::getDebugPropsDescription(
DebugStringConvertibleOptions options,
int depth) const {
if (depth >= options.maximumDepth) {
return "";
}
@@ -45,8 +49,10 @@ std::string DebugStringConvertible::getDebugPropsDescription(DebugStringConverti
auto name = prop->getDebugName();
auto value = prop->getDebugValue();
auto children = prop->getDebugPropsDescription(options, depth + 1);
auto valueAndChildren = value + (children.empty() ? "" : "(" + children + ")");
propsString += " " + name + (valueAndChildren.empty() ? "" : "=" + valueAndChildren);
auto valueAndChildren =
value + (children.empty() ? "" : "(" + children + ")");
propsString +=
" " + name + (valueAndChildren.empty() ? "" : "=" + valueAndChildren);
}
if (!propsString.empty()) {
@@ -57,19 +63,23 @@ std::string DebugStringConvertible::getDebugPropsDescription(DebugStringConverti
return propsString;
}
std::string DebugStringConvertible::getDebugDescription(DebugStringConvertibleOptions options, int depth) const {
std::string DebugStringConvertible::getDebugDescription(
DebugStringConvertibleOptions options,
int depth) const {
auto nameString = getDebugName();
auto valueString = getDebugValue();
auto childrenString = getDebugChildrenDescription(options, depth);
auto propsString = getDebugPropsDescription(options, depth);
auto leading = options.format ? std::string(depth * 2, ' ') : std::string {""};
auto trailing = options.format ? std::string {"\n"} : std::string {""};
auto leading = options.format ? std::string(depth * 2, ' ') : std::string{""};
auto trailing = options.format ? std::string{"\n"} : std::string{""};
return leading + "<" + nameString +
(valueString.empty() ? "" : "=" + valueString) +
(propsString.empty() ? "" : " " + propsString) +
(childrenString.empty() ? "/>" + trailing : ">" + trailing + childrenString + leading + "</" + nameString + ">" + trailing);
(valueString.empty() ? "" : "=" + valueString) +
(propsString.empty() ? "" : " " + propsString) +
(childrenString.empty() ? "/>" + trailing
: ">" + trailing + childrenString + leading +
"</" + nameString + ">" + trailing);
}
std::string DebugStringConvertible::getDebugName() const {
@@ -80,7 +90,8 @@ std::string DebugStringConvertible::getDebugValue() const {
return "";
}
SharedDebugStringConvertibleList DebugStringConvertible::getDebugChildren() const {
SharedDebugStringConvertibleList DebugStringConvertible::getDebugChildren()
const {
return SharedDebugStringConvertibleList();
}