34 #ifdef XAPIAN_DEBUG_LOG 36 hex_display_encode(
const string &
input)
38 const char * table =
"0123456789abcdef";
40 for (string::const_iterator i = input.begin(); i != input.end(); ++i) {
41 unsigned char val = *i;
43 result += table[val / 16];
44 result += table[val % 16];
54 : is_positioned(
false),
58 version(B_->cursor_version),
61 B->cursor_created_since_last_modification =
true;
64 for (
int j = 0; j <
level; j++) {
66 C[j].
p =
new uint8_t[
B->block_size];
75 int new_level =
B->level;
76 if (new_level <=
level) {
77 for (
int i = 0; i < new_level; i++) {
80 for (
int j = new_level; j <
level; ++j) {
86 for (
int i = 0; i <
level; i++) {
91 for (
int j = level; j < new_level; j++) {
92 C[j].
p =
new uint8_t[
B->block_size];
100 B->cursor_created_since_last_modification =
true;
107 for (
int j = 0; j <
level; j++) {
116 LOGCALL(DB,
bool,
"ChertCursor::prev", NO_ARGS);
131 if (!
B->prev(
C, 0)) {
135 if (
Item(
C[0].p,
C[0].c).component_of() == 1) {
142 if (!
B->prev(
C, 0)) {
146 if (
Item(
C[0].p,
C[0].c).component_of() == 1) {
160 LOGCALL(DB,
bool,
"ChertCursor::next", NO_ARGS);
171 if (!
B->next(
C, 0)) {
197 LOGCALL(DB,
bool,
"ChertCursor::find_entry", key);
221 if (!
B->prev(
C, 0))
goto done;
224 if (!
B->prev(
C, 0)) {
245 LOGCALL(DB,
bool,
"ChertCursor::find_entry_ge", key);
269 if (!
B->next(
C, 0)) {
295 LOGCALL(DB,
bool,
"ChertCursor::read_tag", keep_compressed);
bool is_positioned
Whether the cursor is positioned at a valid entry.
bool prev()
Move to the previous key.
int c
offset in the block's directory
const ChertTable * B
The Btree table.
bool next()
Advance to the next key.
int level
The value of level in the Btree structure.
Cursor * C
Pointer to an array of Cursors.
Class managing a Btree table in a Chert database.
Hierarchy of classes which Xapian can throw as exceptions.
bool find_entry_ge(const string &key)
Position the cursor on the lowest entry with key >= key.
string current_tag
Current tag pointed to by cursor.
bool is_after_end
Whether the cursor is off the end of the table.
void rebuild()
Rebuild the cursor.
enum ChertCursor::@1 tag_status
Status of the current_tag member.
Interface to Btree cursors.
~ChertCursor()
Destroy the ChertCursor.
uint8_t * p
pointer to a block
bool del()
Delete the current key/tag pair, leaving the cursor on the next entry.
void get_key(string *key) const
Get the key.
DatabaseCorruptError indicates database corruption was detected.
string current_key
Current key pointed to by cursor.
#define CHERT_BTREE_MAX_KEY_LEN
The largest possible value of a key_len.
bool read_tag(bool keep_compressed=false)
Read the tag from the table and store it in current_tag.
ChertCursor(const ChertCursor &)
Copying not allowed.
Various assertion macros.
bool find_entry(const string &key)
Position the cursor on the highest entry with key <= key.
#define LOGCALL(CATEGORY, TYPE, FUNC, PARAMS)
void read(std::string *key) const