Class mdbx::cursor_managed
ClassList > mdbx > cursor_managed
Managed cursor. More...
#include <mdbx.h++>
Inherits the following classes: mdbx::cursor
Public Types inherited from mdbx::cursor
See mdbx::cursor
| Type | Name |
|---|---|
| enum | bunch_delete Modes for deleting bunches of neighboring items, see MDBX_bunch_action_t() . The EXCLUDING and INCLUDING suffixes mean correspondingly excluding and including deletion items in the current cursor position. |
| enum | move_operation Cursor positioning operations, mirrors MDBX_cursor_op . |
Public Functions
| Type | Name |
|---|---|
| void | close () Explicitly closes the cursor. |
| cursor_managed (void * your_context=nullptr) Creates a new managed cursor with underlying object. |
|
| cursor_managed (cursor_managed &&) = default Move constructor. |
|
| cursor_managed (const cursor_managed &) = delete Copy construction is prohibited. |
|
| cursor_managed & | operator= (cursor_managed && other) noexcept Move assignment operator. |
| cursor_managed & | operator= (const cursor_managed &) = delete Copy assignment is prohibited. |
| MDBX_cursor * | withdraw_handle () noexcept Withdraws (takes over) the underlying C handle; this instance becomes empty and will not close the cursor. |
| ~cursor_managed () Destroys the managed cursor, closing the underlying object. |
Public Functions inherited from mdbx::cursor
See mdbx::cursor
| Type | Name |
|---|---|
| cursor_managed | clone (void * your_context=nullptr) const Creates a new managed cursor with the same position and context. |
| move_result | current (bool throw_notfound=true) const Read the current key/data item without moving. |
| constexpr | cursor () noexcept Constructs an empty (null) cursor. |
| cursor (const cursor &) noexcept Copy constructor. |
|
| cursor (cursor_managed &&) = delete |
|
| ptrdiff_t | distance_from (const cursor from, unsigned deepness=42) const Estimates the distance from the given cursor position to this one. |
| ptrdiff_t | distance_from_first (unsigned deepness=42) const Estimates the distance from the first item of the table to this cursor position. |
| ptrdiff_t | distance_to (const cursor to, unsigned deepness=42) const Estimates the distance from this cursor position to the given one. |
| ptrdiff_t | distance_to_end (unsigned deepness=42) const Estimates the distance from this cursor position to the end of the table. |
| bool | erase (CHARS key, BOOL whole_multivalue=true) Overloads for C strings, which otherwise bind to the bool parameters above. |
| bool | erase (const slice & key, const char(&) value) Removes the particular multi-value entry given by C string literals. |
| bool | erase (const char(&) key, const char(&) value) Removes the particular multi-value entry given by C string literals. |
| bool | fullscan (CALLABLE_PREDICATE predicate, bool backward=false) Scans the whole table calling the predicate until it returns true . |
| move_result | get_multiple_samelength (bool throw_notfound=false) Returns a batch of same-length multi-values at the current key. |
| const MDBX_cursor * | handle () noexcept const Returns the underlying C handle (read-only). |
| MDBX_cursor * | handle () noexcept Returns the underlying C handle. |
| void | insert (const pair & kv) Inserts a new key-value pair; fails if the key already exists. |
| bool | is_after_than (const cursor & other, bool ignore_nested=false) const Checks whether this cursor is after the given one. |
| bool | is_before_than (const cursor & other, bool ignore_nested=false) const Checks whether this cursor is before the given one. |
| bool | is_same_or_after_than (const cursor & other, bool ignore_nested=false) const Checks whether this cursor is at the same position or after the given one. |
| bool | is_same_or_before_than (const cursor & other, bool ignore_nested=false) const Checks whether this cursor is at the same position or before the given one. |
| bool | is_same_position (const cursor & other, bool ignore_nested=false) const Checks whether this cursor is at the same position as the given one. |
| move_result | move (move_operation operation, bool throw_notfound) Performs the given positioning operation. |
| move_result | move (move_operation operation, const slice & key, bool throw_notfound) Performs the given positioning operation at the specified key. |
| move_result | move (move_operation operation, const slice & key, const slice & value, bool throw_notfound) Performs the given positioning operation at the specified key-value pair. |
| move_result | move (move_operation operation, const slice & key, const slice & value) = delete Deleted: throw_notfound must be specified explicitly to avoid accidental boolean conversions. |
| bool | move (move_operation operation, SLICE & key, SLICE & value, bool throw_notfound) Performs the given positioning operation updating the key and value slices. |
| move_result | next_multiple_samelength (bool throw_notfound=false) Moves to the next key and returns its batch of same-length multi-values. |
| constexpr | operator MDBX_cursor * () noexcept Returns the underlying C handle. |
| constexpr | operator const MDBX_cursor * () noexcept const Returns the underlying C handle (read-only). |
| map_handle () const Converts the cursor to its table handle. |
|
| txn () const Converts the cursor to its transaction. |
|
| cursor & | operator= (const cursor &) noexcept Copy assignment operator. |
| cursor & | operator= (cursor_managed &&) = delete |
| move_result | previous_multiple_samelength (bool throw_notfound=false) Moves to the previous key and returns its batch of same-length multi-values. |
| void | put (const pair & kv, put_mode mode) Stores a key-value pair in the given mode. |
| size_t | put_multiple_samelength (const slice & key, const VALUE * values_array, size_t values_count, put_mode mode, bool allow_partial=false) Stores a bunch of same-length multi-values for the given key. |
| void | put_multiple_samelength (const slice & key, const ::std::vector< VALUE > & vector, put_mode mode) Stores a bunch of same-length multi-values for the given key. |
| slice | reserve_current (size_t value_length) Reserves and returns the space for storing a value associated with a key at the current cursor position. |
| slice | reverse_current (size_t value_length) Deprecated misspelling of reserve_current() . |
| bool | scan_until (CALLABLE_PREDICATE predicate, move_operation start=first, move_operation turn=next) Scans items calling the predicate until it returns true . |
| bool | scan_until_from (CALLABLE_PREDICATE predicate, slice & from, move_operation start=key_greater_or_equal, move_operation turn=next) Scans items starting from the given key, calling the predicate until it returns true . |
| bool | scan_until_from (CALLABLE_PREDICATE predicate, pair & from, move_operation start=pair_greater_or_equal, move_operation turn=next) Scans items starting from the given key-value pair, calling the predicate until it returns true . |
| move_result | seek_multiple_samelength (const slice & key, bool throw_notfound=true) Seeks and returns a batch of same-length multi-values of the given key. |
| move_result | to_current_first_multi (bool throw_notfound=true) Position the cursor at the first multi-value of the current key. |
| move_result | to_current_last_multi (bool throw_notfound=true) Position the cursor at the last multi-value of the current key. |
| move_result | to_current_next_multi (bool throw_notfound=true) Position the cursor at the next multi-value of the current key. |
| move_result | to_current_prev_multi (bool throw_notfound=true) Position the cursor at the previous multi-value of the current key. |
| move_result | to_exact_key_value_equal (const slice & key, const slice & value, bool throw_notfound=true) Position the cursor at the exact key and the multi-value equal to the given one. |
| move_result | to_exact_key_value_greater_or_equal (const slice & key, const slice & value, bool throw_notfound=true) Position the cursor at the exact key and the multi-value greater than or equal to the given one. |
| move_result | to_exact_key_value_greater_than (const slice & key, const slice & value, bool throw_notfound=true) Position the cursor at the exact key and the multi-value greater than the given one. |
| move_result | to_exact_key_value_lesser_or_equal (const slice & key, const slice & value, bool throw_notfound=true) Position the cursor at the exact key and the multi-value lesser than or equal to the given one. |
| move_result | to_exact_key_value_lesser_than (const slice & key, const slice & value, bool throw_notfound=true) Position the cursor at the exact key and the multi-value lesser than the given one. |
| move_result | to_first (bool throw_notfound=true) Position the cursor at the first key/data item. |
| move_result | to_key_equal (const slice & key, bool throw_notfound=true) Position the cursor at the key equal to the given one. |
| move_result | to_key_exact (const slice & key, bool throw_notfound=true) Position the cursor at the key exactly matching the given one. |
| move_result | to_key_greater_or_equal (const slice & key, bool throw_notfound=true) Position the cursor at the key greater than or equal to the given one. |
| move_result | to_key_greater_than (const slice & key, bool throw_notfound=true) Position the cursor at the key greater than the given one. |
| move_result | to_key_lesser_or_equal (const slice & key, bool throw_notfound=true) Position the cursor at the key lesser than or equal to the given one. |
| move_result | to_key_lesser_than (const slice & key, bool throw_notfound=true) Position the cursor at the key lesser than the given one. |
| move_result | to_last (bool throw_notfound=true) Position the cursor at the last key/data item. |
| move_result | to_next (bool throw_notfound=true) Position the cursor at the next key/data item. |
| move_result | to_next_first_multi (bool throw_notfound=true) Position the cursor at the first multi-value of the next key. |
| move_result | to_pair_equal (const slice & key, const slice & value, bool throw_notfound=true) Position the cursor at the key-value pair equal to the given one. |
| move_result | to_pair_exact (const slice & key, const slice & value, bool throw_notfound=true) Position the cursor at the key-value pair exactly matching the given one. |
| move_result | to_pair_greater_or_equal (const slice & key, const slice & value, bool throw_notfound=true) Position the cursor at the key-value pair greater than or equal to the given one. |
| move_result | to_pair_greater_than (const slice & key, const slice & value, bool throw_notfound=true) Position the cursor at the key-value pair greater than the given one. |
| move_result | to_pair_lesser_or_equal (const slice & key, const slice & value, bool throw_notfound=true) Position the cursor at the key-value pair lesser than or equal to the given one. |
| move_result | to_pair_lesser_than (const slice & key, const slice & value, bool throw_notfound=true) Position the cursor at the key-value pair lesser than the given one. |
| move_result | to_previous (bool throw_notfound=true) Position the cursor at the previous key/data item. |
| move_result | to_previous_last_multi (bool throw_notfound=true) Position the cursor at the last multi-value of the previous key. |
| value_result | try_insert (const pair & kv) Tries to insert a new key-value pair without throwing on a duplicate. |
| void | update_current (const slice & value) Updates value associated with a key at the current cursor position. |
| void | upsert (const pair & kv) Inserts or updates the value for the given key. |
Protected Attributes inherited from mdbx::cursor
See mdbx::cursor
| Type | Name |
|---|---|
| MDBX_cursor * | handle_ = {nullptr}The underlying C cursor handle, null for an empty instance. |
Detailed Description
As other managed classes, cursor_managed destroys the represented underlying object from the own class destructor, but disallows copying and assignment for instances.
See also: mdbx_cursor_create()
See also: mdbx_cursor_bind()
See also: mdbx_cursor_close()
Public Functions Documentation
function close
Explicitly closes the cursor.
void mdbx::cursor_managed::close ()
function cursor_managed [2/4]
Creates a new managed cursor with underlying object.
inline mdbx::cursor_managed::cursor_managed (
void * your_context=nullptr
)
Parameters:
your_contextAn application context to be associated with the cursor.
Exception:
- mdbx::error on failure to allocate the underlying object.
function cursor_managed [3/4]
Move constructor.
mdbx::cursor_managed::cursor_managed (
cursor_managed &&
) = default
function cursor_managed [4/4]
Copy construction is prohibited.
mdbx::cursor_managed::cursor_managed (
const cursor_managed &
) = delete
function operator=
Move assignment operator.
cursor_managed & mdbx::cursor_managed::operator= (
cursor_managed && other
) noexcept
Parameters:
otherThe source managed cursor to be moved from.
Returns:
A reference to this instance.
function operator=
Copy assignment is prohibited.
cursor_managed & mdbx::cursor_managed::operator= (
const cursor_managed &
) = delete
function withdraw_handle
Withdraws (takes over) the underlying C handle; this instance becomes empty and will not close the cursor.
inline MDBX_cursor * mdbx::cursor_managed::withdraw_handle () noexcept
Returns:
The pointer to the underlying MDBX_cursor object.
function ~cursor_managed
Destroys the managed cursor, closing the underlying object.
mdbx::cursor_managed::~cursor_managed ()
The documentation for this class was generated from the following file mdbx.h++