|
Lightweight 0.20261031.0
|
Progress of one task, which the library reports and a host (a CLI, a GUI) renders. More...
#include <ProgressTask.hpp>
Public Types | |
| enum class | LogLevel : std::uint8_t { Info , Warning , Error } |
| Severity of a message reported against a task. More... | |
Public Member Functions | |
| ProgressTask (ProgressTask const &)=delete | |
| ProgressTask (ProgressTask &&)=delete | |
| ProgressTask & | operator= (ProgressTask const &)=delete |
| ProgressTask & | operator= (ProgressTask &&)=delete |
| virtual | ~ProgressTask ()=default |
| Marks the task finished. | |
| virtual std::unique_ptr< ProgressTask > | BeginSubTask (std::string_view title, std::uint64_t total)=0 |
| virtual void | SetTotal (std::uint64_t total)=0 |
| virtual void | Advance (std::uint64_t count=1, std::string_view detail={})=0 |
| virtual void | Log (LogLevel level, std::string_view message)=0 |
| virtual bool | IsCancellationRequested () const =0 |
| virtual void | Fail (std::string_view reason)=0 |
Progress of one task, which the library reports and a host (a CLI, a GUI) renders.
Tasks nest: a task opens sub-tasks for its parts, and destroying a task marks it finished. A total of 0 makes a task indeterminate: the host shows that it runs and for how long, not how far it got. The host implements this interface and the library only calls it, possibly from a worker thread, one task tree at a time. New virtual functions are only ever appended at the end.
Definition at line 18 of file ProgressTask.hpp.
|
strong |
Severity of a message reported against a task.
Definition at line 22 of file ProgressTask.hpp.
|
pure virtual |
Opens a child task.
| title | What the child does, e.g. "Unit 2 of 5". |
| total | Units of work of the child; 0 = indeterminate. |
Implemented in Lightweight::NullProgressTask.
|
pure virtual |
Replaces the task's total.
| total | Units of work; 0 = indeterminate. |
Implemented in Lightweight::NullProgressTask.
|
pure virtual |
Records more work done and names what runs now. Advance(0, detail) only changes the detail.
| count | Units of work done since the last call. |
| detail | What the task does now; empty keeps the previous detail. |
Implemented in Lightweight::NullProgressTask.
|
pure virtual |
Reports a message about the task.
| level | The message's severity. |
| message | The message, UTF-8. |
Implemented in Lightweight::NullProgressTask.
|
pure virtual |
Implemented in Lightweight::NullProgressTask.
|
pure virtual |
Marks the task failed; destroying it then ends it as failed, not as done.
| reason | What went wrong, UTF-8. |
Implemented in Lightweight::NullProgressTask.