|
textProgressBar
|
Renders an ASCII progress bar to standard output. More...
#include <textProgressBar.h>
Public Member Functions | |
| TextProgressBar (int w, string t, int minimum=0, int maximum=100, char s='[', char e=']', char m='=', char a='>') | |
| Constructs a progress bar with a value range and visual configuration. | |
| void | setProgress (int p) |
| Updates the progress bar based on the provided progress value. | |
TextProgressBar prints a single-line progress indicator (title + bar + percentage) to the console. Updates overwrite the same line via carriage return (\r). When the progress reaches the final step, the progress bar ends with a newline.
std::cout by the implementation.Definition at line 32 of file textProgressBar.h.
|
inline |
The progress bar represents values in the inclusive range [minimum, maximum]. The output is throttled to at most TEXTPROGRESSBARNSTEPS printed updates across the full range.
| w | The visual width of the bar (number of character cells between the delimiters). |
| t | The title/prefix printed before the bar (e.g. " processing: "). |
| minimum | The minimum progress value (start of the range). |
| maximum | The maximum progress value (end of the range). |
| s | The character used to open the bar (default: ‘’['). \param e The character used to close the bar (default:']'). \param m The character used to fill completed portions of the bar (default:'='). \param a The character used to indicate the current advancing position (default:'>'`). |
Definition at line 53 of file textProgressBar.h.
| void TextProgressBar::setProgress | ( | int | p | ) |
The progress bar prints only when the provided value reaches or exceeds the next internal threshold (tracked by indexStep). This prevents excessive console output in tight loops.
Updates are ignored in the following cases:
p < indexStep).singleStep == 0), meaning the range is too small for throttled printing.p < min or p > max).| p | Current progress value (typically a loop index or processed item count). |
Definition at line 8 of file textProgressBar.cc.