mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-10-01 17:29:07 +08:00
Add clang-tidy. (#368)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <functional> // for function
|
||||
#include <memory> // for allocator, make_shared
|
||||
#include <string> // for string
|
||||
#include <utility> // for move
|
||||
#include <vector> // for vector
|
||||
|
||||
#include "ftxui/dom/elements.hpp" // for GraphFunction, Element, graph
|
||||
@@ -11,6 +12,7 @@
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
// NOLINTNEXTLINE
|
||||
static std::string charset[] =
|
||||
#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
|
||||
// Microsoft's terminals often use fonts not handling the 8 unicode
|
||||
@@ -22,7 +24,8 @@ static std::string charset[] =
|
||||
|
||||
class Graph : public Node {
|
||||
public:
|
||||
Graph(GraphFunction graph_function) : graph_function_(graph_function) {}
|
||||
explicit Graph(GraphFunction graph_function)
|
||||
: graph_function_(std::move(graph_function)) {}
|
||||
|
||||
void ComputeRequirement() override {
|
||||
requirement_.flex_grow_x = 1;
|
||||
@@ -43,9 +46,9 @@ class Graph : public Node {
|
||||
int height_2 = 2 * box_.y_max - data[i++];
|
||||
for (int y = box_.y_min; y <= box_.y_max; ++y) {
|
||||
int yy = 2 * y;
|
||||
int i_1 = yy < height_1 ? 0 : yy == height_1 ? 3 : 6;
|
||||
int i_2 = yy < height_2 ? 0 : yy == height_2 ? 1 : 2;
|
||||
screen.at(x, y) = charset[i_1 + i_2];
|
||||
int i_1 = yy < height_1 ? 0 : yy == height_1 ? 3 : 6; // NOLINT
|
||||
int i_2 = yy < height_2 ? 0 : yy == height_2 ? 1 : 2; // NOLINT
|
||||
screen.at(x, y) = charset[i_1 + i_2]; // NOLINT
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,7 +60,7 @@ class Graph : public Node {
|
||||
/// @brief Draw a graph using a GraphFunction.
|
||||
/// @param graph_function the function to be called to get the data.
|
||||
Element graph(GraphFunction graph_function) {
|
||||
return std::make_shared<Graph>(graph_function);
|
||||
return std::make_shared<Graph>(std::move(graph_function));
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
Reference in New Issue
Block a user