]> Creatis software - cpPlugins.git/blobdiff - lib/TinyCon/Console.h
Moved to version 1.0
[cpPlugins.git] / lib / TinyCon / Console.h
diff --git a/lib/TinyCon/Console.h b/lib/TinyCon/Console.h
new file mode 100644 (file)
index 0000000..b090dae
--- /dev/null
@@ -0,0 +1,71 @@
+// =========================================================================\r
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)\r
+// =========================================================================\r
+#ifndef __TinyCon__Console__h__\r
+#define __TinyCon__Console__h__\r
+\r
+#include <cpPlugins_TinyCon_Export.h>\r
+\r
+#include <deque>\r
+#include <string>\r
+\r
+namespace TinyCon\r
+{\r
+  /**\r
+   */\r
+  class CPPLUGINS_TINYCON_EXPORT Console\r
+  {\r
+  public:\r
+    typedef Console Self;\r
+\r
+  public:\r
+    Console( );\r
+    Console( const std::string& prompt );\r
+    virtual ~Console( );\r
+\r
+    void run( );\r
+    void setPrompt( const std::string& prompt );\r
+    virtual int trigger( const std::string& cmd );\r
+    virtual int hotkeys( char c );\r
+    void pause( );\r
+    void quit( );\r
+    std::string getLine( );\r
+    std::string getLine( int mode, const std::string& delimiter = "" );\r
+    void setMaxHistory( int count );\r
+    void setBuffer( const std::string& buffer );\r
+\r
+  public:\r
+    static const unsigned long MAX_HISTORY;\r
+    static const char KEY_CTRL1;\r
+    static const char BACKSPACE;\r
+    static const char UP_ARROW;\r
+    static const char DOWN_ARROW;\r
+    static const char RIGHT_ARROW;\r
+    static const char LEFT_ARROW;\r
+    static const char TAB;\r
+    static const char ESC;\r
+    static const char DEL;\r
+    static const char NEWLINE;\r
+    static const short M_LINE;\r
+    static const short M_PASSWORD;\r
+\r
+  protected:\r
+    bool m_Quit;\r
+    int m_MaxHistory;\r
+    std::string m_Prompt;\r
+\r
+    int m_Pos;\r
+    int m_LinePos;\r
+    bool m_SkipOut;\r
+    char m_Char;\r
+    std::string m_String;\r
+    std::string m_Unused;\r
+    std::deque< char > m_Buffer;\r
+    std::deque< std::string > m_History;\r
+  };\r
+\r
+} // end namespace\r
+\r
+#endif // __TinyCon__Console__h__\r
+\r
+// eof - $RCSfile$\r