Last change
on this file since 5173 was
5173,
checked in by bensch, 20 years ago
|
orxonox/trunk: added new Class ShellBuffer, that only handles the main shell's buffer
|
File size:
1.9 KB
|
Rev | Line | |
---|
[4838] | 1 | /*! |
---|
[5173] | 2 | * @file shell_buffer.h |
---|
| 3 | * @brief The Shell buffer Tasks |
---|
[3245] | 4 | */ |
---|
[1853] | 5 | |
---|
[5173] | 6 | #ifndef _SHELL_BUFFER_H |
---|
| 7 | #define _SHELL_BUFFER_H |
---|
[1853] | 8 | |
---|
[5173] | 9 | #include <stdarg.h> |
---|
| 10 | |
---|
| 11 | #define SHELL_BUFFER_SIZE 16384 //!< The Size of the input-buffers (should be large enough to carry any kind of input) |
---|
| 12 | |
---|
[4838] | 13 | // FORWARD DECLARATION |
---|
[5173] | 14 | template<class T> class tList; |
---|
| 15 | template<class T> class tIterator; |
---|
| 16 | class Text; |
---|
[3543] | 17 | |
---|
[3955] | 18 | //! A class for ... |
---|
[5173] | 19 | class ShellBuffer { |
---|
[1853] | 20 | |
---|
[1904] | 21 | public: |
---|
[5173] | 22 | ShellBuffer(); |
---|
| 23 | virtual ~ShellBuffer(); |
---|
[1853] | 24 | |
---|
[3245] | 25 | |
---|
[5173] | 26 | // BUFFER // |
---|
| 27 | /** @param bufferSize the new Buffer-Size */ |
---|
| 28 | void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; }; |
---|
| 29 | void setBufferDisplaySize(unsigned int bufferDisplaySize); |
---|
| 30 | void flushBuffers(); |
---|
| 31 | static bool addBufferLineStatic(const char* line, ...); |
---|
| 32 | void addBufferLine(const char* line, va_list arg); |
---|
| 33 | void printToDisplayBuffer(const char* text); |
---|
| 34 | void moveBuffer(unsigned int lineCount); |
---|
| 35 | // void moveBufferTo(unsigned int lineNumber); |
---|
| 36 | const char* getBufferLine(unsigned int lineNumber); |
---|
| 37 | |
---|
| 38 | |
---|
[3245] | 39 | private: |
---|
[5173] | 40 | unsigned int bufferSize; //!< The Size of the buffer |
---|
| 41 | unsigned int bufferDisplaySize; //!< The Size of the Display-buffer, in lines (not in characters) |
---|
| 42 | tList<char>* buffer; //!< A list of stored char-arrays(strings) to store the history |
---|
| 43 | tIterator<char>* bufferIterator; //!< An iterator for the Shells main buffer. |
---|
[3245] | 44 | |
---|
[5173] | 45 | Text** bufferText; //!< A list of stored bufferTexts for the display of the buffer |
---|
| 46 | char bufferArray[SHELL_BUFFER_SIZE]; //!< a BUFFER for fast writing |
---|
| 47 | char keepBufferArray[SHELL_BUFFER_SIZE]; //!< a BUFFER to have multi-non-newLine commands be copied into the shell. |
---|
| 48 | bool keepBuffer; //!< if the keepbuffer contains unfinished lines. |
---|
| 49 | |
---|
[1853] | 50 | }; |
---|
| 51 | |
---|
[5173] | 52 | #endif /* _SHELL_BUFFER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.