00001 /* inmemory_alltermslist.h 00002 * 00003 * Copyright 1999,2000,2001 BrightStation PLC 00004 * Copyright 2003,2008,2009 Olly Betts 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 00019 * USA 00020 */ 00021 00022 #ifndef OM_HGUARD_INMEMORY_ALLTERMSLIST_H 00023 #define OM_HGUARD_INMEMORY_ALLTERMSLIST_H 00024 00025 #include "alltermslist.h" 00026 #include "inmemory_database.h" 00027 00029 class InMemoryAllTermsList : public AllTermsList 00030 { 00031 private: 00033 InMemoryAllTermsList(const InMemoryAllTermsList &); 00034 00036 void operator=(const InMemoryAllTermsList &); 00037 00038 const std::map<string, InMemoryTerm> *tmap; 00039 00040 std::map<string, InMemoryTerm>::const_iterator it; 00041 00042 Xapian::Internal::RefCntPtr<const InMemoryDatabase> database; 00043 00044 string prefix; 00045 00046 public: 00048 InMemoryAllTermsList(const std::map<string, InMemoryTerm> *tmap_, 00049 Xapian::Internal::RefCntPtr<const InMemoryDatabase> database_, 00050 const string & prefix_) 00051 : tmap(tmap_), it(tmap->begin()), database(database_), 00052 prefix(prefix_) 00053 { 00054 } 00055 00056 // Gets current termname 00057 string get_termname() const; 00058 00059 // Get num of docs indexed by term 00060 Xapian::doccount get_termfreq() const; 00061 00062 // Get num of docs indexed by term 00063 Xapian::termcount get_collection_freq() const; 00064 00065 TermList * skip_to(const string &tname); 00066 00069 TermList * next(); 00070 00071 // True if we're off the end of the list 00072 bool at_end() const; 00073 }; 00074 00075 #endif /* OM_HGUARD_INMEMORY_ALLTERMSLIST_H */