Enable unbuffered terminal input.  
 More...
#include <JKeypress.hh>
Enable unbuffered terminal input. 
Definition at line 32 of file JKeypress.hh.
 
◆ JKeypress() [1/3]
  
  
      
        
          | 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.
   43    {
   44      tcgetattr(STDIN_FILENO, &
termcap);
 
   45 
   47 
   48      
   49 
   50      buffer.c_lflag     &= ~ICANON;
   51      buffer.c_lflag     &= (echo ? ECHO : ~ECHO);
   52      buffer.c_cc[VTIME]  = 0;
   53      buffer.c_cc[VMIN]   = 1;
   54 
   55      tcsetattr(STDIN_FILENO, TCSANOW, &buffer);
   56    }
 
 
 
◆ ~JKeypress()
  
  
      
        
          | JSYSTEM::JKeypress::~JKeypress  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Destructor. 
Definition at line 62 of file JKeypress.hh.
   63    {
   64      tcsetattr(STDIN_FILENO, TCSANOW, &
termcap);
 
   65    }
 
 
 
◆ JKeypress() [2/3]
  
  
      
        
          | JSYSTEM::JKeypress::JKeypress  | 
          ( | 
          const JKeypress & |            | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ JKeypress() [3/3]
  
  
      
        
          | JSYSTEM::JKeypress::JKeypress  | 
          ( | 
          JKeypress && |            | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ get()
  
  
      
        
          | 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.
   75    {
   76      char c;
   77 
   78      ::read(STDIN_FILENO, &c, 1);
 
   79 
   80      return c;
   81    }
bool read(Vec &v, std::istream &is)
Read a Vec(tor) from a stream.
 
 
 
 
◆ timeout()
  
  
      
        
          | 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.
   93    {
   95      
   97    }
void set(const int file_descriptor)
Set file descriptor.
 
bool in_avail(JTimeval timeout=JTimeval::min())
Check availability of input.
 
bool timeout(JTimeval timeout)
Timeout method.
 
 
 
 
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ termcap
  
  
      
        
          | termios JSYSTEM::JKeypress::termcap | 
         
       
   | 
  
private   | 
  
 
 
◆ mask
The documentation for this class was generated from the following file: