mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-21 18:24:20 +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)
|
||||
set_target_properties(${library} PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
CXX_STANDARD 20
|
||||
OUTPUT_NAME "ftxui-${library}"
|
||||
)
|
||||
|
||||
|
@ -71,6 +71,7 @@ target_include_directories(tests
|
||||
PRIVATE src
|
||||
)
|
||||
ftxui_set_options(tests)
|
||||
target_compile_features(tests PUBLIC cxx_std_20)
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(tests
|
||||
|
@ -1,7 +1,7 @@
|
||||
codecov:
|
||||
require_ci_to_pass: no
|
||||
notify:
|
||||
after_n_builds: 3
|
||||
after_n_builds: 4
|
||||
wait_for_ci: yes
|
||||
|
||||
coverage:
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include <array> // for array
|
||||
#include <cmath> // for sin
|
||||
#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 "ftxui/component/captured_mouse.hpp" // for ftxui
|
||||
@ -19,12 +21,22 @@ int main(int argc, const char* argv[]) {
|
||||
|
||||
auto layout_horizontal = Container::Horizontal({});
|
||||
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>({
|
||||
.value = &values[i],
|
||||
.max = 100,
|
||||
.increment = 5,
|
||||
.direction = GaugeDirection::Up,
|
||||
}));
|
||||
*/
|
||||
}
|
||||
|
||||
layout_horizontal |= size(HEIGHT, GREATER_THAN, 20);
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define FTXUI_SCREEN_SCREEN_HPP
|
||||
|
||||
#include <memory>
|
||||
#include <string> // for allocator, string, basic_string
|
||||
#include <string> // for string, allocator, basic_string
|
||||
#include <vector> // for vector
|
||||
|
||||
#include "ftxui/screen/box.hpp" // for Box
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <cmath> // IWYU pragma: keep
|
||||
#include <compare> // for operator<=, operator>=, partial_ordering
|
||||
#include <ratio> // for ratio
|
||||
#include <utility> // for move
|
||||
|
||||
|
@ -26,8 +26,7 @@ class RadioboxBase : public ComponentBase {
|
||||
RadioboxBase(ConstStringListRef entries,
|
||||
int* selected,
|
||||
Ref<RadioboxOption> option)
|
||||
: entries_(entries), selected_(selected), option_(std::move(option)) {
|
||||
}
|
||||
: entries_(entries), selected_(selected), option_(std::move(option)) {}
|
||||
|
||||
private:
|
||||
Element Render() override {
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <algorithm> // for min
|
||||
#include <algorithm> // for copy, max, min
|
||||
#include <array> // for array
|
||||
#include <chrono> // for operator-, milliseconds, duration, operator<=>, time_point, common_type<>::type
|
||||
#include <compare> // for operator>=, strong_ordering
|
||||
#include <chrono> // for operator-, milliseconds, duration, operator>=, time_point, common_type<>::type
|
||||
#include <csignal> // for signal, raise, SIGTSTP, SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, SIGWINCH
|
||||
#include <cstdio> // for fileno, size_t, stdin
|
||||
#include <ftxui/component/task.hpp> // for Task, Closure, AnimationTask
|
||||
|
@ -266,12 +266,12 @@ Component Slider(ConstStringRef label,
|
||||
ConstRef<int> min,
|
||||
ConstRef<int> max,
|
||||
ConstRef<int> increment) {
|
||||
auto slider = Make<SliderBase<int>>(SliderOption<int>({
|
||||
.value = value,
|
||||
.min = min,
|
||||
.max = max,
|
||||
.increment = increment,
|
||||
}));
|
||||
SliderOption<int> option;
|
||||
option.value = value;
|
||||
option.min = min;
|
||||
option.max = max;
|
||||
option.increment = increment;
|
||||
auto slider = Make<SliderBase<int>>(option);
|
||||
return Make<SliderWithLabel>(label, slider);
|
||||
}
|
||||
|
||||
@ -280,12 +280,12 @@ Component Slider(ConstStringRef label,
|
||||
ConstRef<float> min,
|
||||
ConstRef<float> max,
|
||||
ConstRef<float> increment) {
|
||||
auto slider = Make<SliderBase<float>>(SliderOption<float>({
|
||||
.value = value,
|
||||
.min = min,
|
||||
.max = max,
|
||||
.increment = increment,
|
||||
}));
|
||||
SliderOption<float> option;
|
||||
option.value = value;
|
||||
option.min = min;
|
||||
option.max = max;
|
||||
option.increment = increment;
|
||||
auto slider = Make<SliderBase<float>>(option);
|
||||
return Make<SliderWithLabel>(label, slider);
|
||||
}
|
||||
Component Slider(ConstStringRef label,
|
||||
@ -293,12 +293,12 @@ Component Slider(ConstStringRef label,
|
||||
ConstRef<long> min,
|
||||
ConstRef<long> max,
|
||||
ConstRef<long> increment) {
|
||||
auto slider = Make<SliderBase<long>>(SliderOption<long>({
|
||||
.value = value,
|
||||
.min = min,
|
||||
.max = max,
|
||||
.increment = increment,
|
||||
}));
|
||||
SliderOption<long> option;
|
||||
option.value = value;
|
||||
option.min = min;
|
||||
option.max = max;
|
||||
option.increment = increment;
|
||||
auto slider = Make<SliderBase<long>>(option);
|
||||
return Make<SliderWithLabel>(label, slider);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user