Changeset 1313 for code/branches/console/src/core/Shell.h
- Timestamp:
- May 17, 2008, 3:58:19 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/core/Shell.h
r1312 r1313 30 30 #define _Shell_H__ 31 31 32 #include <list> 33 #include <vector> 34 32 35 #include "CorePrereqs.h" 33 36 … … 38 41 namespace orxonox 39 42 { 40 class ShellListener43 class _CoreExport ShellListener 41 44 { 42 virtual void outputChanged() = 0; 43 virtual void lastLineChanged() = 0; 44 virtual void inputChanged() = 0; 45 virtual void exit() = 0; 46 } 45 friend class Shell; 46 47 virtual void linesChanged() {} 48 virtual void onlyLastLineChanged() {} 49 virtual void lineAdded() {} 50 virtual void inputChanged() {} 51 virtual void cursorChanged() {} 52 virtual void exit() {} 53 }; 47 54 48 55 class _CoreExport Shell : virtual public OrxonoxClass, public InputBufferListener, public OutputBufferListener … … 53 60 virtual void setConfigValues(); 54 61 62 void registerListener(ShellListener* listener); 63 void unregisterListener(ShellListener* listener); 64 65 inline InputBuffer& getInputBuffer() 66 { return this->inputBuffer_; } 67 inline OutputBuffer& getOutputBuffer() 68 { return this->outputBuffer_; } 69 70 void setCursorPosition(unsigned int cursor); 71 inline unsigned int getCursorPosition() const 72 { return this->inputBuffer_.getCursorPosition(); } 73 74 void setInput(const std::string& input); 75 76 inline void clearInput() 77 { this->setInput(""); } 78 inline std::string getInput() const 79 { return this->inputBuffer_.get(); } 80 81 inline std::list<std::string>::const_iterator getNewestLineIterator() const; 82 inline std::list<std::string>::const_iterator getEndIterator() const; 83 84 void addLine(const std::string& line, unsigned int level); 85 void clearLines(); 86 87 inline unsigned int getNumLines() const 88 { return this->lines_.size(); } 89 inline unsigned int getScrollPosition() const 90 { return this->scrollPosition_; } 91 55 92 private: 56 93 Shell(); 57 94 Shell(const Shell& other); 58 ~Shell() {} 95 virtual ~Shell() {} 96 97 void addToHistory(const std::string& command); 98 std::string getFromHistory() const; 59 99 60 100 virtual void outputChanged(); … … 63 103 void hintandcomplete(); 64 104 void backspace(); 105 void deletechar(); 106 void clear(); 65 107 void cursor_right(); 66 108 void cursor_left(); 109 void cursor_end(); 110 void cursor_home(); 67 111 void history_up(); 68 112 void history_down(); … … 71 115 void exit(); 72 116 117 std::list<ShellListener*> listeners_; 73 118 InputBuffer inputBuffer_; 74 OutputBuffer OutputBuffer_;119 OutputBuffer outputBuffer_; 75 120 std::list<std::string> lines_; 76 unsigned int cursor_; 121 std::list<std::string>::const_iterator scrollIterator_; 122 unsigned int scrollPosition_; 77 123 std::vector<std::string> commandHistory_; 78 124 unsigned int maxHistoryLength_; 125 unsigned int historyPosition_; 126 unsigned int historyOffset_; 79 127 }; 80 128 }
Note: See TracChangeset
for help on using the changeset viewer.