From 20a05e99ca1b9d7ffbb2e79320be075e3a13fadf Mon Sep 17 00:00:00 2001 From: ArthurSonzogni Date: Mon, 21 Jun 2021 23:08:39 +0200 Subject: [PATCH] Execute IWYU and format. --- doc/example_list.md | 4 +- examples/component/resizable_split.cpp | 7 +++- include/ftxui/component/receiver.hpp | 2 +- src/ftxui/component/component_test.cpp | 9 ++--- src/ftxui/component/resizable_split.cpp | 38 ++++++++++++------- src/ftxui/component/terminal_input_parser.cpp | 2 +- .../component/terminal_input_parser_test.cpp | 14 +++---- .../terminal_input_parser_test_fuzz.cpp | 6 ++- 8 files changed, 51 insertions(+), 31 deletions(-) diff --git a/doc/example_list.md b/doc/example_list.md index e7b25c8..89dee95 100644 --- a/doc/example_list.md +++ b/doc/example_list.md @@ -29,13 +29,13 @@ @example ./examples/component/checkbox.cpp @example ./examples/component/checkbox_in_frame.cpp @example ./examples/component/menu2.cpp +@example ./examples/component/resizable_split.cpp @example ./examples/component/tab_horizontal.cpp @example ./examples/component/slider.cpp -@example ./examples/component/slider_rgb.cpp @example ./examples/component/input.cpp @example ./examples/component/homescreen.cpp @example ./examples/component/radiobox.cpp -@example ./examples/component/resizable_split.cpp +@example ./examples/component/slider_rgb.cpp @example ./examples/component/menu.cpp @example ./examples/component/menu_style.cpp @example ./examples/component/radiobox_in_frame.cpp diff --git a/examples/component/resizable_split.cpp b/examples/component/resizable_split.cpp index 4f81697..cd925f8 100644 --- a/examples/component/resizable_split.cpp +++ b/examples/component/resizable_split.cpp @@ -1,5 +1,10 @@ -#include "ftxui/component/component.hpp" // for Slider +#include // for shared_ptr, allocator, __shared_ptr_access + +#include "ftxui/component/captured_mouse.hpp" // for ftxui +#include "ftxui/component/component.hpp" // for Renderer, ResizableSplitBottom, ResizableSplitLeft, ResizableSplitRight, ResizableSplitTop +#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive +#include "ftxui/dom/elements.hpp" // for Element, operator|, text, center, border using namespace ftxui; diff --git a/include/ftxui/component/receiver.hpp b/include/ftxui/component/receiver.hpp index c41c7e8..d257988 100644 --- a/include/ftxui/component/receiver.hpp +++ b/include/ftxui/component/receiver.hpp @@ -1,7 +1,7 @@ #ifndef FTXUI_COMPONENT_RECEIVER_HPP_ #define FTXUI_COMPONENT_RECEIVER_HPP_ -#include // for copy, max +#include // for copy #include // for atomic, __atomic_base #include // for condition_variable #include diff --git a/src/ftxui/component/component_test.cpp b/src/ftxui/component/component_test.cpp index 20792fc..cfa46d7 100644 --- a/src/ftxui/component/component_test.cpp +++ b/src/ftxui/component/component_test.cpp @@ -1,9 +1,8 @@ -#include // for Message -#include // for TestPartResult, SuiteApiResolver, TestFactoryImpl -#include // for __shared_ptr_access, shared_ptr, allocator +#include // for Test, SuiteApiResolver, TestInfo (ptr only), TEST, TestFactoryImpl +#include // for shared_ptr, allocator, make_shared, __shared_ptr_access -#include "ftxui/component/component_base.hpp" -#include "gtest/gtest_pred_impl.h" // for AssertionResult, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, Test, TEST +#include "ftxui/component/captured_mouse.hpp" // for ftxui +#include "ftxui/component/component_base.hpp" // for ComponentBase, Component using namespace ftxui; diff --git a/src/ftxui/component/resizable_split.cpp b/src/ftxui/component/resizable_split.cpp index 137d762..3ee7d14 100644 --- a/src/ftxui/component/resizable_split.cpp +++ b/src/ftxui/component/resizable_split.cpp @@ -1,8 +1,13 @@ +#include // for __shared_ptr_access +#include // for move + #include "ftxui/component/captured_mouse.hpp" // for CapturedMouse -#include "ftxui/component/component.hpp" -#include "ftxui/component/component_base.hpp" -#include "ftxui/component/event.hpp" -#include "ftxui/dom/elements.hpp" +#include "ftxui/component/component.hpp" // for Component, Make, Horizontal, Vertical, ResizableSplitBottom, ResizableSplitLeft, ResizableSplitRight, ResizableSplitTop +#include "ftxui/component/component_base.hpp" // for ComponentBase +#include "ftxui/component/event.hpp" // for Event +#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left, Mouse::Pressed, Mouse::Released +#include "ftxui/dom/elements.hpp" // for operator|, reflect, Element, separator, size, EQUAL, xflex, yflex, hbox, vbox, HEIGHT, WIDTH +#include "ftxui/screen/box.hpp" // for Box namespace ftxui { namespace { @@ -63,7 +68,7 @@ class ResizableSplitLeftBase : public ComponentBase { Box global_box_; }; -class ResizableSplitRightBase: public ComponentBase { +class ResizableSplitRightBase : public ComponentBase { public: ResizableSplitRightBase(Component main, Component child, int* main_size) : main_(main), child_(child), main_size_(main_size) { @@ -119,7 +124,7 @@ class ResizableSplitRightBase: public ComponentBase { Box global_box_; }; -class ResizableSplitTopBase: public ComponentBase { +class ResizableSplitTopBase : public ComponentBase { public: ResizableSplitTopBase(Component main, Component child, int* main_size) : main_(main), child_(child), main_size_(main_size) { @@ -175,7 +180,7 @@ class ResizableSplitTopBase: public ComponentBase { Box global_box_; }; -class ResizableSplitBottomBase: public ComponentBase { +class ResizableSplitBottomBase : public ComponentBase { public: ResizableSplitBottomBase(Component main, Component child, int* main_size) : main_(main), child_(child), main_size_(main_size) { @@ -254,12 +259,13 @@ class ResizableSplitBottomBase: public ComponentBase { /// ### Output /// /// ```bash -/// │ -/// left │ right -/// │ +/// │ +/// left │ right +/// │ /// ``` Component ResizableSplitLeft(Component main, Component back, int* main_size) { - return Make(std::move(main), std::move(back), main_size); + return Make(std::move(main), std::move(back), + main_size); } /// @brief An horizontal split in between two components, configurable using the @@ -318,7 +324,8 @@ Component ResizableSplitRight(Component main, Component back, int* main_size) { /// bottom /// ``` Component ResizableSplitTop(Component main, Component back, int* main_size) { - return Make(std::move(main), std::move(back), main_size); + return Make(std::move(main), std::move(back), + main_size); } /// @brief An vertical split in between two components, configurable using the @@ -347,6 +354,11 @@ Component ResizableSplitTop(Component main, Component back, int* main_size) { /// bottom /// ``` Component ResizableSplitBottom(Component main, Component back, int* main_size) { - return Make(std::move(main), std::move(back), main_size); + return Make(std::move(main), std::move(back), + main_size); } } // namespace ftxui + +// Copyright 2021 Arthur Sonzogni. All rights reserved. +// Use of this source code is governed by the MIT license that can be found in +// the LICENSE file. diff --git a/src/ftxui/component/terminal_input_parser.cpp b/src/ftxui/component/terminal_input_parser.cpp index fb7e3ad..7091ab1 100644 --- a/src/ftxui/component/terminal_input_parser.cpp +++ b/src/ftxui/component/terminal_input_parser.cpp @@ -118,7 +118,7 @@ TerminalInputParser::Output TerminalInputParser::ParseUTF8() { // Find the first zero in the first byte. int first_zero = 8; - for(int i = 0; i<8; ++i) { + for (int i = 0; i < 8; ++i) { mask |= selector; if (head & selector) { selector >>= 1; diff --git a/src/ftxui/component/terminal_input_parser_test.cpp b/src/ftxui/component/terminal_input_parser_test.cpp index 17d5765..61e4bc3 100644 --- a/src/ftxui/component/terminal_input_parser_test.cpp +++ b/src/ftxui/component/terminal_input_parser_test.cpp @@ -173,7 +173,7 @@ TEST(Event, UTF8) { {{0b1110'0000, 0b1000'0000, 0b1000'0000}, false}, {{0b1111'0000, 0b1000'0000, 0b1000'0000, 0b1000'0000}, false}, - // Test limits in between the various legal regions + // Test limits in between the various legal regions // https://unicode.org/versions/corrigendum1.html // Limit in between the valid and ina // {{0x7F}, true}, => Special sequence. @@ -195,22 +195,22 @@ TEST(Event, UTF8) { {{0xE1, 0x7F, 0x80}, false}, {{0xE1, 0x80, 0x7f}, false}, {{0xE1, 0x80, 0x80}, true}, - // -- + // -- {{0xEF, 0xBF, 0xBF}, true}, {{0xEF, 0xC0, 0xBF}, false}, {{0xEF, 0xBF, 0xC0}, false}, - // -- + // -- {{0xF0, 0x90, 0x80}, false}, {{0xF0, 0x8F, 0x80, 0x80}, false}, {{0xF0, 0x90, 0x80, 0x7F}, false}, {{0xF0, 0x90, 0x80, 0x80}, true}, - // -- + // -- {{0xF1, 0x80, 0x80, 0x80}, true}, - // -- + // -- {{0xF1, 0xBF, 0xBF, 0xBF}, true}, - // -- + // -- {{0xF2, 0x80, 0x80, 0x80}, true}, - // -- + // -- {{0xF4, 0x8F, 0xBF, 0xBF}, true}, {{0xF4, 0x90, 0xBF, 0xBF}, false}, diff --git a/src/ftxui/component/terminal_input_parser_test_fuzz.cpp b/src/ftxui/component/terminal_input_parser_test_fuzz.cpp index a1897a7..6dd4946 100644 --- a/src/ftxui/component/terminal_input_parser_test_fuzz.cpp +++ b/src/ftxui/component/terminal_input_parser_test_fuzz.cpp @@ -1,7 +1,7 @@ //#include "ftxui/component/event.hpp" //#include "ftxui/component/receiver.hpp" -#include "ftxui/component/terminal_input_parser.hpp" #include +#include "ftxui/component/terminal_input_parser.hpp" extern "C" int LLVMFuzzerTestOneInput(const char* data, size_t size) { using namespace ftxui; @@ -17,3 +17,7 @@ extern "C" int LLVMFuzzerTestOneInput(const char* data, size_t size) { ; return 0; // Non-zero return values are reserved for future use. } + +// Copyright 2021 Arthur Sonzogni. All rights reserved. +// Use of this source code is governed by the MIT license that can be found in +// the LICENSE file.