Instantiator
Generate c++ template instantiations
Loading...
Searching...
No Matches
ProgressBar.hpp
Go to the documentation of this file.
1#include <string>
2
3#include <fmt/color.h>
4#include <fmt/core.h>
5
7{
8 fmt::color fg_done = fmt::color::lime;
9 fmt::color bg_done = fmt::color::sea_green;
10
11 fmt::color fg_do = fmt::color::dark_blue;
12 fmt::color bg_do = fmt::color::black;
13
14 fmt::color fg_percent = fmt::color::lime;
15 fmt::color bg_percent = fmt::color::black;
16
17 fmt::color fg_message = fmt::color::white_smoke;
18 fmt::color bg_message = fmt::color::black;
19};
20
22inline ProgressStyle FancyStyle = ProgressStyle{fmt::color::pink,
23 fmt::color::sea_green,
24 fmt::color::alice_blue,
25 fmt::color::black,
26 fmt::color::dark_slate_blue,
27 fmt::color::black,
28 fmt::color::white_smoke,
29 fmt::color::yellow_green};
30
32{
33private:
34 int tasks = 100;
35 std::string fill_done = "█";
36 std::string fill_do = "-";
37
39
40 int curr = 0;
41 double scaling;
42
43public:
44 ProgressBar(int tasks = 100, const std::string& fill_done = "█", const std::string& fill_do = "-", ProgressStyle style = DefaultStyle)
45 : tasks(tasks)
48 , style(style)
49 {
50 scaling = 100. / this->tasks;
51 }
52
53 int numTasks() const { return tasks; }
54
55 void step(std::string message = "");
56 void update(int curr, std::string message = "");
57
58private:
59 void draw(std::string message = "") const;
60};
ProgressStyle DefaultStyle
ProgressStyle FancyStyle
void update(int curr, std::string message="")
std::string fill_done
std::string fill_do
void step(std::string message="")
int numTasks() const
void draw(std::string message="") const
ProgressStyle style
ProgressBar(int tasks=100, const std::string &fill_done="█", const std::string &fill_do="-", ProgressStyle style=DefaultStyle)
fmt::color fg_message
fmt::color bg_message
fmt::color fg_percent
fmt::color bg_do
fmt::color bg_done
fmt::color bg_percent
fmt::color fg_do
fmt::color fg_done