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

index.h

Go to the documentation of this file.
00001 #ifndef INDEX_H
00002 #define INDEX_H
00003 // $Id: index.h,v 1.1.1.1 2002/03/24 12:37:01 dvermeir Exp $
00004 #include <map>
00005 #include "stringpool.h"
00006 
00016 class Index {
00017 public:
00018   typedef set<string> Strings;
00019   typedef set<const string*> Files;
00020   typedef map<string, Files > Map;
00021   typedef map<const string*, time_t > Dates;
00022   typedef Map::const_iterator iterator;
00023 
00030   Index(size_t word_size, istream* is=0);
00031   ~Index();
00032 
00038   const string* file(const string& fn) const { return pool_(fn); }
00045   time_t date(const string& fn) const;
00046 
00052   const Files* query(const string&) const;
00053 
00061   Files& query(const Strings& q, Files& r) const;
00062 
00069   size_t insert(const string& fn, istream& is);
00070 
00071   const Strings& ignore() const { return ignore_; }
00076   void ignore(const string& w);
00081   void ignore(istream& is);
00086   void remove(const string& fn);
00087 
00101   friend ostream&
00102     operator<<(ostream& os, const Index& index);
00106   friend istream&
00107     operator>>(istream& os, Index& index) throw (runtime_error);
00108 
00109   StringPool& pool() { return pool_; }
00110   const StringPool& pool() const { return pool_; }
00111 
00112   iterator begin() const { return map_.begin(); }
00113   iterator end() const { return map_.end(); }
00114   size_t word_size() const { return word_size_; }
00115   size_t size() const { return map_.size(); }
00120 private:
00121   Strings ignore_;
00122   StringPool pool_;
00123   Map map_;
00124   Dates dates_;
00125   size_t word_size_;
00126 };
00127 #endif
00128 

textindexer-0.2 [27 March, 2002]