#include <include/EDoc/ProgressBar.h>
Inheritance diagram for EDoc::ProgressBar:
This has two configurations:
Definition at line 41 of file ProgressBar.h.
Public Member Functions | |
ProgressBar (bool enable_spinner_in=false, int width_in=DEFAULT_SCREEN_WIDTH, std::string spin_sequence_in=DEFAULT_SPIN_SEQUENCE) | |
Create a new progress bar instance. | |
void | Reset () |
Resets the progress bar to start displaying progress again from 0. | |
virtual void | Start (size_t total) |
See FunctionProgressIFace::Start(). | |
virtual void | Progress (Function *data) |
See FunctionProgressIFace::Progress(). | |
virtual void | Progress (T *data)=0 |
Called each time some progress is made that is to be shown to the user. | |
Static Public Attributes | |
static const char * | DEFAULT_SPIN_SEQUENCE |
This is the default spin sequence for the spinner. | |
static const int | DEFAULT_SCREEN_WIDTH = 80 |
This is the default screen width to use. | |
Private Attributes | |
bool | enable_spinner |
True if spinner is enabled. | |
int | width |
The width of the terminal to assume. | |
std::string | spin_sequence |
The equence of characters to display when incrementing the progres for a spinner. | |
int | bars |
Current number of bars being displayed. | |
int | spin_index |
Current index for the spinner. | |
size_t | total |
size_t | current |
EDoc::ProgressBar::ProgressBar | ( | bool | enable_spinner_in = false , |
|
int | width_in = DEFAULT_SCREEN_WIDTH , |
|||
std::string | spin_sequence_in = DEFAULT_SPIN_SEQUENCE | |||
) |
Create a new progress bar instance.
enable_spinner_in | When in iteractive mode this is enabled and displays a spinner when any progress is made. | |
width_in | The width to assume the terminal width is. | |
spin_sequence_in | The spin sequence to use if enable_spinner_in is true. |
Definition at line 31 of file ProgressBar.cpp.
References Reset().
EDoc::ProgressBar::Reset | ( | ) |
Resets the progress bar to start displaying progress again from 0.
Definition at line 41 of file ProgressBar.cpp.
References bars, and spin_index.
Referenced by ProgressBar().
EDoc::ProgressBar::Start | ( | size_t | total | ) | [virtual] |
See FunctionProgressIFace::Start().
Implements EDoc::ProgressIFace< T >.
Definition at line 47 of file ProgressBar.cpp.
EDoc::ProgressBar::Progress | ( | EDoc::Function * | data | ) | [virtual] |
See FunctionProgressIFace::Progress().
Definition at line 53 of file ProgressBar.cpp.
References bars, current, enable_spinner, spin_index, spin_sequence, total, and width.
virtual void EDoc::ProgressIFace< T >::Progress | ( | T * | data | ) | [pure virtual, inherited] |
Called each time some progress is made that is to be shown to the user.
Note: This must be called exactly total number of times, where total is the value passed to the Start() function.
Referenced by EDoc::Dictionary::GenerateExceptions().
const char * EDoc::ProgressBar::DEFAULT_SPIN_SEQUENCE [static] |
This is the default spin sequence for the spinner.
It is a sequence of characters to display when the progress indication increases.
Definition at line 51 of file ProgressBar.h.
const int EDoc::ProgressBar::DEFAULT_SCREEN_WIDTH = 80 [static] |
This is the default screen width to use.
Definition at line 59 of file ProgressBar.h.
bool EDoc::ProgressBar::enable_spinner [private] |
int EDoc::ProgressBar::width [private] |
The width of the terminal to assume.
Definition at line 106 of file ProgressBar.h.
Referenced by Progress().
std::string EDoc::ProgressBar::spin_sequence [private] |
The equence of characters to display when incrementing the progres for a spinner.
Definition at line 112 of file ProgressBar.h.
Referenced by Progress().
int EDoc::ProgressBar::bars [private] |
Current number of bars being displayed.
Definition at line 117 of file ProgressBar.h.
Referenced by Progress(), and Reset().
int EDoc::ProgressBar::spin_index [private] |
Current index for the spinner.
This determines which character to display next from the spin_sequence.
Definition at line 123 of file ProgressBar.h.
Referenced by Progress(), and Reset().
size_t EDoc::ProgressBar::total [private] |
size_t EDoc::ProgressBar::current [private] |