22 #ifndef XAPIAN_INCLUDED_GLASS_CURSOR_H
23 #define XAPIAN_INCLUDED_GLASS_CURSOR_H
33 #include <string_view>
37 #define BLK_UNUSED uint4(-1)
55 uint8_t *
init(
unsigned block_size) {
61 data =
new char[block_size + 8];
66 return reinterpret_cast<uint8_t*
>(
data + 8);
75 return reinterpret_cast<uint8_t*
>(
data + 8);
95 return *alignment_cast<uint4*>(
data);
104 return *alignment_cast<uint4*>(
data + 4);
110 *alignment_cast<uint4*>(
data + 4) = n;
119 return reinterpret_cast<uint8_t*
>(
data + 8);
125 char * new_data =
new char[block_size + 8];
126 std::memcpy(new_data,
data, block_size + 8);
131 return reinterpret_cast<uint8_t*
>(
data + 8);
208 void get_key(
string * key)
const;
266 bool read_tag(
bool keep_compressed =
false);
368 #ifdef DISABLE_GPL_LIBXAPIAN
369 # error GPL source we cannot relicense included in libxapian
Cast a pointer we know is suitably aligned.
A cursor pointing to a position in a Btree table, for reading several entries in order,...
const GlassTable * get_table() const
Return a pointer to the GlassTable we're a cursor for.
GlassCursor & operator=(const GlassCursor &)
Assignment not allowed.
const GlassTable * B
The Btree table.
void get_key(string *key) const
Get the key.
GlassCursor * clone() const
Clone a cursor.
string current_key
Current key pointed to by cursor.
bool find_exact(const string &key)
Position the cursor exactly on a key.
bool after_end() const
Determine whether cursor is off the end of table.
bool find_entry(const string &key)
Position the cursor on the highest entry with key <= key.
void to_end()
Set the cursor to be off the end of the table.
bool read_tag(bool keep_compressed=false)
Read the tag from the table and store it in current_tag.
int level
The value of level in the Btree structure.
void rebuild()
Rebuild the cursor.
bool next()
Advance to the next key.
void rewind()
Position cursor on the dummy empty key.
bool find_entry_ge(std::string_view key)
Position the cursor on the lowest entry with key >= key.
string current_tag
Current tag pointed to by cursor.
~GlassCursor()
Destroy the GlassCursor.
void find_entry_lt(const string &key)
Position the cursor on the highest entry with key < key.
enum GlassCursor::@6 tag_status
Status of the current_tag member.
bool is_after_end
Whether the cursor is off the end of the table.
bool is_positioned
Whether the cursor is positioned at a valid entry.
Glass::Cursor * C
Pointer to an array of Cursors.
GlassCursor(const GlassCursor &)
Copying not allowed.
Class managing a Btree table in a Glass database.
Cursor & operator=(const Cursor &)
uint8_t * init(unsigned block_size)
uint8_t * get_modifiable_p(unsigned block_size)
bool rewrite
true if the block is not the same as on disk, and so needs rewriting
int c
offset in the block's directory
uint4 get_n() const
Get the block number.
char * data
Pointer to reference counted data.
const uint8_t * clone(const Cursor &o)
const uint8_t * get_p() const
Get pointer to block.
MutableGlassCursor(GlassTable *B_)
Create a mutable cursor attached to a Btree.
bool del()
Delete the current key/tag pair, leaving the cursor on the next entry.
Definitions, types, etc for use inside glass.
Various assertion macros.