~james/gengo

gengo/samples-test/samples/C++/progress-bar.h -rw-r--r-- 636 bytes
50871857 — james chore(import): snapshot james.dad.town/gengo at 8f775550b0ee 16 hours ago
                                                                                
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
#ifndef PROGRESS_BAR_H
#define PROGRESS_BAR_H

#include <string>

class ProgressBar {
private:
    char symbol;
    char startSymbol;
    char endSymbol;
    int length;
    int progress;
    int total;
    std::string format;
    bool showPercent;
    bool showCount;

public:
    ProgressBar(char symbol, int length, int total);

    ProgressBar& update(int progress);
    ProgressBar& showPercentage(bool show);
    ProgressBar& showCounter(bool show);
    ProgressBar& setStartEndSymbols(char start, char end);
    ProgressBar& setCustomFormat(const std::string& format);
    ProgressBar& tick();
    void print() const;
};

#endif