AbstractTerminal.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Utils_Termlib_AbstractTerminal_
18 #define HH_SENF_Utils_Termlib_AbstractTerminal_ 1
19 
20 // Custom includes
21 #include <string>
22 
23 //#include "AbstractTerminal.mpp"
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 namespace senf {
27 namespace term {
28 
44  {
49  struct Callbacks {
50  virtual ~Callbacks() {}
51  virtual bool cb_init() = 0;
52 
54  virtual void cb_charReceived(char ch) = 0;
55  virtual void cb_windowSizeChanged() = 0;
56  };
57 
58  virtual ~AbstractTerminal() {}
59 
60  virtual void setCallbacks(Callbacks & cb) = 0;
61 
62  virtual std::string terminalType() = 0;
63  virtual unsigned width() const = 0;
64  virtual unsigned height() const = 0;
65 
66  virtual void write(char ch) = 0;
67  };
68 
69 }}
70 
71 //-/////////////////////////////////////////////////////////////////////////////////////////////////
72 //#include "AbstractTerminal.cci"
73 //#include "AbstractTerminal.ct"
74 //#include "AbstractTerminal.cti"
75 #endif
76 
77 
78 // Local Variables:
79 // mode: c++
80 // fill-column: 100
81 // comment-column: 40
82 // c-file-style: "senf"
83 // indent-tabs-mode: nil
84 // ispell-local-dictionary: "american"
85 // compile-command: "scons -u test"
86 // End:
virtual void cb_charReceived(char ch)=0
Called whenever a char is received.
virtual unsigned height() const =0
Get current terminal window height.
virtual void write(char ch)=0
Write character to terminal.
virtual std::string terminalType()=0
Get the terminal type.
virtual bool cb_init()=0
Called after terminal initialization is complete.
virtual void setCallbacks(Callbacks &cb)=0
Register terminal callbacks.
virtual void cb_windowSizeChanged()=0
Called when the terminal window is changed.
virtual unsigned width() const =0
Get current terminal window width.
Abstract terminal interface.