00001 /* brass_alltermslist.h: A termlist containing all terms in a brass database. 00002 * 00003 * Copyright (C) 2005,2007,2008,2009,2010 Olly Betts 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License as 00007 * published by the Free Software Foundation; either version 2 of the 00008 * License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 00018 * USA 00019 */ 00020 00021 #ifndef XAPIAN_INCLUDED_BRASS_ALLTERMSLIST_H 00022 #define XAPIAN_INCLUDED_BRASS_ALLTERMSLIST_H 00023 00024 #include "alltermslist.h" 00025 #include "brass_database.h" 00026 #include "brass_postlist.h" 00027 00028 class BrassCursor; 00029 00030 class BrassAllTermsList : public AllTermsList { 00032 BrassAllTermsList(const BrassAllTermsList &); 00033 00035 void operator=(const BrassAllTermsList &); 00036 00038 Xapian::Internal::RefCntPtr<const BrassDatabase> database; 00039 00043 BrassCursor * cursor; 00044 00046 std::string current_term; 00047 00049 std::string prefix; 00050 00057 mutable Xapian::doccount termfreq; 00058 00060 mutable Xapian::termcount collfreq; 00061 00063 void read_termfreq_and_collfreq() const; 00064 00065 public: 00066 BrassAllTermsList(Xapian::Internal::RefCntPtr<const BrassDatabase> database_, 00067 const std::string & prefix_) 00068 : database(database_), cursor(NULL), prefix(prefix_), termfreq(0) { } 00069 00071 ~BrassAllTermsList(); 00072 00078 std::string get_termname() const; 00079 00085 Xapian::doccount get_termfreq() const; 00086 00092 Xapian::termcount get_collection_freq() const; 00093 00095 TermList * next(); 00096 00098 TermList * skip_to(const std::string &tname); 00099 00101 bool at_end() const; 00102 }; 00103 00104 #endif /* XAPIAN_INCLUDED_BRASS_ALLTERMSLIST_H */