backends/quartz/bcursor.h

Go to the documentation of this file.
00001 /* bcursor.h: Interface to Btree cursors
00002  *
00003  * Copyright 1999,2000,2001 BrightStation PLC
00004  * Copyright 2002,2003,2004,2006,2010 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_BCURSOR_H
00023 #define OM_HGUARD_BCURSOR_H
00024 
00025 #include <xapian/visibility.h>
00026 
00027 #include "quartz_types.h"
00028 
00029 #include <string>
00030 using std::string;
00031 
00032 #define BLK_UNUSED uint4(-1)
00033 
00034 class Cursor {
00035     private:
00036         // Prevent copying
00037         Cursor(const Cursor &);
00038         Cursor & operator=(const Cursor &);
00039 
00040     public:
00042         Cursor() : p(0), c(-1), n(BLK_UNUSED), rewrite(false)
00043         {}
00044 
00046         byte * p;
00048         int c;
00057         uint4 n;
00059         bool rewrite;
00060 };
00061 
00062 class Btree;
00063 
00067 class XAPIAN_VISIBILITY_DEFAULT Bcursor {
00068     private:
00070         Bcursor(const Bcursor &);
00071 
00073         Bcursor & operator=(const Bcursor &);
00074 
00079         void rebuild();
00080 
00086         bool is_positioned;
00087 
00090         bool is_after_end;
00091 
00094         bool have_read_tag;
00095 
00097         Btree * B;
00098 
00100         Cursor * C;
00101 
00102         unsigned long version;
00103 
00105         int level;
00106 
00127         bool get_key(string * key) const;
00128 
00129     public:
00141         Bcursor(Btree *B);
00142 
00144         ~Bcursor();
00145 
00148         string current_key;
00149 
00153         string current_tag;
00154 
00160         void read_tag();
00161 
00176         bool next();
00177  
00183         bool prev();
00184 
00209         bool find_entry(const string &key);
00210 
00216         bool after_end() { return is_after_end; }
00217 
00221         void del();
00222 };
00223 
00224 #endif /* OM_HGUARD_BCURSOR_H */

Documentation for Xapian (version 1.0.20).
Generated on 28 Apr 2010 by Doxygen 1.5.2.