00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef OM_HGUARD_QUARTZ_POSITIONLIST_H
00027 #define OM_HGUARD_QUARTZ_POSITIONLIST_H
00028
00029 #include <xapian/types.h>
00030 #include "positionlist.h"
00031 #include "btree.h"
00032
00033 #include <string>
00034
00035 using namespace std;
00036
00037 class QuartzPositionListTable : public Btree {
00038 public:
00053 QuartzPositionListTable(string path_, bool readonly_)
00054 : Btree(path_ + "/position_", readonly_) { }
00055
00057 void set_positionlist(Xapian::docid did, const string & tname,
00058 Xapian::PositionIterator pos,
00059 const Xapian::PositionIterator &pos_end);
00060
00062 void delete_positionlist(Xapian::docid did, const string & tname);
00063 };
00064
00067 class QuartzPositionList : public PositionList {
00068 private:
00070 string data;
00071
00074 const char * pos;
00075
00078 const char * end;
00079
00081 bool is_at_end;
00082
00084 bool have_started;
00085
00087 Xapian::termpos current_pos;
00088
00090 Xapian::termcount number_of_entries;
00091
00093 QuartzPositionList(const QuartzPositionList &);
00094
00096 void operator=(const QuartzPositionList &);
00097
00099 void next_internal();
00100
00101 public:
00103 QuartzPositionList() : have_started(false) {}
00104
00106 ~QuartzPositionList() { return; }
00107
00109 void read_data(const Btree * table,
00110 Xapian::docid did,
00111 const string & tname);
00112
00114 Xapian::termcount get_size() const {
00115 DEBUGCALL(DB, Xapian::termcount, "QuartzPositionList::get_size", "");
00116 RETURN(number_of_entries);
00117 }
00118
00120 Xapian::termpos get_position() const {
00121 Assert(have_started);
00122 DEBUGCALL(DB, Xapian::termpos, "QuartzPositionList::get_position", "");
00123 RETURN(current_pos);
00124 }
00125
00130 void next();
00131
00136 void skip_to(Xapian::termpos termpos);
00137
00139 bool at_end() const {
00140 DEBUGCALL(DB, bool, "QuartzPositionList::at_end", "");
00141 RETURN(is_at_end);
00142 }
00143
00145 Xapian::termpos get_current_pos() {
00146 return(current_pos);
00147 }
00148 };
00149
00150 #endif