3#ifndef PDFSDK_CXX_PROGRESS_MONITOR_H_INCLUDED_
4#define PDFSDK_CXX_PROGRESS_MONITOR_H_INCLUDED_
6#include <pdfsdk/cxx/callback.h>
14class ProgressMonitor {
16 ProgressMonitor() =
default;
19 virtual ~ProgressMonitor() =
default;
23 void* userdata() {
return this; }
51 static PDErrCode PDFSDK_CALLCONV BeginOp(
void* clientData,
double progressMin,
double progressMax) {
59 static PDErrCode PDFSDK_CALLCONV EndOp(
void* clientData) {
61 ProgressMonitor* monitor =
static_cast<ProgressMonitor*
>(clientData);
62 monitor->EndOperation();
67 static PDErrCode PDFSDK_CALLCONV SetValue(
void* clientData,
double value) {
69 ProgressMonitor* monitor =
static_cast<ProgressMonitor*
>(clientData);
70 monitor->SetCurrentValue(value);
77 ProgressMonitor* monitor =
static_cast<ProgressMonitor*
>(clientData);
78 *pCanceled = monitor->IsCanceled();
84 PDProgressMonitor m_monitor = {
85 &ProgressMonitor::BeginOp,
86 &ProgressMonitor::EndOp,
87 &ProgressMonitor::SetValue,
Progress monitor for tracking the progress of an operation.
Definition progress_monitor.h:14
virtual void SetCurrentValue(double)
Called to set the current value of the progress.
Definition progress_monitor.h:42
virtual void EndOperation()
Called when an operation ends.
Definition progress_monitor.h:36
virtual void BeginOperation(double, double)
Called when an operation begins.
Definition progress_monitor.h:31
virtual bool IsCanceled() const
Check if the operation has been canceled.
Definition progress_monitor.h:48
@ kPDErrSuccess
Operation was successful.
Definition errors.h:18
int32_t PDErrCode
Definition errors.h:44
Definition progress_monitor.h:15