#include <nprogresstypes.h>
Public Member Functions | |
NProgressNumber (long newCompleted=0, long newOutOf=-1) | |
Creates a new progress report containing the given details. | |
long | getCompleted () const |
Returns the number of items completed. | |
long | getOutOf () const |
Returns the expected total number of items. | |
NProgressStateNumeric | getNumericState () const |
Returns both the number of items completed and the expected total number of items. | |
void | setCompleted (long newCompleted) |
Sets the number of items completed. | |
void | incCompleted (unsigned long extraCompleted=1) |
Increases the number of items completed by the given amount. | |
void | setOutOf (long newOutOf) |
Sets the expected total number of items. | |
virtual bool | isPercent () const |
Determines if the state of progress can be expressed as a percentage. | |
Protected Member Functions | |
virtual std::string | internalGetDescription () const |
Returns a string description of the current state of progress. | |
virtual double | internalGetPercent () const |
Returns the current state of progress as a percentage. |
The expected total number of items can be optionally specified.
regina::NProgressNumber::NProgressNumber | ( | long | newCompleted = 0 , |
|
long | newOutOf = -1 | |||
) | [inline] |
Creates a new progress report containing the given details.
Note that the internal mutex is not locked during construction.
If the new expected total is non-negative, then the new number of items completed is at most the new expected total.
newCompleted | the number of items completed; this defaults to 0. | |
newOutOf | the expected total number of items, or -1 if this total is not known (the default). |
long regina::NProgressNumber::getCompleted | ( | ) | const [inline] |
Returns the number of items completed.
long regina::NProgressNumber::getOutOf | ( | ) | const [inline] |
Returns the expected total number of items.
NProgressStateNumeric regina::NProgressNumber::getNumericState | ( | ) | const [inline] |
Returns both the number of items completed and the expected total number of items.
void regina::NProgressNumber::setCompleted | ( | long | newCompleted | ) | [inline] |
Sets the number of items completed.
If the expected total is non-negative, then the new number of items completed is at most the expected total.
newCompleted | the number of items completed. |
void regina::NProgressNumber::incCompleted | ( | unsigned long | extraCompleted = 1 |
) | [inline] |
Increases the number of items completed by the given amount.
extraCompleted | the number of items to add to the number of items already completed. |
void regina::NProgressNumber::setOutOf | ( | long | newOutOf | ) | [inline] |
Sets the expected total number of items.
newOutOf | the expected total number of items, or -1 if this total is not known. |
bool regina::NProgressNumber::isPercent | ( | ) | const [inline, virtual] |
Determines if the state of progress can be expressed as a percentage.
The default implementation returns false
.
true
if and only if progress can be expressed as a percentage. Reimplemented from regina::NProgress.
virtual std::string regina::NProgressNumber::internalGetDescription | ( | ) | const [protected, virtual] |
Returns a string description of the current state of progress.
Implements regina::NProgress.
double regina::NProgressNumber::internalGetPercent | ( | ) | const [inline, protected, virtual] |
Returns the current state of progress as a percentage.
The default implementation returns 0.
Reimplemented from regina::NProgress.