From fcc49fdce7104f52b2104d9c08dd7851f63ab854 Mon Sep 17 00:00:00 2001 From: ArthurSonzogni Date: Fri, 14 May 2021 22:00:49 +0200 Subject: [PATCH] Format using iwyu. --- examples/dom/hflow.cpp | 15 ++++++++------- examples/dom/html_like.cpp | 19 ++++++++++--------- include/ftxui/component/component.hpp | 3 +-- include/ftxui/component/receiver.hpp | 10 ++++++---- .../ftxui/component/screen_interactive.hpp | 10 +++++----- iwyu.imp | 12 ++++++------ src/ftxui/component/checkbox.cpp | 2 +- src/ftxui/component/component.cpp | 7 +++---- src/ftxui/component/container.cpp | 9 ++++----- src/ftxui/component/container_test.cpp | 12 +++++++++--- src/ftxui/component/menu.cpp | 9 ++++----- src/ftxui/component/screen_interactive.cpp | 4 ++-- src/ftxui/component/terminal_input_parser.cpp | 7 +++++-- src/ftxui/component/terminal_input_parser.hpp | 5 +++-- .../component/terminal_input_parser_test.cpp | 9 ++++++--- src/ftxui/dom/border.cpp | 11 +++++------ src/ftxui/dom/flex.cpp | 7 +++---- src/ftxui/dom/frame.cpp | 9 ++++----- src/ftxui/dom/node_decorator.cpp | 5 ++--- src/ftxui/dom/reflect.cpp | 7 +++---- src/ftxui/dom/size.cpp | 11 +++++------ src/ftxui/dom/spinner.cpp | 11 +++++------ src/ftxui/dom/util.cpp | 1 + src/ftxui/screen/screen.cpp | 3 +-- tools/iwyu.sh | 6 ++++-- 25 files changed, 106 insertions(+), 98 deletions(-) diff --git a/examples/dom/hflow.cpp b/examples/dom/hflow.cpp index 6d2cb9d..02b9a71 100644 --- a/examples/dom/hflow.cpp +++ b/examples/dom/hflow.cpp @@ -1,11 +1,12 @@ -#include -#include -#include -#include -#include +#include // for size_t +#include // for operator|, size, Element, text, hcenter, Decorator, WIDTH, hflow, window, EQUAL, GREATER_THAN, HEIGHT, bold, border, dim, LESS_THAN +#include // for Dimension, Screen +#include // for to_wstring +#include // for shared_ptr +#include // for allocator, operator+, char_traits, wstring -#include "ftxui/dom/node.hpp" -#include "ftxui/screen/box.hpp" +#include "ftxui/dom/node.hpp" // for Render +#include "ftxui/screen/box.hpp" // for ftxui int main(int argc, const char* argv[]) { using namespace ftxui; diff --git a/examples/dom/html_like.cpp b/examples/dom/html_like.cpp index 4f60287..c125267 100644 --- a/examples/dom/html_like.cpp +++ b/examples/dom/html_like.cpp @@ -1,13 +1,14 @@ -#include -#include -#include -#include -#include -#include +#include // for operator""s, chrono_literals +#include // for paragraph, text, operator|, Element, border, color, hflow, spinner, vbox, bold, dim, underlined +#include // for Screen, Dimension +#include // for cout, ostream +#include // for shared_ptr +#include // for allocator, operator<<, string +#include // for sleep_for -#include "ftxui/dom/node.hpp" -#include "ftxui/screen/box.hpp" -#include "ftxui/screen/color.hpp" +#include "ftxui/dom/node.hpp" // for Render +#include "ftxui/screen/box.hpp" // for ftxui +#include "ftxui/screen/color.hpp" // for Color, Color::Red int main(int argc, const char* argv[]) { using namespace ftxui; diff --git a/include/ftxui/component/component.hpp b/include/ftxui/component/component.hpp index cebbc54..11abf6d 100644 --- a/include/ftxui/component/component.hpp +++ b/include/ftxui/component/component.hpp @@ -30,7 +30,6 @@ Component Radiobox(const std::vector* entries, int* selected_); Component Toggle(const std::vector* entries, int* selected); Component Renderer(Component child, std::function); Component Renderer(std::function); - template // T = {int, float} Component Slider(StringRef label, T* value, T min, T max, T increment); @@ -40,7 +39,7 @@ Component Horizontal(Components children); Component Tab(int* selector, Components children); } // namespace Container -}; // namespace ftxui +} // namespace ftxui #endif /* end of include guard: FTXUI_COMPONENT_HPP */ diff --git a/include/ftxui/component/receiver.hpp b/include/ftxui/component/receiver.hpp index 8b236c3..2f35f44 100644 --- a/include/ftxui/component/receiver.hpp +++ b/include/ftxui/component/receiver.hpp @@ -1,13 +1,15 @@ #ifndef FTXUI_COMPONENT_RECEIVER_HPP_ #define FTXUI_COMPONENT_RECEIVER_HPP_ -#include // for atomic +#include // for copy, max +#include // for atomic, __atomic_base #include // for condition_variable #include #include -#include // for unique_ptr, make_unique -#include // for mutex, unique_lock -#include // for queue +#include // for unique_ptr, make_unique +#include // for mutex, unique_lock +#include // for queue +#include // for move namespace ftxui { diff --git a/include/ftxui/component/screen_interactive.hpp b/include/ftxui/component/screen_interactive.hpp index 0b477d1..827602f 100644 --- a/include/ftxui/component/screen_interactive.hpp +++ b/include/ftxui/component/screen_interactive.hpp @@ -1,11 +1,11 @@ #ifndef FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP #define FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP -#include // for atomic -#include -#include // for function -#include // for unique_ptr, shared_ptr -#include // for string +#include // for atomic +#include // for Receiver, Sender +#include // for function +#include // for shared_ptr +#include // for string #include "ftxui/component/captured_mouse.hpp" // for CapturedMouse #include "ftxui/component/event.hpp" diff --git a/iwyu.imp b/iwyu.imp index 388878c..e1a5d3b 100644 --- a/iwyu.imp +++ b/iwyu.imp @@ -1,11 +1,11 @@ [ - { symbol: [ "VMIN", private, "", public ] }, - { symbol: [ "VTIME", private, "", public ] }, { symbol: [ "ECHO", private, "", public ] }, { symbol: [ "ICANON", private, "", public ] }, - { symbol: [ "termios", private, "", public ] }, { symbol: [ "TCSANOW", private, "", public ] }, - { symbol: [ "__shared_ptr_access", private, "", public ] }, - { symbol: [ "ftxui", private , "", public ] }, - { include: ["ext/alloc_traits.h", "private", "", "public"] } + { symbol: [ "VMIN", private, "", public ] }, + { symbol: [ "VTIME", private, "", public ] }, + { symbol: [ "__shared_ptr_access", private, "", public ] }, + { symbol: [ "termios", private, "", public ] }, + { symbol: ["__alloc_traits<>:value_type", private, "", public ] }, + { include: ["", private, "", public] }, ] diff --git a/src/ftxui/component/checkbox.cpp b/src/ftxui/component/checkbox.cpp index d440bda..f3cd1c5 100644 --- a/src/ftxui/component/checkbox.cpp +++ b/src/ftxui/component/checkbox.cpp @@ -35,7 +35,7 @@ Component Checkbox(ConstStringRef label, bool* checked) { } // static -CheckboxBase* From(Component component) { +CheckboxBase* CheckboxBase::From(Component component) { return static_cast(component.get()); } diff --git a/src/ftxui/component/component.cpp b/src/ftxui/component/component.cpp index 7f13276..1459ef7 100644 --- a/src/ftxui/component/component.cpp +++ b/src/ftxui/component/component.cpp @@ -1,7 +1,6 @@ -#include // for find_if -#include // for __alloc_traits<>::value_type -#include // for begin, end -#include // for move +#include // for find_if, max +#include // for begin, end +#include // for move #include "ftxui/component/captured_mouse.hpp" // for CapturedMouse, CapturedMouseInterface #include "ftxui/component/component.hpp" diff --git a/src/ftxui/component/container.cpp b/src/ftxui/component/container.cpp index a9d372b..361096b 100644 --- a/src/ftxui/component/container.cpp +++ b/src/ftxui/component/container.cpp @@ -1,9 +1,8 @@ -#include // for size_t -#include // for max, min -#include // for __alloc_traits<>::value_type -#include // for __shared_ptr_access, shared_ptr, make_shared, __shared_ptr_access<>::element_type, allocator_traits<>::value_type +#include // for size_t +#include // for max, min +#include // for __shared_ptr_access, shared_ptr, make_shared, allocator, __shared_ptr_access<>::element_type, allocator_traits<>::value_type #include // for move -#include // for vector, allocator +#include // for vector, __alloc_traits<>::value_type #include "ftxui/component/container.hpp" diff --git a/src/ftxui/component/container_test.cpp b/src/ftxui/component/container_test.cpp index 13cc19f..9c51c7b 100644 --- a/src/ftxui/component/container_test.cpp +++ b/src/ftxui/component/container_test.cpp @@ -10,7 +10,9 @@ using namespace ftxui; TEST(ContainerTest, HorizontalEvent) { auto container = ContainerBase::Horizontal(); - Component c0, c1, c2; + auto c0 = Container::Horizontal({}); + auto c1 = Container::Horizontal({}); + auto c2 = Container::Horizontal({}); container->Add(c0); container->Add(c1); container->Add(c2); @@ -81,7 +83,9 @@ TEST(ContainerTest, HorizontalEvent) { TEST(ContainerTest, VerticalEvent) { auto container = ContainerBase::Vertical(); - Component c0, c1, c2; + auto c0 = Container::Horizontal({}); + auto c1 = Container::Horizontal({}); + auto c2 = Container::Horizontal({}); container->Add(c0); container->Add(c1); container->Add(c2); @@ -152,7 +156,9 @@ TEST(ContainerTest, VerticalEvent) { TEST(ContainerTest, SetActiveChild) { auto container = ContainerBase::Horizontal(); - Component c0, c1, c2; + auto c0 = Container::Horizontal({}); + auto c1 = Container::Horizontal({}); + auto c2 = Container::Horizontal({}); container->Add(c0); container->Add(c1); container->Add(c2); diff --git a/src/ftxui/component/menu.cpp b/src/ftxui/component/menu.cpp index 59c3583..86a1204 100644 --- a/src/ftxui/component/menu.cpp +++ b/src/ftxui/component/menu.cpp @@ -1,8 +1,7 @@ -#include // for size_t -#include // for max, min -#include // for __alloc_traits<>::value_type -#include // for shared_ptr, allocator_traits<>::value_type -#include // for move +#include // for size_t +#include // for max, min +#include // for shared_ptr, allocator_traits<>::value_type +#include // for move #include "ftxui/component/captured_mouse.hpp" // for CapturedMouse #include "ftxui/component/event.hpp" // for Event, Event::ArrowDown, Event::ArrowUp, Event::Return, Event::Tab, Event::TabReverse diff --git a/src/ftxui/component/screen_interactive.cpp b/src/ftxui/component/screen_interactive.cpp index 21fa886..f1318ee 100644 --- a/src/ftxui/component/screen_interactive.cpp +++ b/src/ftxui/component/screen_interactive.cpp @@ -31,8 +31,8 @@ #endif #else #include // for select, FD_ISSET, FD_SET, FD_ZERO, fd_set -#include // for tcsetattr, termios, tcgetattr, TCSANOW, cc_t, ECHO, ICANON, VMIN, VTIME -#include // for STDIN_FILENO, read +#include // for tcsetattr, tcgetattr, cc_t +#include // for STDIN_FILENO, read #endif // Quick exit is missing in standard CLang headers diff --git a/src/ftxui/component/terminal_input_parser.cpp b/src/ftxui/component/terminal_input_parser.cpp index acab8e4..63c57ae 100644 --- a/src/ftxui/component/terminal_input_parser.cpp +++ b/src/ftxui/component/terminal_input_parser.cpp @@ -1,7 +1,10 @@ #include "ftxui/component/terminal_input_parser.hpp" -#include -#include "ftxui/component/event.hpp" +#include // for max +#include // for unique_ptr +#include // for move + +#include "ftxui/component/event.hpp" // for Event namespace ftxui { diff --git a/src/ftxui/component/terminal_input_parser.hpp b/src/ftxui/component/terminal_input_parser.hpp index 69645a6..244e843 100644 --- a/src/ftxui/component/terminal_input_parser.hpp +++ b/src/ftxui/component/terminal_input_parser.hpp @@ -5,11 +5,12 @@ #include // for string #include // for vector -#include "ftxui/component/event.hpp" // IWYU pragma: keep +#include "ftxui/component/event.hpp" // for Event (ptr only) #include "ftxui/component/mouse.hpp" // for Mouse -#include "ftxui/component/receiver.hpp" // for SenderImpl +#include "ftxui/component/receiver.hpp" // for Sender namespace ftxui { +struct Event; // Parse a sequence of |char| accross |time|. Produces |Event|. class TerminalInputParser { diff --git a/src/ftxui/component/terminal_input_parser_test.cpp b/src/ftxui/component/terminal_input_parser_test.cpp index b37b216..f2ca2d8 100644 --- a/src/ftxui/component/terminal_input_parser_test.cpp +++ b/src/ftxui/component/terminal_input_parser_test.cpp @@ -1,9 +1,12 @@ -#include // for Message -#include // for TestPartResult +#include // for Message +#include // for TestPartResult, SuiteApiResolver, TestFactoryImpl +#include // for max +#include // for unique_ptr, allocator +#include "ftxui/component/event.hpp" // for Event, Event::Escape #include "ftxui/component/receiver.hpp" // for MakeReceiver, ReceiverImpl #include "ftxui/component/terminal_input_parser.hpp" -#include "gtest/gtest_pred_impl.h" // for AssertionResult, Test, Suite... +#include "gtest/gtest_pred_impl.h" // for AssertionResult, Test, EXPECT_EQ, EXPECT_TRUE, EXPECT_FALSE, TEST using namespace ftxui; diff --git a/src/ftxui/dom/border.cpp b/src/ftxui/dom/border.cpp index f543498..feacaaf 100644 --- a/src/ftxui/dom/border.cpp +++ b/src/ftxui/dom/border.cpp @@ -1,9 +1,8 @@ -#include // for max -#include // for __alloc_traits<>::value_type -#include // for begin, end -#include // for make_shared, __shared_ptr_access -#include // for move -#include // for vector +#include // for max +#include // for begin, end +#include // for make_shared, __shared_ptr_access +#include // for move +#include // for vector, __alloc_traits<>::value_type #include "ftxui/dom/elements.hpp" // for unpack, Element, Decorator, Elements, border, borderWith, window #include "ftxui/dom/node.hpp" // for Node diff --git a/src/ftxui/dom/flex.cpp b/src/ftxui/dom/flex.cpp index b8aa282..3ad4a51 100644 --- a/src/ftxui/dom/flex.cpp +++ b/src/ftxui/dom/flex.cpp @@ -1,7 +1,6 @@ -#include // for __alloc_traits<>::value_type -#include // for make_shared, __shared_ptr_access -#include // for move -#include // for vector +#include // for make_shared, __shared_ptr_access +#include // for move +#include // for vector, __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 Node diff --git a/src/ftxui/dom/frame.cpp b/src/ftxui/dom/frame.cpp index 9d4b2e5..6ee8c44 100644 --- a/src/ftxui/dom/frame.cpp +++ b/src/ftxui/dom/frame.cpp @@ -1,8 +1,7 @@ -#include // for max, min -#include // for __alloc_traits<>::value_type -#include // for make_shared, shared_ptr, __shared_ptr_access -#include // for move -#include // for vector +#include // for max, min +#include // for make_shared, shared_ptr, __shared_ptr_access +#include // for move +#include // for vector, __alloc_traits<>::value_type #include "ftxui/dom/elements.hpp" // for Element, unpack, focus, frame, select, xframe, yframe #include "ftxui/dom/node.hpp" // for Node diff --git a/src/ftxui/dom/node_decorator.cpp b/src/ftxui/dom/node_decorator.cpp index d12e2df..ec01d1c 100644 --- a/src/ftxui/dom/node_decorator.cpp +++ b/src/ftxui/dom/node_decorator.cpp @@ -1,6 +1,5 @@ -#include // for __alloc_traits<>::value_type -#include // for __shared_ptr_access -#include // for vector +#include // for __shared_ptr_access +#include // for __alloc_traits<>::value_type, vector #include "ftxui/dom/node_decorator.hpp" #include "ftxui/dom/requirement.hpp" // for Requirement diff --git a/src/ftxui/dom/reflect.cpp b/src/ftxui/dom/reflect.cpp index fa6167d..3c7c9ee 100644 --- a/src/ftxui/dom/reflect.cpp +++ b/src/ftxui/dom/reflect.cpp @@ -1,7 +1,6 @@ -#include // for __alloc_traits<>::value_type -#include // for make_shared, __shared_ptr_access -#include // for move -#include // for vector +#include // for make_shared, __shared_ptr_access +#include // for move +#include // for __alloc_traits<>::value_type, vector #include "ftxui/dom/elements.hpp" // for Element, unpack, Decorator, reflect #include "ftxui/dom/node.hpp" // for Node diff --git a/src/ftxui/dom/size.cpp b/src/ftxui/dom/size.cpp index 2004b13..ca564ea 100644 --- a/src/ftxui/dom/size.cpp +++ b/src/ftxui/dom/size.cpp @@ -1,9 +1,8 @@ -#include // for size_t -#include // for min, max -#include // for __alloc_traits<>::value_type -#include // for make_shared, __shared_ptr_access -#include // for move -#include // for vector +#include // for size_t +#include // for min, max +#include // for make_shared, __shared_ptr_access +#include // for move +#include // for __alloc_traits<>::value_type, vector #include "ftxui/dom/elements.hpp" // for Constraint, Direction, EQUAL, GREATER_THAN, LESS_THAN, WIDTH, unpack, Decorator, Element, size #include "ftxui/dom/node.hpp" // for Node diff --git a/src/ftxui/dom/spinner.cpp b/src/ftxui/dom/spinner.cpp index 2510edd..8d7a602 100644 --- a/src/ftxui/dom/spinner.cpp +++ b/src/ftxui/dom/spinner.cpp @@ -1,9 +1,8 @@ -#include // for size_t -#include // for __alloc_traits<>::value_type -#include // for allocator, allocator_traits<>::value_type -#include // for basic_string, wstring -#include // for move -#include // for vector +#include // for size_t +#include // for allocator, allocator_traits<>::value_type +#include // for basic_string, wstring +#include // for move +#include // for vector, __alloc_traits<>::value_type #include "ftxui/dom/elements.hpp" // for Element, gauge, text, vbox, spinner diff --git a/src/ftxui/dom/util.cpp b/src/ftxui/dom/util.cpp index 1770611..9a49161 100644 --- a/src/ftxui/dom/util.cpp +++ b/src/ftxui/dom/util.cpp @@ -1,5 +1,6 @@ #include // for function #include // for move +#include // for vector #include "ftxui/dom/elements.hpp" // for Decorator, Element, Elements, operator|, nothing diff --git a/src/ftxui/screen/screen.cpp b/src/ftxui/screen/screen.cpp index 4a1a022..5a3dbd1 100644 --- a/src/ftxui/screen/screen.cpp +++ b/src/ftxui/screen/screen.cpp @@ -1,5 +1,4 @@ -#include // for min -#include // for __alloc_traits<>::value_type +#include // for min #include // for operator<<, basic_ostream, wstringstream, stringstream, flush, cout, ostream #include // IWYU pragma: keep diff --git a/tools/iwyu.sh b/tools/iwyu.sh index 1e1f62b..88da55e 100755 --- a/tools/iwyu.sh +++ b/tools/iwyu.sh @@ -6,6 +6,8 @@ mkdir -p iwyu cd iwyu rm * -rf echo $CMAKE_CXX_INCLUDE_WHAT_YOU_USE -cmake .. -DFTXUI_BUILD_TESTS=ON -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="iwyu;-Xiwyu;--cxx17ns;-Xiwyu;--mapping_file=${mapping_dir}/iwyu.imp;-Xiwyu;--verbose=3" +cmake .. -DFTXUI_BUILD_TESTS=ON -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-Xiwyu;--cxx17ns;-Xiwyu;--mapping_file=${mapping_dir}/iwyu.imp;-Xiwyu;--verbose=3" make -j 2>out -fix_include --comments < out +fix_includes.py --comments < out + +../tools/format.sh