Tkrzw
|
Iterator for each record. More...
#include <tkrzw_dbm_tree.h>
Public Member Functions | |
~Iterator () | |
Destructor. More... | |
Iterator (const Iterator &rhs)=delete | |
Copy and assignment are disabled. More... | |
Iterator & | operator= (const Iterator &rhs)=delete |
Status | First () override |
Initializes the iterator to indicate the first record. More... | |
Status | Last () override |
Initializes the iterator to indicate the last record. More... | |
Status | Jump (std::string_view key) override |
Initializes the iterator to indicate a specific record. More... | |
Status | JumpLower (std::string_view key, bool inclusive=false) override |
Initializes the iterator to indicate the last record whose key is lower than a given key. More... | |
Status | JumpUpper (std::string_view key, bool inclusive=false) override |
Initializes the iterator to indicate the first record whose key is upper than a given key. More... | |
Status | Next () override |
Moves the iterator to the next record. More... | |
Status | Previous () override |
Moves the iterator to the previous record. More... | |
Status | Process (RecordProcessor *proc, bool writable) override |
Processes the current record with a processor. More... | |
Public Member Functions inherited from tkrzw::DBM::Iterator | |
virtual Status | Process (RecordLambdaType rec_lambda, bool writable) |
Processes the current record with a lambda function. More... | |
virtual Status | Get (std::string *key=nullptr, std::string *value=nullptr) |
Gets the key and the value of the current record of the iterator. More... | |
virtual std::string | GetKey (std::string_view default_value="") |
Gets the key of the current record, in a simple way. More... | |
virtual std::string | GetValue (std::string_view default_value="") |
Gets the value of the current record, in a simple way. More... | |
virtual Status | Set (std::string_view value, std::string *old_key=nullptr, std::string *old_value=nullptr) |
Sets the value of the current record. More... | |
virtual Status | Remove (std::string *old_key=nullptr, std::string *old_value=nullptr) |
Removes the current record. More... | |
virtual Status | Step (std::string *key=nullptr, std::string *value=nullptr) |
Gets the current record and moves the iterator to the next record. More... | |
Friends | |
class | TreeDBM |
Iterator for each record.
When the database is updated, some iterators may or may not be invalided. Operations with invalidated iterators fails gracefully with NOT_FOUND_ERROR. One iterator cannot be shared by multiple threads.
|
virtual |
Destructor.
Reimplemented from tkrzw::DBM::Iterator.
|
explicitdelete |
Copy and assignment are disabled.
|
overridevirtual |
Initializes the iterator to indicate the first record.
Precondition: The database is opened.
Even if there's no record, the operation doesn't fail.
Implements tkrzw::DBM::Iterator.
|
overridevirtual |
Initializes the iterator to indicate the last record.
Precondition: The database is opened.
Even if there's no record, the operation doesn't fail.
Implements tkrzw::DBM::Iterator.
|
overridevirtual |
Initializes the iterator to indicate a specific record.
key | The key of the record to look for. |
Precondition: The database is opened.
This database is ordered so it supports "lower bound" jump. If there's no record with the same key, the iterator refers to the first record whose key is greater than the given key.
Implements tkrzw::DBM::Iterator.
|
overridevirtual |
Initializes the iterator to indicate the last record whose key is lower than a given key.
key | The key to compare with. |
inclusive | If true, the considtion is inclusive: equal to or lower than the key. |
Precondition: The database is opened.
Even if there's no matching record, the operation doesn't fail.
Implements tkrzw::DBM::Iterator.
|
overridevirtual |
Initializes the iterator to indicate the first record whose key is upper than a given key.
key | The key to compare with. |
inclusive | If true, the considtion is inclusive: equal to or upper than the key. |
Precondition: The database is opened.
Even if there's no matching record, the operation doesn't fail. If the inclusive parameter is true, this method is the same as Jump(key).
Implements tkrzw::DBM::Iterator.
|
overridevirtual |
Moves the iterator to the next record.
Precondition: The database is opened and the iterator is initialized.
If the current record is missing, the operation fails. Even if there's no next record, the operation doesn't fail.
Implements tkrzw::DBM::Iterator.
|
overridevirtual |
Moves the iterator to the previous record.
Precondition: The database is opened.
If the current record is missing, the operation fails. Even if there's no previous previous record, the operation doesn't fail.
Implements tkrzw::DBM::Iterator.
|
overridevirtual |
Processes the current record with a processor.
proc | The pointer to the processor object. |
writable | True if the processor can edit the record. |
Precondition: The database is opened and the iterator is initialized. The writable parameter should be consistent to the open mode.
If the current record exists, the ProcessFull of the processor is called. Otherwise, this method fails and no method of the processor is called. If the current record is removed, the iterator is moved to the next record.
Implements tkrzw::DBM::Iterator.