|
Last change
on this file since 14624 was 14083, checked in by tbretz, 13 years ago |
|
Moved switching off and on of the logging before and after a sleep to Lock() and Unlock() respectively.
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | #ifndef FACT_Console
|
|---|
| 2 | #define FACT_Console
|
|---|
| 3 |
|
|---|
| 4 | #include "Readline.h"
|
|---|
| 5 | #include "WindowLog.h"
|
|---|
| 6 |
|
|---|
| 7 | class ConsoleStream : public Readline
|
|---|
| 8 | {
|
|---|
| 9 | private:
|
|---|
| 10 | WindowLog fLogO;
|
|---|
| 11 |
|
|---|
| 12 | void PrintReadlineError(const std::string &str);
|
|---|
| 13 |
|
|---|
| 14 | public:
|
|---|
| 15 | ConsoleStream(const char *name);
|
|---|
| 16 | ~ConsoleStream();
|
|---|
| 17 |
|
|---|
| 18 | void SetNullOutput(bool null) { fLogO.SetNullOutput(null); }
|
|---|
| 19 |
|
|---|
| 20 | // I/O
|
|---|
| 21 | WindowLog &GetStreamOut() { return fLogO; }
|
|---|
| 22 | WindowLog &GetStreamIn() { return fLogO; }
|
|---|
| 23 |
|
|---|
| 24 | const WindowLog &GetStreamOut() const { return fLogO; }
|
|---|
| 25 | const WindowLog &GetStreamIn() const { return fLogO; }
|
|---|
| 26 |
|
|---|
| 27 | void Lock() { }
|
|---|
| 28 | void Run(const char * = 0);
|
|---|
| 29 | void Unlock() { }
|
|---|
| 30 | };
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 | class Console : public Readline
|
|---|
| 35 | {
|
|---|
| 36 | private:
|
|---|
| 37 | WindowLog fLogO;
|
|---|
| 38 | WindowLog fLogI;
|
|---|
| 39 |
|
|---|
| 40 | bool fContinous;
|
|---|
| 41 |
|
|---|
| 42 | void PrintReadlineError(const std::string &str);
|
|---|
| 43 |
|
|---|
| 44 | public:
|
|---|
| 45 | Console(const char *name);
|
|---|
| 46 | ~Console();
|
|---|
| 47 |
|
|---|
| 48 | // Console
|
|---|
| 49 | void SetContinous(bool cont) { fContinous = cont; }
|
|---|
| 50 | bool IsContinous() const { return fContinous; }
|
|---|
| 51 |
|
|---|
| 52 | // I/O
|
|---|
| 53 | WindowLog &GetStreamOut() { return fLogO; }
|
|---|
| 54 | WindowLog &GetStreamIn() { return fLogI; }
|
|---|
| 55 |
|
|---|
| 56 | const WindowLog &GetStreamOut() const { return fLogO; }
|
|---|
| 57 | const WindowLog &GetStreamIn() const { return fLogI; }
|
|---|
| 58 |
|
|---|
| 59 | // Readline
|
|---|
| 60 | bool PrintGeneralHelp();
|
|---|
| 61 | bool PrintCommands();
|
|---|
| 62 | bool PrintKeyBindings();
|
|---|
| 63 |
|
|---|
| 64 | void Lock();
|
|---|
| 65 | bool Process(const std::string &str);
|
|---|
| 66 | void Unlock();
|
|---|
| 67 |
|
|---|
| 68 | std::string GetLinePrompt() const;
|
|---|
| 69 |
|
|---|
| 70 | void Startup();
|
|---|
| 71 | void EventHook();
|
|---|
| 72 | void Run(const char * = 0);
|
|---|
| 73 | };
|
|---|
| 74 |
|
|---|
| 75 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.