B15F
Board 15 Famulus Edition
|
9 B15F::abort(
"View::win not initialized, missing context");
30 std::vector<std::string>
View::str_split(
const std::string& str,
const std::string delim)
32 std::vector<std::string> tokens;
33 size_t prev = 0, pos = 0;
36 pos = str.find(delim, prev);
37 if (pos == std::string::npos) pos = str.length();
38 std::string token = str.substr(prev, pos-prev);
39 if (!token.empty()) tokens.push_back(token);
40 prev = pos + delim.length();
42 while (pos < str.length() && prev < str.length());
56 if (ioctl(0, TIOCGWINSZ, (
char *) &size) < 0)
57 throw std::runtime_error(
"TIOCGWINSZ error");
71 mvwprintw(
win, 1, offset_x,
"%s",
title.c_str());
int height
height of view in terminal characters
int width
width of view in terminal characters
std::string title
title of the view
static WINDOW * getWinContext(void)
static void abort(std::string msg)
static WINDOW * win
static window contexts for all views
static void setWinContext(WINDOW *win)
static std::vector< std::string > str_split(const std::string &str, const std::string delim)
virtual void repaint(void)
int start_x
x offset (characters) in the terminal, used to center the window on repaint()
virtual void setTitle(std::string title)
int start_y
y offset (characters) in the terminal, used to center the window on repaint()
virtual void draw(void)=0