32 #include <string_view>
34 using namespace Glass;
37 #ifdef XAPIAN_DEBUG_LOG
39 hex_display_encode(string_view
input)
41 const char* table =
"0123456789abcdef";
43 for (
unsigned char val :
input) {
45 result += table[val >> 4];
46 result += table[val & 0x0f];
55 : is_positioned(
false),
59 version(B_->cursor_version),
62 B->cursor_created_since_last_modification =
true;
65 for (
int j = 0; j <=
level; ++j) {
73 int new_level =
B->level;
74 if (new_level <=
level) {
75 for (
int j = 0; j < new_level; ++j) {
78 for (
int j = new_level; j <=
level; ++j) {
84 for (
int i = 0; i <
level; ++i) {
89 for (
int j =
level; j < new_level; ++j) {
96 B->cursor_created_since_last_modification =
true;
108 LOGCALL(DB,
bool,
"GlassCursor::next", NO_ARGS);
119 if (!
B->next(
C, 0)) {
146 LOGCALL(DB,
bool,
"GlassCursor::find_entry", key);
178 if (!
B->prev(
C, 0)) {
202 if (!
B->prev(
C, 0)) {
215 LOGCALL(DB,
bool,
"GlassCursor::find_exact", key);
242 LOGCALL(DB,
bool,
"GlassCursor::find_entry_ge", key);
266 if (!
B->next(
C, 0)) {
286 (void)
LeafItem(
C[0].get_p(),
C[0].
c).key().read(key);
292 LOGCALL(DB,
bool,
"GlassCursor::read_tag", keep_compressed);
295 while (!
LeafItem(
C[0].get_p(),
C[0].c).first_component()) {
296 if (!
B->prev(
C, 0)) {
342 #ifdef DISABLE_GPL_LIBXAPIAN
343 # error GPL source we cannot relicense included in libxapian
const GlassTable * B
The Btree table.
void get_key(string *key) const
Get the key.
string current_key
Current key pointed to by cursor.
bool find_exact(const string &key)
Position the cursor exactly on a key.
bool find_entry(const string &key)
Position the cursor on the highest entry with key <= key.
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.
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.
uint8_t * init(unsigned block_size)
int c
offset in the block's directory
const uint8_t * clone(const Cursor &o)
bool first_component() const
bool del()
Delete the current key/tag pair, leaving the cursor on the next entry.
DatabaseCorruptError indicates database corruption was detected.
#define LOGCALL(CATEGORY, TYPE, FUNC, PARAMS)
#define LOGCALL_VOID(CATEGORY, FUNC, PARAMS)
Hierarchy of classes which Xapian can throw as exceptions.
Interface to Btree cursors.
#define GLASS_BTREE_MAX_KEY_LEN
The largest possible value of a key_len.
Various assertion macros.