-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgress.h
More file actions
50 lines (42 loc) · 1.07 KB
/
Progress.h
File metadata and controls
50 lines (42 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//===----------------------------------------------------------------------===//
//
// Json Parser for large data set
//
//===----------------------------------------------------------------------===//
//
// Copyright (C) 2019. rollrat. All Rights Reserved.
//
//===----------------------------------------------------------------------===//
#ifndef _PROGRESS_
#define _PROGRESS_
#include "String.h"
#include "StringBuilder.h"
#include <iostream>
#include <thread>
namespace jsonhead {
class ProgressBase {
String current_text;
public:
virtual void Dispose();
protected:
bool disposed;
void update_text(String&& text);
};
class WaitProgress : public ProgressBase {
String animation = "|/-\\";
int index = 0;
std::thread timer;
public:
WaitProgress();
virtual void Dispose();
private:
void Tick();
};
class ProgressBar : public ProgressBase {
int block_count = 20;
public:
ProgressBar(int block_count = 20) : block_count(block_count) { }
void Update(double progress, String message);
};
}
#endif