00001 /* quartz_alltermslist.h 00002 * 00003 * ----START-LICENCE---- 00004 * Copyright 1999,2000,2001 BrightStation PLC 00005 * Copyright 2002,2003,2004 Olly Betts 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License as 00009 * published by the Free Software Foundation; either version 2 of the 00010 * License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00020 * USA 00021 * -----END-LICENCE----- 00022 */ 00023 00024 #ifndef OM_HGUARD_QUARTZ_ALLTERMSLIST_H 00025 #define OM_HGUARD_QUARTZ_ALLTERMSLIST_H 00026 00027 #include "alltermslist.h" 00028 #include "quartz_database.h" 00029 00030 class Bcursor; 00031 00033 class QuartzAllTermsList : public AllTermsList 00034 { 00035 private: 00037 QuartzAllTermsList(const QuartzAllTermsList &); 00038 00040 void operator=(const QuartzAllTermsList &); 00041 00043 Xapian::Internal::RefCntPtr<const Xapian::Database::Internal> database; 00044 00046 AutoPtr<Bcursor> pl_cursor; 00047 00049 bool is_at_end; 00050 00051 quartz_tablesize_t size; 00052 00053 bool started; 00054 00056 string current_term; 00057 00059 string prefix; 00060 00062 mutable bool have_stats; 00063 mutable Xapian::termcount termfreq; 00064 mutable Xapian::termcount collection_freq; 00065 00066 void get_stats() const; 00067 public: 00069 QuartzAllTermsList(Xapian::Internal::RefCntPtr<const Xapian::Database::Internal> database_, 00070 AutoPtr<Bcursor> pl_cursor_, 00071 quartz_tablesize_t size_, 00072 const string & prefix_); 00073 00075 ~QuartzAllTermsList(); 00076 00077 // Gets current termname 00078 string get_termname() const; 00079 00080 // Get num of docs indexed by term 00081 Xapian::doccount get_termfreq() const; 00082 00083 // Get num of docs indexed by term 00084 Xapian::termcount get_collection_freq() const; 00085 00086 TermList * skip_to(const string &tname); 00087 00090 TermList * next(); 00091 00092 // True if we're off the end of the list 00093 bool at_end() const; 00094 }; 00095 00096 #endif /* OM_HGUARD_QUARTZ_ALLTERMSLIST_H */