5#ifndef INKSCAPE_ASYNC_PROGRESS_H
6#define INKSCAPE_ASYNC_PROGRESS_H
21template <
typename... T>
43 virtual bool _report(T
const &... progress) = 0;
49template <
typename T,
typename... S>
59 _from = p->_from + p->_amount * from;
79template <
typename T,
typename... S>
94 bool _report(T
const &progress, S
const &... aux)
override
108template <
typename... T>
112 using clock = std::chrono::steady_clock;
130 auto now = clock::now();
143template <
typename... T>
149 bool _report(T
const &...)
override {
return true; }
A dummy Progress object that never reports cancellation.
bool _keepgoing() const override
bool _report(T const &...) override
A Progress object that throttles reports to a given step size.
bool _keepgoing() const override
ProgressStepThrottler(Progress< T, S... > &parent, T step)
bool _report(T const &progress, S const &... aux) override
Progress< T, S... > * parent
A Progress object that throttles reports to a given time interval.
ProgressTimeThrottler(Progress< T... > &parent, duration interval)
bool _keepgoing() const override
Progress< T... > * parent
clock::time_point time_point
bool _report(T const &... progress) override
std::chrono::steady_clock clock
An interface for tasks to report progress and check for cancellation.
bool keepgoing() const
Return whether not cancelled.
void report_or_throw(T const &... progress)
Report a progress value, throwing CancelledException if cancelled.
void throw_if_cancelled() const
Throw CancelledException if cancelled.
bool report(T const &... progress)
Report a progress value, returning false if cancelled.
virtual bool _report(T const &... progress)=0
virtual bool _keepgoing() const =0
A Progress object representing a sub-task of another Progress.
SubProgress(Progress< T, S... > &parent, T from, T amount)
Construct a progress object for a sub-task.
Progress< T, S... > * _root
bool _report(T const &progress, S const &... aux) override
bool _keepgoing() const override
static char const *const parent
Helper class to stream background task notifications as a series of messages.