Enable unbuffered terminal input.
More...
#include <JKeypress.hh>
Enable unbuffered terminal input.
Definition at line 32 of file JKeypress.hh.
JSYSTEM::JKeypress::JKeypress |
( |
const bool |
echo = true | ) |
|
|
inline |
Constructor.
The settings are modified by the constructor and the original settings are reset by the destructor.
- Parameters
-
echo | enable/disable echo of input character |
Definition at line 42 of file JKeypress.hh.
44 tcgetattr(STDIN_FILENO, &
termcap);
50 buffer.c_lflag &= ~ICANON;
51 buffer.c_lflag &= (echo ? ECHO : ~ECHO);
52 buffer.c_cc[VTIME] = 0;
53 buffer.c_cc[VMIN] = 1;
55 tcsetattr(STDIN_FILENO, TCSANOW, &buffer);
JSYSTEM::JKeypress::~JKeypress |
( |
| ) |
|
|
inline |
char JSYSTEM::JKeypress::get |
( |
| ) |
|
|
inline |
Get single character.
This method returns as soon as input from terminal is available.
- Returns
- character
Definition at line 74 of file JKeypress.hh.
78 ::read(STDIN_FILENO, &c, 1);
std::istream & read(std::istream &in, JContainer_t< TString, JAllocator_t > &object, const JBool< false > &option)
Auxiliary method for reading if TString does not exist.
bool JSYSTEM::JKeypress::timeout |
( |
JTimeval |
timeout | ) |
|
|
inline |
Timeout method.
This method returns immediatly if input from terminal is available, else after the specified timeout period.
- Parameters
-
- Returns
- true if input available; else false
Definition at line 92 of file JKeypress.hh.
bool timeout(JTimeval timeout)
Timeout method.
void set(const int file_descriptor)
Set file descriptor.
bool in_avail(JTimeval timeout=JTimeval::min())
Check availability of input.
termios JSYSTEM::JKeypress::termcap |
|
private |
The documentation for this class was generated from the following file: