]> Creatis software - cpPlugins.git/blob - lib/TinyCon/Console.h
Moved to version 1.0
[cpPlugins.git] / lib / TinyCon / Console.h
1 // =========================================================================\r
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)\r
3 // =========================================================================\r
4 #ifndef __TinyCon__Console__h__\r
5 #define __TinyCon__Console__h__\r
6 \r
7 #include <cpPlugins_TinyCon_Export.h>\r
8 \r
9 #include <deque>\r
10 #include <string>\r
11 \r
12 namespace TinyCon\r
13 {\r
14   /**\r
15    */\r
16   class CPPLUGINS_TINYCON_EXPORT Console\r
17   {\r
18   public:\r
19     typedef Console Self;\r
20 \r
21   public:\r
22     Console( );\r
23     Console( const std::string& prompt );\r
24     virtual ~Console( );\r
25 \r
26     void run( );\r
27     void setPrompt( const std::string& prompt );\r
28     virtual int trigger( const std::string& cmd );\r
29     virtual int hotkeys( char c );\r
30     void pause( );\r
31     void quit( );\r
32     std::string getLine( );\r
33     std::string getLine( int mode, const std::string& delimiter = "" );\r
34     void setMaxHistory( int count );\r
35     void setBuffer( const std::string& buffer );\r
36 \r
37   public:\r
38     static const unsigned long MAX_HISTORY;\r
39     static const char KEY_CTRL1;\r
40     static const char BACKSPACE;\r
41     static const char UP_ARROW;\r
42     static const char DOWN_ARROW;\r
43     static const char RIGHT_ARROW;\r
44     static const char LEFT_ARROW;\r
45     static const char TAB;\r
46     static const char ESC;\r
47     static const char DEL;\r
48     static const char NEWLINE;\r
49     static const short M_LINE;\r
50     static const short M_PASSWORD;\r
51 \r
52   protected:\r
53     bool m_Quit;\r
54     int m_MaxHistory;\r
55     std::string m_Prompt;\r
56 \r
57     int m_Pos;\r
58     int m_LinePos;\r
59     bool m_SkipOut;\r
60     char m_Char;\r
61     std::string m_String;\r
62     std::string m_Unused;\r
63     std::deque< char > m_Buffer;\r
64     std::deque< std::string > m_History;\r
65   };\r
66 \r
67 } // end namespace\r
68 \r
69 #endif // __TinyCon__Console__h__\r
70 \r
71 // eof - $RCSfile$\r