]> Creatis software - cpPlugins.git/blobdiff - lib/TinyCon/CompletionConsole.h
Moved to version 1.0
[cpPlugins.git] / lib / TinyCon / CompletionConsole.h
diff --git a/lib/TinyCon/CompletionConsole.h b/lib/TinyCon/CompletionConsole.h
new file mode 100644 (file)
index 0000000..6ff4f4e
--- /dev/null
@@ -0,0 +1,47 @@
+// =========================================================================
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// =========================================================================
+#ifndef __TinyCon__CompletionConsole__h__
+#define __TinyCon__CompletionConsole__h__
+
+#include <TinyCon/Console.h>
+#include <TinyCon/Trie.h>
+
+namespace TinyCon
+{
+  /**
+   */
+  class CPPLUGINS_TINYCON_EXPORT CompletionConsole
+    : public TinyCon::Console
+  {
+  public:
+    typedef CompletionConsole Self;
+    typedef TinyCon::Console  Superclass;
+
+    typedef TinyCon::Trie TTrie;
+
+  public:
+    CompletionConsole( );
+    CompletionConsole( const std::string& prompt );
+    virtual ~CompletionConsole( );
+
+    TTrie* addCommand( const std::string& cmd );
+    TTrie* addCommand( const std::string& cmd, const std::string& opt );
+    TTrie* addCommand( const std::string& cmd, Trie* opt );
+
+    virtual int trigger( const std::vector< std::string >& args ) = 0;
+    virtual int trigger( const std::string& s ) override;
+    virtual int hotkeys( char c ) override;
+
+  protected:
+    std::string _prefix( const std::vector< std::string >& v ) const;
+
+  protected:
+    TTrie m_CommandsTrie;
+  };
+
+} // end namespace
+
+#endif // __TinyCon__CompletionConsole__h__
+
+// eof - $RCSfile$