The Pedigree Project  0.1
DebuggerIO.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef DEBUGGER_IO_H
21 #define DEBUGGER_IO_H
22 
23 #include "pedigree/kernel/processor/types.h"
24 #include "pedigree/kernel/utilities/StaticString.h"
25 
29 #define COMMAND_MAX 256
30 class DebuggerCommand;
31 
49 {
50  public:
54  enum Colour
55  {
56  Black = 0,
57  Blue = 1,
58  Green = 2,
59  Cyan = 3,
60  Red = 4,
61  Magenta = 5,
62  Orange = 6,
63  LightGrey = 7,
64  DarkGrey = 8,
65  LightBlue = 9,
66  LightGreen = 10,
67  LightCyan = 11,
68  LightRed = 12,
69  LightMagenta = 13,
70  Yellow = 14,
71  White = 15
72  };
73 
78  {
79  }
80  virtual ~DebuggerIO()
81  {
82  }
83 
84  virtual void initialise() = 0;
85  virtual void destroy() = 0;
86 
92  virtual void setCliUpperLimit(size_t nlines) = 0;
93  virtual void setCliLowerLimit(size_t nlines) = 0;
94 
95  virtual void cls() = 0;
96 
97  virtual char getCharNonBlock() = 0;
98 
103  virtual void enableCli() = 0;
104  virtual void disableCli() = 0;
105 
110  virtual void
111  writeCli(const char *str, Colour foreColour, Colour backColour);
112  virtual void writeCli(
113  char ch, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour);
120  virtual bool readCli(HugeStaticString &str, DebuggerCommand *pAutoComplete);
121 
127  virtual void drawHorizontalLine(
128  char c, size_t row, size_t colStart, size_t colEnd, Colour foreColour,
129  Colour backColour) = 0;
130  virtual void drawVerticalLine(
131  char c, size_t col, size_t rowStart, size_t rowEnd, Colour foreColour,
132  Colour backColour) = 0;
133 
138  virtual void drawString(
139  const char *str, size_t row, size_t col, Colour foreColour,
140  Colour backColour) = 0;
141 
145  virtual size_t getWidth() = 0;
146  virtual size_t getHeight() = 0;
147 
152  virtual void enableRefreshes() = 0;
153  virtual void disableRefreshes() = 0;
154  virtual void forceRefresh() = 0;
155 
156  virtual void readDimensions() = 0;
157 
162  virtual char getChar() = 0;
163 
164  protected:
165  virtual void putChar(
166  char c, DebuggerIO::Colour foreColour,
167  DebuggerIO::Colour backColour) = 0;
168 
172  virtual void scroll() = 0;
173 
177  virtual void moveCursor() = 0;
178 
182  bool m_bReady;
183 
187  char m_pCommand[COMMAND_MAX];
188 
193 };
194 
197 #endif
virtual size_t getWidth()=0
bool m_bReady
Definition: DebuggerIO.h:182
virtual void enableCli()=0
virtual void writeCli(const char *str, Colour foreColour, Colour backColour)
Definition: DebuggerIO.cc:114
virtual bool readCli(HugeStaticString &str, DebuggerCommand *pAutoComplete)
Definition: DebuggerIO.cc:24
char m_pCommand[COMMAND_MAX]
Definition: DebuggerIO.h:187
virtual char getChar()=0
virtual void enableRefreshes()=0
virtual void moveCursor()=0
virtual void setCliUpperLimit(size_t nlines)=0
virtual void scroll()=0
virtual void drawString(const char *str, size_t row, size_t col, Colour foreColour, Colour backColour)=0
bool m_bRefreshesEnabled
Definition: DebuggerIO.h:192
virtual void drawHorizontalLine(char c, size_t row, size_t colStart, size_t colEnd, Colour foreColour, Colour backColour)=0