about summary refs log tree commit diff stats
path: root/generator/progress.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-03-26 15:33:06 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-03-26 15:33:06 -0400
commit0e6355329f241a3e3c8b38cb4146fda4470e6ed0 (patch)
treedf5853ba6df148e8eeb0082d090dfbcd9f94f651 /generator/progress.h
parent09acb46a9c32257b0003eb152d32c15b43b95dfe (diff)
downloadcadence-0e6355329f241a3e3c8b38cb4146fda4470e6ed0.tar.gz
cadence-0e6355329f241a3e3c8b38cb4146fda4470e6ed0.tar.bz2
cadence-0e6355329f241a3e3c8b38cb4146fda4470e6ed0.zip
Whitespace changes
Diffstat (limited to 'generator/progress.h')
-rw-r--r--generator/progress.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/generator/progress.h b/generator/progress.h index f42f701..e5cc13d 100644 --- a/generator/progress.h +++ b/generator/progress.h
@@ -5,20 +5,20 @@
5 5
6namespace cadence { 6namespace cadence {
7 namespace generator { 7 namespace generator {
8 8
9 class progress { 9 class progress {
10 private: 10 private:
11 std::string message; 11 std::string message;
12 int total; 12 int total;
13 int cur = 0; 13 int cur = 0;
14 int lprint = 0; 14 int lprint = 0;
15 15
16 public: 16 public:
17 progress(std::string message, int total) : message(message), total(total) 17 progress(std::string message, int total) : message(message), total(total)
18 { 18 {
19 std::cout << message << " 0%" << std::flush; 19 std::cout << message << " 0%" << std::flush;
20 } 20 }
21 21
22 void update(int val) 22 void update(int val)
23 { 23 {
24 if (val <= total) 24 if (val <= total)
@@ -27,29 +27,29 @@ namespace cadence {
27 } else { 27 } else {
28 cur = total; 28 cur = total;
29 } 29 }
30 30
31 int pp = cur * 100 / total; 31 int pp = cur * 100 / total;
32 if (pp != lprint) 32 if (pp != lprint)
33 { 33 {
34 lprint = pp; 34 lprint = pp;
35 35
36 std::cout << "\b\b\b\b" << std::right; 36 std::cout << "\b\b\b\b" << std::right;
37 std::cout.width(3); 37 std::cout.width(3);
38 std::cout << pp << "%" << std::flush; 38 std::cout << pp << "%" << std::flush;
39 } 39 }
40 } 40 }
41 41
42 void update() 42 void update()
43 { 43 {
44 update(cur+1); 44 update(cur+1);
45 } 45 }
46 46
47 ~progress() 47 ~progress()
48 { 48 {
49 std::cout << "\b\b\b\b100%" << std::endl; 49 std::cout << "\b\b\b\b100%" << std::endl;
50 } 50 }
51 }; 51 };
52 52
53 }; 53 };
54}; 54};
55 55