Execute IWYU and format.

This commit is contained in:
ArthurSonzogni 2021-06-21 23:08:39 +02:00 committed by Arthur Sonzogni
parent 91c5954fe2
commit 20a05e99ca
8 changed files with 51 additions and 31 deletions

View File

@ -29,13 +29,13 @@
@example ./examples/component/checkbox.cpp @example ./examples/component/checkbox.cpp
@example ./examples/component/checkbox_in_frame.cpp @example ./examples/component/checkbox_in_frame.cpp
@example ./examples/component/menu2.cpp @example ./examples/component/menu2.cpp
@example ./examples/component/resizable_split.cpp
@example ./examples/component/tab_horizontal.cpp @example ./examples/component/tab_horizontal.cpp
@example ./examples/component/slider.cpp @example ./examples/component/slider.cpp
@example ./examples/component/slider_rgb.cpp
@example ./examples/component/input.cpp @example ./examples/component/input.cpp
@example ./examples/component/homescreen.cpp @example ./examples/component/homescreen.cpp
@example ./examples/component/radiobox.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.cpp
@example ./examples/component/menu_style.cpp @example ./examples/component/menu_style.cpp
@example ./examples/component/radiobox_in_frame.cpp @example ./examples/component/radiobox_in_frame.cpp

View File

@ -1,5 +1,10 @@
#include "ftxui/component/component.hpp" // for Slider #include <memory> // 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/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for Element, operator|, text, center, border
using namespace ftxui; using namespace ftxui;

View File

@ -1,7 +1,7 @@
#ifndef FTXUI_COMPONENT_RECEIVER_HPP_ #ifndef FTXUI_COMPONENT_RECEIVER_HPP_
#define FTXUI_COMPONENT_RECEIVER_HPP_ #define FTXUI_COMPONENT_RECEIVER_HPP_
#include <algorithm> // for copy, max #include <algorithm> // for copy
#include <atomic> // for atomic, __atomic_base #include <atomic> // for atomic, __atomic_base
#include <condition_variable> // for condition_variable #include <condition_variable> // for condition_variable
#include <functional> #include <functional>

View File

@ -1,9 +1,8 @@
#include <gtest/gtest-message.h> // for Message #include <gtest/gtest.h> // for Test, SuiteApiResolver, TestInfo (ptr only), TEST, TestFactoryImpl
#include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiResolver, TestFactoryImpl #include <memory> // for shared_ptr, allocator, make_shared, __shared_ptr_access
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include "ftxui/component/component_base.hpp" #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "gtest/gtest_pred_impl.h" // for AssertionResult, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, Test, TEST #include "ftxui/component/component_base.hpp" // for ComponentBase, Component
using namespace ftxui; using namespace ftxui;

View File

@ -1,8 +1,13 @@
#include <memory> // for __shared_ptr_access
#include <utility> // for move
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse #include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/component.hpp" #include "ftxui/component/component.hpp" // for Component, Make, Horizontal, Vertical, ResizableSplitBottom, ResizableSplitLeft, ResizableSplitRight, ResizableSplitTop
#include "ftxui/component/component_base.hpp" #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/event.hpp" #include "ftxui/component/event.hpp" // for Event
#include "ftxui/dom/elements.hpp" #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 ftxui {
namespace { namespace {
@ -63,7 +68,7 @@ class ResizableSplitLeftBase : public ComponentBase {
Box global_box_; Box global_box_;
}; };
class ResizableSplitRightBase: public ComponentBase { class ResizableSplitRightBase : public ComponentBase {
public: public:
ResizableSplitRightBase(Component main, Component child, int* main_size) ResizableSplitRightBase(Component main, Component child, int* main_size)
: main_(main), child_(child), main_size_(main_size) { : main_(main), child_(child), main_size_(main_size) {
@ -119,7 +124,7 @@ class ResizableSplitRightBase: public ComponentBase {
Box global_box_; Box global_box_;
}; };
class ResizableSplitTopBase: public ComponentBase { class ResizableSplitTopBase : public ComponentBase {
public: public:
ResizableSplitTopBase(Component main, Component child, int* main_size) ResizableSplitTopBase(Component main, Component child, int* main_size)
: main_(main), child_(child), main_size_(main_size) { : main_(main), child_(child), main_size_(main_size) {
@ -175,7 +180,7 @@ class ResizableSplitTopBase: public ComponentBase {
Box global_box_; Box global_box_;
}; };
class ResizableSplitBottomBase: public ComponentBase { class ResizableSplitBottomBase : public ComponentBase {
public: public:
ResizableSplitBottomBase(Component main, Component child, int* main_size) ResizableSplitBottomBase(Component main, Component child, int* main_size)
: main_(main), child_(child), main_size_(main_size) { : main_(main), child_(child), main_size_(main_size) {
@ -254,12 +259,13 @@ class ResizableSplitBottomBase: public ComponentBase {
/// ### Output /// ### Output
/// ///
/// ```bash /// ```bash
/// │ /// │
/// left │ right /// left │ right
/// │ /// │
/// ``` /// ```
Component ResizableSplitLeft(Component main, Component back, int* main_size) { Component ResizableSplitLeft(Component main, Component back, int* main_size) {
return Make<ResizableSplitLeftBase>(std::move(main), std::move(back), main_size); return Make<ResizableSplitLeftBase>(std::move(main), std::move(back),
main_size);
} }
/// @brief An horizontal split in between two components, configurable using the /// @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 /// bottom
/// ``` /// ```
Component ResizableSplitTop(Component main, Component back, int* main_size) { Component ResizableSplitTop(Component main, Component back, int* main_size) {
return Make<ResizableSplitTopBase>(std::move(main), std::move(back), main_size); return Make<ResizableSplitTopBase>(std::move(main), std::move(back),
main_size);
} }
/// @brief An vertical split in between two components, configurable using the /// @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 /// bottom
/// ``` /// ```
Component ResizableSplitBottom(Component main, Component back, int* main_size) { Component ResizableSplitBottom(Component main, Component back, int* main_size) {
return Make<ResizableSplitBottomBase>(std::move(main), std::move(back), main_size); return Make<ResizableSplitBottomBase>(std::move(main), std::move(back),
main_size);
} }
} // namespace ftxui } // 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.

View File

@ -118,7 +118,7 @@ TerminalInputParser::Output TerminalInputParser::ParseUTF8() {
// Find the first zero in the first byte. // Find the first zero in the first byte.
int first_zero = 8; int first_zero = 8;
for(int i = 0; i<8; ++i) { for (int i = 0; i < 8; ++i) {
mask |= selector; mask |= selector;
if (head & selector) { if (head & selector) {
selector >>= 1; selector >>= 1;

View File

@ -173,7 +173,7 @@ TEST(Event, UTF8) {
{{0b1110'0000, 0b1000'0000, 0b1000'0000}, false}, {{0b1110'0000, 0b1000'0000, 0b1000'0000}, false},
{{0b1111'0000, 0b1000'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 // https://unicode.org/versions/corrigendum1.html
// Limit in between the valid and ina // Limit in between the valid and ina
// {{0x7F}, true}, => Special sequence. // {{0x7F}, true}, => Special sequence.
@ -195,22 +195,22 @@ TEST(Event, UTF8) {
{{0xE1, 0x7F, 0x80}, false}, {{0xE1, 0x7F, 0x80}, false},
{{0xE1, 0x80, 0x7f}, false}, {{0xE1, 0x80, 0x7f}, false},
{{0xE1, 0x80, 0x80}, true}, {{0xE1, 0x80, 0x80}, true},
// -- // --
{{0xEF, 0xBF, 0xBF}, true}, {{0xEF, 0xBF, 0xBF}, true},
{{0xEF, 0xC0, 0xBF}, false}, {{0xEF, 0xC0, 0xBF}, false},
{{0xEF, 0xBF, 0xC0}, false}, {{0xEF, 0xBF, 0xC0}, false},
// -- // --
{{0xF0, 0x90, 0x80}, false}, {{0xF0, 0x90, 0x80}, false},
{{0xF0, 0x8F, 0x80, 0x80}, false}, {{0xF0, 0x8F, 0x80, 0x80}, false},
{{0xF0, 0x90, 0x80, 0x7F}, false}, {{0xF0, 0x90, 0x80, 0x7F}, false},
{{0xF0, 0x90, 0x80, 0x80}, true}, {{0xF0, 0x90, 0x80, 0x80}, true},
// -- // --
{{0xF1, 0x80, 0x80, 0x80}, true}, {{0xF1, 0x80, 0x80, 0x80}, true},
// -- // --
{{0xF1, 0xBF, 0xBF, 0xBF}, true}, {{0xF1, 0xBF, 0xBF, 0xBF}, true},
// -- // --
{{0xF2, 0x80, 0x80, 0x80}, true}, {{0xF2, 0x80, 0x80, 0x80}, true},
// -- // --
{{0xF4, 0x8F, 0xBF, 0xBF}, true}, {{0xF4, 0x8F, 0xBF, 0xBF}, true},
{{0xF4, 0x90, 0xBF, 0xBF}, false}, {{0xF4, 0x90, 0xBF, 0xBF}, false},

View File

@ -1,7 +1,7 @@
//#include "ftxui/component/event.hpp" //#include "ftxui/component/event.hpp"
//#include "ftxui/component/receiver.hpp" //#include "ftxui/component/receiver.hpp"
#include "ftxui/component/terminal_input_parser.hpp"
#include <vector> #include <vector>
#include "ftxui/component/terminal_input_parser.hpp"
extern "C" int LLVMFuzzerTestOneInput(const char* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const char* data, size_t size) {
using namespace ftxui; 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. 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.