FACT++  1.0
Console.h
Go to the documentation of this file.
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:
11 
12  void PrintReadlineError(const std::string &str);
13 
14 public:
15  ConsoleStream(const char *name);
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:
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(bool);
72  void Run(const char * = 0);
73 };
74 
75 #endif
This is an extension to the Readline class provding a colored output.
Definition: Console.h:7
void Run(const char *=0)
Just usleep until Stop() was called.
Definition: Console.cc:252
bool fContinous
Definition: Console.h:40
virtual bool PrintCommands()
Definition: Readline.cc:962
void SetNullOutput(bool n=true)
Switch on or off any physical output to the screen (cout or fWindow)
Definition: WindowLog.h:137
This is an extension to the Readline class provding buffered output.
Definition: Console.h:34
void SetContinous(bool cont)
Definition: Console.h:49
WindowLog & GetStreamIn()
Definition: Console.h:22
char str[80]
Definition: test_client.c:7
A C++ ostream to an ncurses window supporting attributes and colors.
Definition: WindowLog.h:50
WindowLog fLogO
Definition: Console.h:10
WindowLog fLogI
Definition: Console.h:38
const WindowLog & GetStreamOut() const
Definition: Console.h:56
virtual bool Process(const std::string &str)
Definition: Readline.cc:1094
const WindowLog & GetStreamOut() const
Definition: Console.h:24
WindowLog & GetStreamIn()
Definition: Console.h:54
WindowLog fLogO
Definition: Console.h:37
void Lock()
Definition: Console.h:27
virtual void Startup()
Default: Do nothing.
Definition: Readline.cc:304
const WindowLog & GetStreamIn() const
Definition: Console.h:25
void PrintReadlineError(const std::string &str)
Definition: Console.cc:243
const WindowLog & GetStreamIn() const
Definition: Console.h:57
void SetNullOutput(bool null)
Definition: Console.h:18
WindowLog & GetStreamOut()
Definition: Console.h:21
WindowLog & GetStreamOut()
Definition: Console.h:53
ConsoleStream(const char *name)
Definition: Console.cc:236
bool IsContinous() const
Definition: Console.h:50
void Unlock()
Definition: Console.h:29
virtual void EventHook(bool newline=false)
Definition: Readline.cc:315
C++ wrapper for GNU's readline library.
Definition: Readline.h:10
virtual std::string GetLinePrompt() const
Definition: Readline.cc:592
virtual bool PrintGeneralHelp()
Definition: Readline.cc:983
virtual bool PrintKeyBindings()
Definition: Readline.cc:1025