![]() |
XII Release 0.1.0
|
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. | |
xiiProgress * | GetProgressbar () 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 |
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.
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.
szDisplayText | is the main display text for this range. |
uiSteps | is the number of steps that this range will be subdivided into |
bAllowCancel | specifies whether the user can cancel this operation |
pProgressbar | can be specified, if available, otherwise the currently active xiiProgress instance is used. |
bool xiiProgressRange::BeginNextStep | ( | xiiStringView | sStepDisplayText, |
xiiUInt32 | uiNumSteps = 1 ) |
Should be called whenever a new sub-step is started to advance the progress.
szStepDisplayText | The sub-text for the next step to be displayed. |
uiNumSteps | How many steps have been completed. |
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%.
uiStep | The index for the step to set the weight |
fWeight | The weighting in [0; 1] range |