2014-07-08 17:35:14 +02:00
|
|
|
#ifndef PRINT_HPP_
|
|
|
|
#define PRINT_HPP_
|
|
|
|
|
|
|
|
#include <string>
|
2016-05-17 15:24:06 +02:00
|
|
|
#include <cstdio> // for snprintf
|
|
|
|
#include <cinttypes> // for PRId64 et.al.
|
2016-03-12 19:01:34 +01:00
|
|
|
#include "libtorrent/bitfield.hpp"
|
2014-07-08 17:35:14 +02:00
|
|
|
|
|
|
|
enum color_code
|
|
|
|
{
|
|
|
|
col_none = -1,
|
|
|
|
col_black = 0,
|
|
|
|
col_red = 1,
|
|
|
|
col_green = 2,
|
|
|
|
col_yellow = 3,
|
|
|
|
col_blue = 4,
|
|
|
|
col_magenta = 5,
|
|
|
|
col_cyan = 6,
|
2015-04-18 04:33:39 +02:00
|
|
|
col_white = 7
|
2014-07-08 17:35:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
char const* esc(char const* code);
|
|
|
|
|
|
|
|
std::string to_string(int v, int width);
|
|
|
|
|
2016-04-20 06:45:32 +02:00
|
|
|
std::string add_suffix_float(float val, char const* suffix);
|
|
|
|
|
|
|
|
template<class T> std::string add_suffix(T val, char const* suffix = 0) {
|
|
|
|
return add_suffix_float(float(val), suffix);
|
|
|
|
}
|
2014-07-08 17:35:14 +02:00
|
|
|
|
|
|
|
std::string color(std::string const& s, color_code c);
|
|
|
|
|
2014-07-10 10:32:32 +02:00
|
|
|
enum { progress_invert = 1};
|
|
|
|
|
2014-07-08 17:35:14 +02:00
|
|
|
std::string const& progress_bar(int progress, int width, color_code c = col_green
|
2014-07-10 10:32:32 +02:00
|
|
|
, char fill = '#', char bg = '-', std::string caption = "", int flags = 0);
|
2014-07-08 17:35:14 +02:00
|
|
|
|
2017-04-12 20:05:53 +02:00
|
|
|
std::string const& piece_bar(lt::bitfield const& p, int width);
|
2016-03-17 05:24:57 +01:00
|
|
|
|
2014-07-08 17:35:14 +02:00
|
|
|
void set_cursor_pos(int x, int y);
|
|
|
|
|
|
|
|
void clear_screen();
|
|
|
|
|
2014-07-09 00:37:13 +02:00
|
|
|
void clear_rows(int y1, int y2);
|
2014-07-08 17:35:14 +02:00
|
|
|
|
2018-02-25 11:01:17 +01:00
|
|
|
std::pair<int, int> terminal_size();
|
2017-04-12 20:05:53 +02:00
|
|
|
std::string piece_matrix(lt::bitfield const& p, int width, int* height);
|
2014-07-08 17:35:14 +02:00
|
|
|
|
|
|
|
void print(char const* str);
|
|
|
|
|
|
|
|
#endif // PRINT_HPP_
|
|
|
|
|