#ifndef UTILS_H_ #define UTILS_H_ #include #include #include #include #include namespace sc { class term { struct winsize _ws; std::ostream* _out {nullptr}; bool _isatty {true}; 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(); }; namespace io { struct clear_line { const term& _term; clear_line(const term& t); }; std::ostream& operator<<(std::ostream& out, const clear_line& obj); } } #endif // UTILS_H_