XII Release 0.1.0
Loading...
Searching...
No Matches
xiiProgressRange Class Reference

xiiProgressRange is the preferred method to inform the system of progress. More...

#include <Progress.h>

Public Member Functions

 xiiProgressRange (xiiStringView sDisplayText, xiiUInt32 uiSteps, bool bAllowCancel, xiiProgress *pProgressbar=nullptr)
 Creates a progress range scope.
 
 xiiProgressRange (xiiStringView sDisplayText, bool bAllowCancel, xiiProgress *pProgressbar=nullptr)
 Creates a progress range scope without steps. Use SetCompletion to manually set the completion value.
 
 ~xiiProgressRange ()
 The destructor closes the current range. All progress in this range is assumed to have completed, even if BeginNextStep() has not been called once for every subdivision step.
 
xiiProgressGetProgressbar () const
 Returns the xiiProgress instance that this range uses.
 
void SetStepWeighting (xiiUInt32 uiStep, float fWeight)
 Allows to weigh each step differently.
 
bool BeginNextStep (xiiStringView sStepDisplayText, xiiUInt32 uiNumSteps=1)
 Should be called whenever a new sub-step is started to advance the progress.
 
bool SetCompletion (double fCompletionFactor)
 Manually set the completion value between 0..1.
 
bool WasCanceled () const
 Whether the user requested to cancel the operation.
 

Friends

class xiiProgress
 

Detailed Description

xiiProgressRange is the preferred method to inform the system of progress.

xiiProgressRange is a scoped class, ie. upon creation it adds a range to the current progress and upon destruction the entire range is considered to be completed. Ranges can be nested. For instance when a top level range consists of three 'steps', then opening a nested range will sub-divide that first step. When the nested range is closed, the first top-level step is finished and BeginNextStep() should be called on the top-level range. Subsequently the second step is active and can again be further subdivided with another nested xiiProgressRange.

Constructor & Destructor Documentation

◆ xiiProgressRange()

xiiProgressRange::xiiProgressRange ( xiiStringView sDisplayText,
xiiUInt32 uiSteps,
bool bAllowCancel,
xiiProgress * pProgressbar = nullptr )

Creates a progress range scope.

If any other progress range is currently active, it will become the parent range and the currently active step will be subdivided.

Parameters
szDisplayTextis the main display text for this range.
uiStepsis the number of steps that this range will be subdivided into
bAllowCancelspecifies whether the user can cancel this operation
pProgressbarcan be specified, if available, otherwise the currently active xiiProgress instance is used.

Member Function Documentation

◆ BeginNextStep()

bool xiiProgressRange::BeginNextStep ( xiiStringView sStepDisplayText,
xiiUInt32 uiNumSteps = 1 )

Should be called whenever a new sub-step is started to advance the progress.

Parameters
szStepDisplayTextThe sub-text for the next step to be displayed.
uiNumStepsHow many steps have been completed.
Returns
Returns false if the user clicked cancel.

◆ SetStepWeighting()

void xiiProgressRange::SetStepWeighting ( xiiUInt32 uiStep,
float fWeight )

Allows to weigh each step differently.

This makes it possible to divide an operation into two steps, but have one part take up 90% and the other 10%.

Parameters
uiStepThe index for the step to set the weight
fWeightThe weighting in [0; 1] range

The documentation for this class was generated from the following files: