Add clang-tidy. (#368)

This commit is contained in:
Arthur Sonzogni
2022-03-31 02:17:43 +02:00
committed by GitHub
parent 62fb6298be
commit aebde94352
80 changed files with 1958 additions and 1376 deletions

View File

@@ -5,15 +5,16 @@
namespace ftxui {
Node::Node() {}
Node::Node() = default;
Node::Node(Elements children) : children_(std::move(children)) {}
Node::~Node() {}
Node::~Node() = default;
/// @brief Compute how much space an elements needs.
/// @ingroup dom
void Node::ComputeRequirement() {
for (auto& child : children_)
for (auto& child : children_) {
child->ComputeRequirement();
}
}
/// @brief Assign a position and a dimension to an element for drawing.
@@ -25,13 +26,15 @@ void Node::SetBox(Box box) {
/// @brief Display an element on a ftxui::Screen.
/// @ingroup dom
void Node::Render(Screen& screen) {
for (auto& child : children_)
for (auto& child : children_) {
child->Render(screen);
}
}
void Node::Check(Status* status) {
for (auto& child : children_)
for (auto& child : children_) {
child->Check(status);
}
status->need_iteration |= (status->iteration == 0);
}
@@ -52,7 +55,8 @@ void Render(Screen& screen, Node* node) {
Node::Status status;
node->Check(&status);
while (status.need_iteration && status.iteration < 20) {
const int max_iterations = 20;
while (status.need_iteration && status.iteration < max_iterations) {
// Step 1: Find what dimension this elements wants to be.
node->ComputeRequirement();