X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FTermlib%2FAbstractTerminal.hh;h=b3f396d0576708cdce4a112c8d6fad8687d2ecee;hb=fd3a0e8ac95d1158e9ea661ddf9187b67c70169f;hp=f38a4b5ba4d1d9b34f633ee43288c42abcc00716;hpb=27d5a4aaebd8abb6c6bb842af3c170063b206f0f;p=senf.git diff --git a/Utils/Termlib/AbstractTerminal.hh b/Utils/Termlib/AbstractTerminal.hh index f38a4b5..b3f396d 100644 --- a/Utils/Termlib/AbstractTerminal.hh +++ b/Utils/Termlib/AbstractTerminal.hh @@ -35,24 +35,44 @@ namespace senf { namespace term { + /** \brief Abstract terminal interface + + This abstract interface base class provides an abstract interface to a terminal. There are + two parts to this interface: + + \li The interface which allows the terminal user to get information about the terminal + \li The interface which allows the terminal to send messages to the terminal user + + The first part is implemented by providing abstract virtual members in AbstractTerminal. To + allow the terminal to send messages to the terminal user, the terminal user implements the + AbstractTerminal::Callbacks interface. The terminal user must register himself with the + AbstractTerminal by calling setCallbacks(). Afterwards, the AbstractTerminal implementation + will send calls to the terminal user via the AbstractTerminal::Callbacks API. + */ struct AbstractTerminal { + /** \brief AbstractTerminal callbacks + + \see AbastractTerminal + */ struct Callbacks { virtual ~Callbacks() {} - virtual bool cb_init() = 0; - virtual void cb_charReceived(char ch) = 0; - virtual void cb_windowSizeChanged() = 0; + virtual bool cb_init() = 0; ///< Called after terminal initialization is complete + /**< This member may return \c false. In this case, the + terminal setup is considered to have failed. */ + virtual void cb_charReceived(char ch) = 0; ///< Called whenever a char is received + virtual void cb_windowSizeChanged() = 0; ///< Called when the terminal window is changed }; virtual ~AbstractTerminal() {} - virtual void setCallbacks(Callbacks & cb) = 0; + virtual void setCallbacks(Callbacks & cb) = 0; ///< Register terminal callbacks - virtual std::string terminalType() = 0; - virtual unsigned width() = 0; - virtual unsigned height() = 0; + virtual std::string terminalType() = 0; ///< Get the terminal type + virtual unsigned width() = 0; ///< Get current terminal window width + virtual unsigned height() = 0; ///< Get current terminal window height - virtual void write(char ch) = 0; + virtual void write(char ch) = 0; ///< Write character to terminal }; }}