Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Examples  

stringpool.h

Go to the documentation of this file.
00001 #ifndef STRINGPOOL_H
00002 #define STRINGPOOL_H
00003 // $Id: stringpool.h,v 1.1.1.1 2002/03/24 12:37:03 dvermeir Exp $
00004 #include <string>
00005 #include <set>
00006 #include <stdexcept>
00007 
00019 class StringPool {
00020 public:
00022   StringPool();
00024   ~StringPool();
00031   const string* operator()(const string& s) const;
00039   const string* operator[](const string& s);
00045   struct compare {
00046     bool operator()(const string* s1, const string* s2) const throw (runtime_error) ;
00047     };
00055   void remove(const string& s);
00056   typedef set<const string*, compare> PtrSet;
00057   typedef PtrSet::const_iterator iterator;
00058 
00059   iterator begin() const { return pool_.begin(); }
00060   iterator end() const { return pool_.end(); }
00061   size_t size() const { return pool_.size(); }
00065 private:
00066   PtrSet pool_;
00067 };
00068 #endif
00069 

textindexer-0.2 [27 March, 2002]