mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
Add clang-tidy. (#368)
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user