1 |
/* |
2 |
* LSCP Shell |
3 |
* |
4 |
* Copyright (c) 2014 Christian Schoenebeck |
5 |
* |
6 |
* This program is part of LinuxSampler and released under the same terms. |
7 |
*/ |
8 |
|
9 |
#ifndef TERMINALPRINTER_H |
10 |
#define TERMINALPRINTER_H |
11 |
|
12 |
#include <string> |
13 |
|
14 |
/** |
15 |
* Simple helper class that remembers the amount of lines advanced on the |
16 |
* terminal (since this object was constructed) by printing out text to the |
17 |
* terminal with this class. This way the content been printed on the terminal |
18 |
* can completely be erased afterwards once necessary. |
19 |
*/ |
20 |
class TerminalPrinter { |
21 |
public: |
22 |
TerminalPrinter(); |
23 |
virtual ~TerminalPrinter(); |
24 |
int linesAdvanced() const; |
25 |
TerminalPrinter& operator<< (const std::string s); |
26 |
protected: |
27 |
void printChar(char c); |
28 |
private: |
29 |
int m_lines; |
30 |
int m_col; |
31 |
int m_screenWidth; // in characters |
32 |
}; |
33 |
|
34 |
#endif // TERMINALPRINTER_H |