00001 00004 /* Copyright (C) 2007,2008,2010 Olly Betts 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (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_INCLUDED_CHERT_TERMLIST_H 00022 #define XAPIAN_INCLUDED_CHERT_TERMLIST_H 00023 00024 #include <string> 00025 00026 #include <xapian/base.h> 00027 #include <xapian/positioniterator.h> 00028 #include <xapian/types.h> 00029 00030 namespace Xapian { 00031 namespace Internal { 00032 class ExpandStats; 00033 } 00034 } 00035 00036 #include "chert_database.h" 00037 #include "termlist.h" 00038 #include "chert_table.h" 00039 00041 class ChertTermList : public TermList { 00043 void operator=(const ChertTermList &); 00044 00046 ChertTermList(const ChertTermList &); 00047 00049 Xapian::Internal::RefCntPtr<const ChertDatabase> db; 00050 00052 Xapian::docid did; 00053 00055 chert_doclen_t doclen; 00056 00058 Xapian::termcount termlist_size; 00059 00061 std::string data; 00062 00067 const char *pos; 00068 00070 const char *end; 00071 00073 std::string current_term; 00074 00076 Xapian::termcount current_wdf; 00077 00083 mutable Xapian::doccount current_termfreq; 00084 00085 public: 00087 ChertTermList(Xapian::Internal::RefCntPtr<const ChertDatabase> db_, 00088 Xapian::docid did_); 00089 00094 chert_doclen_t get_doclength() const; 00095 00100 Xapian::termcount get_approx_size() const; 00101 00103 void accumulate_stats(Xapian::Internal::ExpandStats & stats) const; 00104 00106 std::string get_termname() const; 00107 00109 Xapian::termcount get_wdf() const; 00110 00118 Xapian::doccount get_termfreq() const; 00119 00128 TermList * next(); 00129 00130 TermList * skip_to(const std::string & term); 00131 00133 bool at_end() const; 00134 00136 Xapian::termcount positionlist_count() const; 00137 00139 Xapian::PositionIterator positionlist_begin() const; 00140 }; 00141 00142 #endif // XAPIAN_INCLUDED_CHERT_TERMLIST_H