]> Creatis software - cpPlugins.git/blobdiff - lib/TinyCon/Trie.h
Moved to version 1.0
[cpPlugins.git] / lib / TinyCon / Trie.h
diff --git a/lib/TinyCon/Trie.h b/lib/TinyCon/Trie.h
new file mode 100644 (file)
index 0000000..ec5b4fd
--- /dev/null
@@ -0,0 +1,52 @@
+// =========================================================================
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// =========================================================================
+#ifndef __TinyCon__Trie__h__
+#define __TinyCon__Trie__h__
+
+#include <map>
+#include <string>
+#include <vector>
+#include <utility>
+#include <cpPlugins_TinyCon_Export.h>
+
+namespace TinyCon
+{
+  /**
+   */
+  class CPPLUGINS_TINYCON_EXPORT Trie
+  {
+  public:
+    typedef Trie                    Self;
+    typedef std::map< char, Self* > TChildren;
+
+  public:
+    Trie( );
+    virtual ~Trie( );
+
+    virtual bool IsWord( ) const;
+
+    virtual Self* createExtension( );
+    virtual Self* getExtension( );
+    virtual const Self* getExtension( ) const;
+    virtual void setExtension( Self* extension );
+
+    virtual Self* insert( const std::string& w );
+    virtual void words( std::vector< std::string >& options ) const;
+    virtual std::pair< Self*, std::string > find(
+      const std::string& line, const std::size_t& p = 0
+      );
+    virtual std::pair< const Self*, std::string > find(
+      const std::string& line, const std::size_t& p = 0
+      ) const;
+
+  protected:
+    TChildren m_Next;
+    bool      m_IsWord;
+    Self*     m_Extension;
+  };
+} // end namespace
+
+#endif // __TinyCon__Trie__h__
+
+// eof - $RCSfile$