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

@@ -1,14 +1,16 @@
#include <stddef.h> // for size_t
#include <memory> // for allocator, allocator_traits<>::value_type
#include <string> // for basic_string, string
#include <utility> // for move
#include <vector> // for vector, __alloc_traits<>::value_type
#include <cstddef> // for size_t
#include <memory> // for allocator, allocator_traits<>::value_type
#include <string> // for basic_string, string
#include <utility> // for move
#include <vector> // for vector, __alloc_traits<>::value_type
#include "ftxui/dom/elements.hpp" // for Element, gauge, text, vbox, spinner
namespace ftxui {
static const std::vector<std::vector<std::vector<std::string>>> elements = {
namespace {
// NOLINTNEXTLINE
const std::vector<std::vector<std::vector<std::string>>> elements = {
{
{"Replaced by the gauge"},
},
@@ -246,6 +248,8 @@ static const std::vector<std::vector<std::vector<std::string>>> elements = {
" LOLLOL ",
}}};
} // namespace
/// @brief Useful to represent the effect of time and/or events. This display an
/// ASCII art "video".
/// @param charset_index The type of "video".
@@ -254,16 +258,19 @@ static const std::vector<std::vector<std::vector<std::string>>> elements = {
/// @ingroup dom
Element spinner(int charset_index, size_t image_index) {
if (charset_index == 0) {
image_index %= 40;
if (image_index > 20)
image_index = 40 - image_index;
return gauge(image_index * 0.05);
const int progress_size = 40;
image_index %= progress_size;
if (image_index > progress_size / 2) {
image_index = progress_size - image_index;
}
return gauge(float(image_index) * 0.05F); // NOLINT
}
charset_index %= elements.size();
image_index %= elements[charset_index].size();
charset_index %= (int)elements.size();
image_index %= (int)elements[charset_index].size();
std::vector<Element> lines;
for (const auto& it : elements[charset_index][image_index])
for (const auto& it : elements[charset_index][image_index]) {
lines.push_back(text(it));
}
return vbox(std::move(lines));
}