X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FTinyCon%2FTrie.h;fp=lib%2FTinyCon%2FTrie.h;h=ec5b4fd3fab2abcf529fb4c851ceb9a5b948e588;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=0000000000000000000000000000000000000000;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/lib/TinyCon/Trie.h b/lib/TinyCon/Trie.h new file mode 100644 index 0000000..ec5b4fd --- /dev/null +++ b/lib/TinyCon/Trie.h @@ -0,0 +1,52 @@ +// ========================================================================= +// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) +// ========================================================================= +#ifndef __TinyCon__Trie__h__ +#define __TinyCon__Trie__h__ + +#include +#include +#include +#include +#include + +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$