Apply Clang-tidy (#918)

This commit is contained in:
Arthur Sonzogni
2024-08-16 11:19:51 +02:00
committed by GitHub
parent 535290bb3b
commit f5d8c7deb5
32 changed files with 160 additions and 110 deletions

View File

@@ -2,7 +2,6 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <benchmark/benchmark.h>
#include <iostream>
#include "ftxui/dom/elements.hpp" // for gauge, separator, operator|, text, Element, hbox, vbox, blink, border, inverted
#include "ftxui/dom/node.hpp" // for Render

View File

@@ -8,12 +8,12 @@
#include <optional> // for optional, nullopt
#include <string> // for basic_string, string
#include <utility> // for move
#include <vector> // for __alloc_traits<>::value_type
#include "ftxui/dom/elements.hpp" // for unpack, Element, Decorator, BorderStyle, ROUNDED, borderStyled, Elements, DASHED, DOUBLE, EMPTY, HEAVY, LIGHT, border, borderDashed, borderDouble, borderEmpty, borderHeavy, borderLight, borderRounded, borderWith, window
#include "ftxui/dom/node.hpp" // for Node, Elements
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/pixel.hpp" // for Pixel
#include "ftxui/screen/screen.hpp" // for Pixel, Screen
namespace ftxui {
@@ -38,7 +38,8 @@ class Border : public Node {
BorderStyle style,
std::optional<Color> foreground_color = std::nullopt)
: Node(std::move(children)),
charset_(simple_border_charset[style]),
charset_(simple_border_charset[style]) // NOLINT
,
foreground_color_(foreground_color) {} // NOLINT
const Charset& charset_; // NOLINT

View File

@@ -4,6 +4,7 @@
#include "ftxui/dom/box_helper.hpp"
#include <algorithm> // for max
#include <vector> // for vector
namespace ftxui::box_helper {

View File

@@ -8,6 +8,7 @@
#include <cstdint> // for uint8_t
#include <cstdlib> // for abs
#include <ftxui/screen/color.hpp> // for Color
#include <functional> // for function
#include <map> // for map
#include <memory> // for make_shared
#include <utility> // for move, pair
@@ -17,6 +18,8 @@
#include "ftxui/dom/node.hpp" // for Node
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/image.hpp" // for Image
#include "ftxui/screen/pixel.hpp" // for Pixel
#include "ftxui/screen/screen.hpp" // for Pixel, Screen
#include "ftxui/screen/string.hpp" // for Utf8ToGlyphs
#include "ftxui/util/ref.hpp" // for ConstRef
@@ -28,7 +31,7 @@ namespace {
// Base UTF8 pattern:
// 11100010 10100000 10000000 // empty
// Pattern for the individuel dots:
// Pattern for the individual dots:
// ┌──────┬───────┐
// │dot1 │ dot4 │
// ├──────┼───────┤

View File

@@ -2,13 +2,16 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <algorithm> // for max
#include <cstddef> // for size_t
#include <memory> // for __shared_ptr_access, shared_ptr, make_shared
#include <utility> // for move
#include <vector>
#include "ftxui/dom/elements.hpp" // for Element, Elements, dbox
#include "ftxui/dom/node.hpp" // for Node, Elements
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/pixel.hpp" // for Pixel
namespace ftxui {
@@ -49,12 +52,13 @@ class DBox : public Node {
void Render(Screen& screen) override {
if (children_.size() <= 1) {
return Node::Render(screen);
Node::Render(screen);
return;
}
const int width = box_.x_max - box_.x_min + 1;
const int height = box_.y_max - box_.y_min + 1;
std::vector<Pixel> pixels(size_t(width * height));
std::vector<Pixel> pixels(std::size_t(width * height));
for (auto& child : children_) {
child->Render(screen);
@@ -67,7 +71,7 @@ class DBox : public Node {
acc->background_color =
Color::Blend(acc->background_color, pixel.background_color);
acc->automerge = pixel.automerge || acc->automerge;
if (pixel.character == "") {
if (pixel.character.empty()) {
acc->foreground_color =
Color::Blend(acc->foreground_color, pixel.background_color);
} else {
@@ -82,7 +86,7 @@ class DBox : public Node {
acc->character = pixel.character;
acc->foreground_color = pixel.foreground_color;
}
++acc;
++acc; // NOLINT
pixel = Pixel();
}
@@ -93,7 +97,7 @@ class DBox : public Node {
Pixel* acc = pixels.data();
for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; ++y) {
screen.PixelAt(x + box_.x_min, y + box_.y_min) = *acc++;
screen.PixelAt(x + box_.x_min, y + box_.y_min) = *acc++; // NOLINT
}
}
}

View File

@@ -3,7 +3,6 @@
// the LICENSE file.
#include <memory> // for make_shared, __shared_ptr_access
#include <utility> // for move
#include <vector> // for __alloc_traits<>::value_type
#include "ftxui/dom/elements.hpp" // for Element, unpack, filler, flex, flex_grow, flex_shrink, notflex, xflex, xflex_grow, xflex_shrink, yflex, yflex_grow, yflex_shrink
#include "ftxui/dom/node.hpp" // for Elements, Node

View File

@@ -7,6 +7,7 @@
#include <cstddef> // for size_t
#include <ftxui/dom/flexbox_config.hpp> // for FlexboxConfig, FlexboxConfig::Direction, FlexboxConfig::AlignContent, FlexboxConfig::JustifyContent, FlexboxConfig::Wrap, FlexboxConfig::Direction::RowInversed, FlexboxConfig::AlignItems, FlexboxConfig::Direction::Row, FlexboxConfig::Direction::Column, FlexboxConfig::Direction::ColumnInversed, FlexboxConfig::Wrap::WrapInversed, FlexboxConfig::AlignContent::Stretch, FlexboxConfig::JustifyContent::Stretch, FlexboxConfig::Wrap::Wrap, FlexboxConfig::AlignContent::Center, FlexboxConfig::AlignContent::FlexEnd, FlexboxConfig::AlignContent::FlexStart, FlexboxConfig::AlignContent::SpaceAround, FlexboxConfig::AlignContent::SpaceBetween, FlexboxConfig::AlignContent::SpaceEvenly, FlexboxConfig::AlignItems::Center, FlexboxConfig::AlignItems::FlexEnd, FlexboxConfig::AlignItems::FlexStart, FlexboxConfig::AlignItems::Stretch, FlexboxConfig::JustifyContent::Center, FlexboxConfig::JustifyContent::FlexEnd, FlexboxConfig::JustifyContent::FlexStart, FlexboxConfig::JustifyContent::SpaceAround, FlexboxConfig::JustifyContent::SpaceBetween, FlexboxConfig::JustifyContent::SpaceEvenly, FlexboxConfig::Wrap::NoWrap
#include <utility> // for swap, move
#include <vector>
#include "ftxui/dom/box_helper.hpp" // for Element, Compute
@@ -330,8 +331,8 @@ void Compute3(Global& global) {
line = Line();
}
block.line = lines.size();
block.line_position = line.blocks.size();
block.line = static_cast<int>(lines.size());
block.line_position = static_cast<int>(line.blocks.size());
line.blocks.push_back(&block);
x += block.min_size_x + global.config.gap_x;
}

View File

@@ -32,7 +32,7 @@ class Reflect : public Node {
void Render(Screen& screen) final {
reflected_box_ = Box::Intersection(screen.stencil, reflected_box_);
return Node::Render(screen);
Node::Render(screen);
}
private:

View File

@@ -11,6 +11,7 @@
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/color.hpp" // for Color
#include "ftxui/screen/pixel.hpp" // for Pixel
#include "ftxui/screen/screen.hpp" // for Pixel, Screen
namespace ftxui {
@@ -63,7 +64,8 @@ class SeparatorAuto : public Node {
const bool is_column = (box_.x_max == box_.x_min);
const bool is_line = (box_.y_min == box_.y_max);
const std::string c = charsets[style_][int(is_line && !is_column)];
const std::string c =
charsets[style_][int(is_line && !is_column)]; // NOLINT
for (int y = box_.y_min; y <= box_.y_max; ++y) {
for (int x = box_.x_min; x <= box_.x_max; ++x) {

View File

@@ -6,6 +6,7 @@
#include <algorithm> // for max
#include <memory> // for allocator, shared_ptr, allocator_traits<>::value_type
#include <utility> // for move, swap
#include <vector> // for vector
#include "ftxui/dom/elements.hpp" // for Element, operator|, text, separatorCharacter, Elements, BorderStyle, Decorator, emptyElement, size, gridbox, EQUAL, flex, flex_shrink, HEIGHT, WIDTH