FTXUI 7.0.3
C++ functional terminal UI.
Loading...
Searching...
No Matches
task_internal.hpp
Go to the documentation of this file.
1// Copyright 2024 Arthur Sonzogni. All rights reserved.
2// Use of this source code is governed by the MIT license that can be found in
3// the LICENSE file.
4#ifndef TASK_HPP
5#define TASK_HPP
6
7#include <chrono>
8#include <functional>
9#include <optional>
10
11namespace ftxui::task {
12
13/// タスクは作業の単位を表します。
14using Task = std::function<void()>;
15
16/// PendingTaskは、特定の時刻に、または可能な限り早く実行されるようにスケジュールされたタスクを表します。
18 // 即時タスク:
19 PendingTask(Task t) : task(std::move(t)) {} // NOLINT
20
21 // 期間付きの遅延タスク
22 PendingTask(Task t, std::chrono::steady_clock::duration duration)
23 : task(std::move(t)), time(std::chrono::steady_clock::now() + duration) {}
24
25 /// 実行されるタスク。
27
28 /// タスクが実行されるべき時刻。時刻が空の場合、タスクは
29 /// できるだけ早く実行されるべきです。
30 std::optional<std::chrono::steady_clock::time_point> time;
31
32 /// 2つのPendingTaskを時刻で比較します。
33 /// 両方のタスクに時刻がない場合、それらは等しいと見なされます。
34 bool operator<(const PendingTask& other) const;
35};
36
37} // namespace ftxui::task
38
39#endif // TASK_HPP_
std::function< void()> Task
タスクは作業の単位を表します。
PendingTaskは、特定の時刻に、または可能な限り早く実行されるようにスケジュールされたタスクを表します。
PendingTask(Task t, std::chrono::steady_clock::duration duration)
Task task
実行されるタスク。
std::optional< std::chrono::steady_clock::time_point > time
bool operator<(const PendingTask &other) const
Definition task.cpp:7