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
6
struct
ProgressStyle
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
21
inline
ProgressStyle
DefaultStyle
=
ProgressStyle
();
22
inline
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
31
class
ProgressBar
32
{
33
private
:
34
int
tasks
= 100;
35
std::string
fill_done
=
"█"
;
36
std::string
fill_do
=
"-"
;
37
38
ProgressStyle
style
;
39
40
int
curr
= 0;
41
double
scaling
;
42
43
public
:
44
ProgressBar
(
int
tasks
= 100,
const
std::string&
fill_done
=
"█"
,
const
std::string&
fill_do
=
"-"
,
ProgressStyle
style
=
DefaultStyle
)
45
:
tasks
(
tasks
)
46
,
fill_done
(
fill_done
)
47
,
fill_do
(
fill_do
)
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
58
private
:
59
void
draw
(std::string message =
""
)
const
;
60
};
DefaultStyle
ProgressStyle DefaultStyle
Definition
ProgressBar.hpp:21
FancyStyle
ProgressStyle FancyStyle
Definition
ProgressBar.hpp:22
ProgressBar
Definition
ProgressBar.hpp:32
ProgressBar::update
void update(int curr, std::string message="")
Definition
ProgressBar.cpp:14
ProgressBar::fill_done
std::string fill_done
Definition
ProgressBar.hpp:35
ProgressBar::fill_do
std::string fill_do
Definition
ProgressBar.hpp:36
ProgressBar::curr
int curr
Definition
ProgressBar.hpp:40
ProgressBar::step
void step(std::string message="")
Definition
ProgressBar.cpp:8
ProgressBar::scaling
double scaling
Definition
ProgressBar.hpp:41
ProgressBar::numTasks
int numTasks() const
Definition
ProgressBar.hpp:53
ProgressBar::draw
void draw(std::string message="") const
Definition
ProgressBar.cpp:20
ProgressBar::style
ProgressStyle style
Definition
ProgressBar.hpp:38
ProgressBar::tasks
int tasks
Definition
ProgressBar.hpp:34
ProgressBar::ProgressBar
ProgressBar(int tasks=100, const std::string &fill_done="█", const std::string &fill_do="-", ProgressStyle style=DefaultStyle)
Definition
ProgressBar.hpp:44
ProgressStyle
Definition
ProgressBar.hpp:7
ProgressStyle::fg_message
fmt::color fg_message
Definition
ProgressBar.hpp:17
ProgressStyle::bg_message
fmt::color bg_message
Definition
ProgressBar.hpp:18
ProgressStyle::fg_percent
fmt::color fg_percent
Definition
ProgressBar.hpp:14
ProgressStyle::bg_do
fmt::color bg_do
Definition
ProgressBar.hpp:12
ProgressStyle::bg_done
fmt::color bg_done
Definition
ProgressBar.hpp:9
ProgressStyle::bg_percent
fmt::color bg_percent
Definition
ProgressBar.hpp:15
ProgressStyle::fg_do
fmt::color fg_do
Definition
ProgressBar.hpp:11
ProgressStyle::fg_done
fmt::color fg_done
Definition
ProgressBar.hpp:8
include
IO
ProgressBar.hpp
Generated on Wed Sep 4 2024 15:31:12 for Instantiator by
1.10.0