]> Creatis software - cpPlugins.git/blob - lib/TinyCon/Trie.h
Moved to version 1.0
[cpPlugins.git] / lib / TinyCon / Trie.h
1 // =========================================================================
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // =========================================================================
4 #ifndef __TinyCon__Trie__h__
5 #define __TinyCon__Trie__h__
6
7 #include <map>
8 #include <string>
9 #include <vector>
10 #include <utility>
11 #include <cpPlugins_TinyCon_Export.h>
12
13 namespace TinyCon
14 {
15   /**
16    */
17   class CPPLUGINS_TINYCON_EXPORT Trie
18   {
19   public:
20     typedef Trie                    Self;
21     typedef std::map< char, Self* > TChildren;
22
23   public:
24     Trie( );
25     virtual ~Trie( );
26
27     virtual bool IsWord( ) const;
28
29     virtual Self* createExtension( );
30     virtual Self* getExtension( );
31     virtual const Self* getExtension( ) const;
32     virtual void setExtension( Self* extension );
33
34     virtual Self* insert( const std::string& w );
35     virtual void words( std::vector< std::string >& options ) const;
36     virtual std::pair< Self*, std::string > find(
37       const std::string& line, const std::size_t& p = 0
38       );
39     virtual std::pair< const Self*, std::string > find(
40       const std::string& line, const std::size_t& p = 0
41       ) const;
42
43   protected:
44     TChildren m_Next;
45     bool      m_IsWord;
46     Self*     m_Extension;
47   };
48 } // end namespace
49
50 #endif // __TinyCon__Trie__h__
51
52 // eof - $RCSfile$