mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-16 04:18:51 +08:00
Added support for marking progress as completed - Useful when breaking out early and presenting errors during progress
This commit is contained in:
@@ -59,6 +59,8 @@ public:
|
||||
|
||||
void show_percentage(bool flag) { _show_percentage = flag; }
|
||||
|
||||
void hide_percentage() { _show_percentage = false; }
|
||||
|
||||
void set_progress(float value) {
|
||||
{
|
||||
std::unique_lock<std::mutex> lock{_mutex};
|
||||
@@ -82,6 +84,11 @@ public:
|
||||
|
||||
bool is_completed() const { return _completed; }
|
||||
|
||||
void mark_as_completed() {
|
||||
_completed = true;
|
||||
_print_progress();
|
||||
}
|
||||
|
||||
private:
|
||||
float _progress{0.0};
|
||||
size_t _bar_width{100};
|
||||
|
||||
Reference in New Issue
Block a user