Added support for marking progress as completed - Useful when breaking out early and presenting errors during progress

This commit is contained in:
Pranav Srinivas Kumar
2019-12-04 11:32:57 -06:00
parent e5c312f688
commit 92d9ce2e1f
2 changed files with 18 additions and 31 deletions

View File

@@ -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};