Joedb
9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
src
joedb
ui
Progress_Bar.cpp
Go to the documentation of this file.
1
#include "
joedb/ui/Progress_Bar.h
"
2
3
#include <iostream>
4
5
namespace
joedb
6
{
7
//////////////////////////////////////////////////////////////////////////
8
Progress_Bar::Progress_Bar
9
//////////////////////////////////////////////////////////////////////////
10
(
11
int64_t total,
12
std::ostream &out
13
):
14
total(total),
15
out(out),
16
current_display(0)
17
{
18
out <<
'\n'
;
19
for
(
int
i = length; --i >= 0;)
20
out <<
'.'
;
21
out <<
'\r'
;
22
out.flush();
23
}
24
25
//////////////////////////////////////////////////////////////////////////
26
void
Progress_Bar::print
(int64_t current)
27
//////////////////////////////////////////////////////////////////////////
28
{
29
const
int
display = int((current * length) / total);
30
31
if
(display > current_display)
32
{
33
for
(
int
i = display - current_display; --i >= 0;)
34
out <<
'#'
;
35
out.flush();
36
37
current_display = display;
38
}
39
}
40
41
//////////////////////////////////////////////////////////////////////////
42
Progress_Bar::~Progress_Bar
()
43
//////////////////////////////////////////////////////////////////////////
44
{
45
try
46
{
47
out <<
'\n'
;
48
out.flush();
49
}
50
catch
(...)
51
{
52
}
53
}
54
}
Progress_Bar.h
joedb::Progress_Bar::print
void print(int64_t current)
Definition
Progress_Bar.cpp:26
joedb::Progress_Bar::Progress_Bar
Progress_Bar(int64_t total, std::ostream &out)
Definition
Progress_Bar.cpp:10
joedb::Progress_Bar::~Progress_Bar
~Progress_Bar()
Definition
Progress_Bar.cpp:42
joedb
Definition
Blob.h:7
Generated by
1.9.8