39 lines
713 B
C++
39 lines
713 B
C++
#ifndef UTILS_H_
|
|
#define UTILS_H_
|
|
|
|
#include <unistd.h>
|
|
#include <termios.h>
|
|
#include <sys/ioctl.h>
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
namespace sc {
|
|
|
|
class term {
|
|
struct winsize _ws;
|
|
std::ostream* _out {nullptr};
|
|
|
|
public:
|
|
term(int fd);
|
|
|
|
int rows() const;
|
|
int cols() const;
|
|
|
|
void progress(int prefixlen,
|
|
const std::string& prefix,
|
|
double cur,
|
|
double total) const;
|
|
};
|
|
|
|
class cursor_hider {
|
|
std::ostream* _out {nullptr};
|
|
|
|
public:
|
|
cursor_hider(std::ostream* out);
|
|
~cursor_hider();
|
|
};
|
|
|
|
}
|
|
|
|
#endif // UTILS_H_
|