33 using namespace Glass;
35 #ifdef XAPIAN_DEBUG_LOG 37 hex_display_encode(
const string &
input)
39 const char * table =
"0123456789abcdef";
41 for (string::const_iterator i = input.begin(); i != input.end(); ++i) {
42 unsigned char val = *i;
44 result += table[val / 16];
45 result += table[val % 16];
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);
240 LOGCALL(DB,
bool,
"GlassCursor::find_entry_ge", key);
264 if (!
B->next(
C, 0)) {
284 (void)
LeafItem(
C[0].get_p(),
C[0].
c).key().read(key);
290 LOGCALL(DB,
bool,
"GlassCursor::read_tag", keep_compressed);
293 while (!
LeafItem(
C[0].get_p(),
C[0].c).first_component()) {
294 if (!
B->prev(
C, 0)) {
#define GLASS_BTREE_MAX_KEY_LEN
The largest possible value of a key_len.
bool first_component() const
bool is_after_end
Whether the cursor is off the end of the table.
Class managing a Btree table in a Glass database.
void find_entry_lt(const string &key)
Position the cursor on the highest entry with key < key.
const GlassTable * B
The Btree table.
bool del()
Delete the current key/tag pair, leaving the cursor on the next entry.
#define LOGCALL_VOID(CATEGORY, FUNC, PARAMS)
bool next()
Advance to the next key.
int level
The value of level in the Btree structure.
bool read_tag(bool keep_compressed=false)
Read the tag from the table and store it in current_tag.
void rebuild()
Rebuild the cursor.
Hierarchy of classes which Xapian can throw as exceptions.
~GlassCursor()
Destroy the GlassCursor.
string current_key
Current key pointed to by cursor.
string current_tag
Current tag pointed to by cursor.
const uint8_t * clone(const Cursor &o)
bool find_entry_ge(const string &key)
Position the cursor on the lowest entry with key >= key.
DatabaseCorruptError indicates database corruption was detected.
Interface to Btree cursors.
int c
offset in the block's directory
void get_key(string *key) const
Get the key.
bool find_exact(const string &key)
Position the cursor exactly on a key.
bool is_positioned
Whether the cursor is positioned at a valid entry.
GlassCursor(const GlassCursor &)
Copying not allowed.
Various assertion macros.
enum GlassCursor::@4 tag_status
Status of the current_tag member.
bool find_entry(const string &key)
Position the cursor on the highest entry with key <= key.
Glass::Cursor * C
Pointer to an array of Cursors.
uint8_t * init(unsigned block_size)
#define LOGCALL(CATEGORY, TYPE, FUNC, PARAMS)