00001 /* inmemory_positionlist.h 00002 * 00003 * ----START-LICENCE---- 00004 * Copyright 1999,2000,2001 BrightStation PLC 00005 * Copyright 2003 Olly Betts 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License as 00009 * published by the Free Software Foundation; either version 2 of the 00010 * License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00020 * USA 00021 * -----END-LICENCE----- 00022 */ 00023 00024 #ifndef OM_HGUARD_INMEMORY_POSITIONLIST_H 00025 #define OM_HGUARD_INMEMORY_POSITIONLIST_H 00026 00027 #include <xapian/types.h> 00028 #include <xapian/error.h> 00029 00030 #include <string> 00031 #include <vector> 00032 #include "positionlist.h" 00033 #include "documentterm.h" 00034 00035 using namespace std; 00036 00038 class InMemoryPositionList : public PositionList 00039 { 00040 private: 00042 vector<Xapian::termpos> positions; 00043 00045 vector<Xapian::termpos>::const_iterator mypos; 00046 00048 bool iterating_in_progress; 00049 00051 InMemoryPositionList(const InMemoryPositionList &); 00052 00054 void operator=(const InMemoryPositionList &); 00055 00056 public: 00058 InMemoryPositionList() : iterating_in_progress(false) { } 00059 00061 InMemoryPositionList(const OmDocumentTerm::term_positions & positions_); 00062 00064 ~InMemoryPositionList() { } 00065 00067 void set_data(const OmDocumentTerm::term_positions & positions_); 00068 00070 Xapian::termcount get_size() const; 00071 00073 Xapian::termpos get_position() const; 00074 00079 void next(); 00080 00085 void skip_to(Xapian::termpos termpos); 00086 00088 bool at_end() const; 00089 }; 00090 00091 #endif /* OM_HGUARD_INMEMORY_POSITIONLIST_H */