initial upload
This commit is contained in:
41
archive/xyz2shc/progressBar.h
Normal file
41
archive/xyz2shc/progressBar.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef _PROGRESS_BAR_
|
||||
#define _PROGRESS_BAR_
|
||||
#include <sys/ioctl.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#define TOTAL_PERCENTAGE 100.0
|
||||
#define CHARACTER_WIDTH_PERCENTAGE 4
|
||||
|
||||
class ProgressBar
|
||||
{
|
||||
public:
|
||||
|
||||
ProgressBar();
|
||||
ProgressBar(unsigned long n_, const char *description_="", std::ostream& out_=std::cerr);
|
||||
|
||||
void SetFrequencyUpdate(unsigned long frequency_update_);
|
||||
void SetStyle(const char* unit_bar_, const char* unit_space_);
|
||||
|
||||
void Progressed(unsigned long idx_);
|
||||
|
||||
private:
|
||||
|
||||
unsigned long n;
|
||||
unsigned int desc_width;
|
||||
unsigned long frequency_update;
|
||||
std::ostream* out;
|
||||
|
||||
const char *description;
|
||||
const char *unit_bar;
|
||||
const char *unit_space;
|
||||
|
||||
void ClearBarField();
|
||||
int GetConsoleWidth();
|
||||
int GetBarLength();
|
||||
|
||||
};
|
||||
#endif
|
Reference in New Issue
Block a user