Pranav Srinivas KumaR 83fd2c6fe0 Minor update
2019-12-03 20:43:56 -06:00
2019-12-03 20:40:34 -06:00
2019-12-03 20:43:56 -06:00
2019-12-03 09:14:15 -06:00
2019-12-03 09:14:15 -06:00
2019-12-03 20:43:32 -06:00

progress

Progress Bar

#include <progress/bar.hpp>

int main() {
  ProgressBar bar;

  // Configure progress bar
  bar.bar_width(50);
  bar.start_with("[");
  bar.fill_progress_with("■");
  bar.lead_progress_with("■");
  bar.fill_remainder_with("-");
  bar.end_with("]");

  // As configured, the bar will look like this:
  // 
  // [■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■-------------] 70%
  //
  //

  auto job = [&bar]() {
	       while(true) {
		 if (bar.completed())
		   break;
		 bar.tick();
		 std::this_thread::sleep_for(std::chrono::milliseconds(100));
	       }   
	     };

  std::thread first_thread(job);
  std::thread second_thread(job);
  std::thread third_thread(job);
  std::thread last_thread(job);

  first_thread.join();
  second_thread.join();
  third_thread.join();
  last_thread.join();

  return 0;
}
Languages
C++ 92.3%
Python 5.9%
CMake 1.7%