Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

tty.h

Go to the documentation of this file.
00001 #ifndef DV_UTIL_TTY_H 00002 #define DV_UTIL_TTY_H 00003 // $Id: tty.h,v 1.5 2002/12/26 10:40:47 dvermeir Exp $ 00004 00005 #include <string> 00006 #include <iostream> 00007 00008 /** \file 00009 * This file defines an iostream class ``Tty'' that provides rar 00010 * unbuffered input and output to /dev/tty. 00011 */ 00012 00013 namespace Dv { 00014 namespace Util { 00015 00016 /** 00017 * An iostream class that provides raw unbuffered input and output to 00018 * /dev/tty. 00019 */ 00020 class Tty: public std::iostream { 00021 public: 00022 /** Open /dev/tty as an unbuffered stream. 00023 * \param echo if true, characters will be echoed 00024 * \param delay if nonzero, an input operation will fail, and the 00025 * member function timedout() will return true, if no character is 00026 * typed for delay millisecs. 00027 * \param debug pointer to stream on which debug information will be 00028 * written. 00029 */ 00030 Tty(bool echo=false, time_t delay = 0, std::ostream* debug = 0); 00031 /** 00032 * Destructor. 00033 */ 00034 ~Tty(); 00035 /** \return true iff the last input operation timedout. This 00036 * condition can be reset using Tty::reset(). 00037 */ 00038 bool timedout() const; 00039 /** Clear the flags and set timedout to false. */ 00040 void reset(); 00041 /** Close the underlying file descriptor. */ 00042 void close(); 00043 private: 00044 bool echo_; 00045 }; 00046 00047 }} 00048 #endif

dvutil-0.13.15 [30 December, 2004]