mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-10-30 16:07:38 +08:00
Bring back C++17 minimal requirement. (#475)
This commit is contained in:
parent
1d76a2321c
commit
c8ec151154
@ -9,7 +9,6 @@ endif()
|
|||||||
function(ftxui_set_options library)
|
function(ftxui_set_options library)
|
||||||
set_target_properties(${library} PROPERTIES
|
set_target_properties(${library} PROPERTIES
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
CXX_STANDARD 20
|
|
||||||
OUTPUT_NAME "ftxui-${library}"
|
OUTPUT_NAME "ftxui-${library}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ target_include_directories(tests
|
|||||||
PRIVATE src
|
PRIVATE src
|
||||||
)
|
)
|
||||||
ftxui_set_options(tests)
|
ftxui_set_options(tests)
|
||||||
|
target_compile_features(tests PUBLIC cxx_std_20)
|
||||||
|
|
||||||
include(GoogleTest)
|
include(GoogleTest)
|
||||||
gtest_discover_tests(tests
|
gtest_discover_tests(tests
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
codecov:
|
codecov:
|
||||||
require_ci_to_pass: no
|
require_ci_to_pass: no
|
||||||
notify:
|
notify:
|
||||||
after_n_builds: 3
|
after_n_builds: 4
|
||||||
wait_for_ci: yes
|
wait_for_ci: yes
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#include <array> // for array
|
#include <array> // for array
|
||||||
#include <cmath> // for sin
|
#include <cmath> // for sin
|
||||||
#include <ftxui/component/component_base.hpp> // for ComponentBase
|
#include <ftxui/component/component_base.hpp> // for ComponentBase
|
||||||
#include <ftxui/dom/elements.hpp> // for size, GaugeDirection, GaugeDirection::Up, GREATER_THAN, HEIGHT
|
#include <ftxui/component/component_options.hpp> // for SliderOption
|
||||||
|
#include <ftxui/dom/elements.hpp> // for size, GREATER_THAN, GaugeDirection, GaugeDirection::Up, HEIGHT
|
||||||
|
#include <ftxui/util/ref.hpp> // for ConstRef, Ref
|
||||||
#include <memory> // for shared_ptr, __shared_ptr_access
|
#include <memory> // for shared_ptr, __shared_ptr_access
|
||||||
|
|
||||||
#include "ftxui/component/captured_mouse.hpp" // for ftxui
|
#include "ftxui/component/captured_mouse.hpp" // for ftxui
|
||||||
@ -19,12 +21,22 @@ int main(int argc, const char* argv[]) {
|
|||||||
|
|
||||||
auto layout_horizontal = Container::Horizontal({});
|
auto layout_horizontal = Container::Horizontal({});
|
||||||
for (int i = 0; i < values.size(); ++i) {
|
for (int i = 0; i < values.size(); ++i) {
|
||||||
|
// In C++17:
|
||||||
|
SliderOption<int> option;
|
||||||
|
option.value = &values[i];
|
||||||
|
option.max = 100;
|
||||||
|
option.increment = 5;
|
||||||
|
option.direction = GaugeDirection::Up;
|
||||||
|
layout_horizontal->Add(Slider<int>(option));
|
||||||
|
|
||||||
|
/* In C++20:
|
||||||
layout_horizontal->Add(Slider<int>({
|
layout_horizontal->Add(Slider<int>({
|
||||||
.value = &values[i],
|
.value = &values[i],
|
||||||
.max = 100,
|
.max = 100,
|
||||||
.increment = 5,
|
.increment = 5,
|
||||||
.direction = GaugeDirection::Up,
|
.direction = GaugeDirection::Up,
|
||||||
}));
|
}));
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
layout_horizontal |= size(HEIGHT, GREATER_THAN, 20);
|
layout_horizontal |= size(HEIGHT, GREATER_THAN, 20);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define FTXUI_SCREEN_SCREEN_HPP
|
#define FTXUI_SCREEN_SCREEN_HPP
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string> // for allocator, string, basic_string
|
#include <string> // for string, allocator, basic_string
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
#include "ftxui/screen/box.hpp" // for Box
|
#include "ftxui/screen/box.hpp" // for Box
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include <cmath> // IWYU pragma: keep
|
#include <cmath> // IWYU pragma: keep
|
||||||
#include <compare> // for operator<=, operator>=, partial_ordering
|
|
||||||
#include <ratio> // for ratio
|
#include <ratio> // for ratio
|
||||||
#include <utility> // for move
|
#include <utility> // for move
|
||||||
|
|
||||||
|
@ -26,8 +26,7 @@ class RadioboxBase : public ComponentBase {
|
|||||||
RadioboxBase(ConstStringListRef entries,
|
RadioboxBase(ConstStringListRef entries,
|
||||||
int* selected,
|
int* selected,
|
||||||
Ref<RadioboxOption> option)
|
Ref<RadioboxOption> option)
|
||||||
: entries_(entries), selected_(selected), option_(std::move(option)) {
|
: entries_(entries), selected_(selected), option_(std::move(option)) {}
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Element Render() override {
|
Element Render() override {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <algorithm> // for min
|
#include <algorithm> // for copy, max, min
|
||||||
#include <array> // for array
|
#include <array> // for array
|
||||||
#include <chrono> // for operator-, milliseconds, duration, operator<=>, time_point, common_type<>::type
|
#include <chrono> // for operator-, milliseconds, duration, operator>=, time_point, common_type<>::type
|
||||||
#include <compare> // for operator>=, strong_ordering
|
|
||||||
#include <csignal> // for signal, raise, SIGTSTP, SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, SIGWINCH
|
#include <csignal> // for signal, raise, SIGTSTP, SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, SIGWINCH
|
||||||
#include <cstdio> // for fileno, size_t, stdin
|
#include <cstdio> // for fileno, size_t, stdin
|
||||||
#include <ftxui/component/task.hpp> // for Task, Closure, AnimationTask
|
#include <ftxui/component/task.hpp> // for Task, Closure, AnimationTask
|
||||||
|
@ -266,12 +266,12 @@ Component Slider(ConstStringRef label,
|
|||||||
ConstRef<int> min,
|
ConstRef<int> min,
|
||||||
ConstRef<int> max,
|
ConstRef<int> max,
|
||||||
ConstRef<int> increment) {
|
ConstRef<int> increment) {
|
||||||
auto slider = Make<SliderBase<int>>(SliderOption<int>({
|
SliderOption<int> option;
|
||||||
.value = value,
|
option.value = value;
|
||||||
.min = min,
|
option.min = min;
|
||||||
.max = max,
|
option.max = max;
|
||||||
.increment = increment,
|
option.increment = increment;
|
||||||
}));
|
auto slider = Make<SliderBase<int>>(option);
|
||||||
return Make<SliderWithLabel>(label, slider);
|
return Make<SliderWithLabel>(label, slider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,12 +280,12 @@ Component Slider(ConstStringRef label,
|
|||||||
ConstRef<float> min,
|
ConstRef<float> min,
|
||||||
ConstRef<float> max,
|
ConstRef<float> max,
|
||||||
ConstRef<float> increment) {
|
ConstRef<float> increment) {
|
||||||
auto slider = Make<SliderBase<float>>(SliderOption<float>({
|
SliderOption<float> option;
|
||||||
.value = value,
|
option.value = value;
|
||||||
.min = min,
|
option.min = min;
|
||||||
.max = max,
|
option.max = max;
|
||||||
.increment = increment,
|
option.increment = increment;
|
||||||
}));
|
auto slider = Make<SliderBase<float>>(option);
|
||||||
return Make<SliderWithLabel>(label, slider);
|
return Make<SliderWithLabel>(label, slider);
|
||||||
}
|
}
|
||||||
Component Slider(ConstStringRef label,
|
Component Slider(ConstStringRef label,
|
||||||
@ -293,12 +293,12 @@ Component Slider(ConstStringRef label,
|
|||||||
ConstRef<long> min,
|
ConstRef<long> min,
|
||||||
ConstRef<long> max,
|
ConstRef<long> max,
|
||||||
ConstRef<long> increment) {
|
ConstRef<long> increment) {
|
||||||
auto slider = Make<SliderBase<long>>(SliderOption<long>({
|
SliderOption<long> option;
|
||||||
.value = value,
|
option.value = value;
|
||||||
.min = min,
|
option.min = min;
|
||||||
.max = max,
|
option.max = max;
|
||||||
.increment = increment,
|
option.increment = increment;
|
||||||
}));
|
auto slider = Make<SliderBase<long>>(option);
|
||||||
return Make<SliderWithLabel>(label, slider);
|
return Make<SliderWithLabel>(label, slider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ Color Color::RGB(uint8_t red, uint8_t green, uint8_t blue) {
|
|||||||
// static
|
// static
|
||||||
Color Color::HSV(uint8_t h, uint8_t s, uint8_t v) {
|
Color Color::HSV(uint8_t h, uint8_t s, uint8_t v) {
|
||||||
if (s == 0) {
|
if (s == 0) {
|
||||||
return {0,0,0};
|
return {0, 0, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t region = h / 43; // NOLINT
|
uint8_t region = h / 43; // NOLINT
|
||||||
|
Loading…
Reference in New Issue
Block a user