00001 /* flint_spellingwordslist.h: A termlist containing all words which are spelling targets. 00002 * 00003 * Copyright (C) 2005,2008 Olly Betts 00004 * Copyright (C) 2007 Lemur Consulting Ltd 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License as 00008 * published by the Free Software Foundation; either version 2 of the 00009 * License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef XAPIAN_HGUARD_FLINT_SPELLINGWORDSLIST_H 00022 #define XAPIAN_HGUARD_FLINT_SPELLINGWORDSLIST_H 00023 00024 #include "alltermslist.h" 00025 #include "database.h" 00026 #include "flint_spelling.h" 00027 00028 class FlintCursor; 00029 00030 class FlintSpellingWordsList : public AllTermsList { 00032 FlintSpellingWordsList(const FlintSpellingWordsList &); 00033 00035 void operator=(const FlintSpellingWordsList &); 00036 00038 Xapian::Internal::RefCntPtr<const Xapian::Database::Internal> database; 00039 00043 FlintCursor * cursor; 00044 00051 mutable Xapian::termcount termfreq; 00052 00054 void read_termfreq() const; 00055 00056 public: 00057 FlintSpellingWordsList(Xapian::Internal::RefCntPtr<const Xapian::Database::Internal> database_, 00058 FlintCursor * cursor_) 00059 : database(database_), cursor(cursor_), termfreq(0) { 00060 // Seek to the entry before the first key with a "W" prefix, so the 00061 // first next() will advance us to the first such entry. 00062 cursor->find_entry(string("W", 1)); 00063 } 00064 00066 ~FlintSpellingWordsList(); 00067 00073 string get_termname() const; 00074 00080 Xapian::doccount get_termfreq() const; 00081 00087 Xapian::termcount get_collection_freq() const; 00088 00090 TermList * next(); 00091 00093 TermList * skip_to(const string &tname); 00094 00096 bool at_end() const; 00097 }; 00098 00099 #endif /* XAPIAN_HGUARD_FLINT_SPELLINGWORDSLIST_H */