class CordRepBtreeNavigator

Defined at line 46 of file ../../third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h

CordRepBtreeNavigator is a bi-directional navigator allowing callers to

navigate all the (leaf) data edges in a CordRepBtree instance.

A CordRepBtreeNavigator instance is by default empty. Callers initialize a

navigator instance by calling one of `InitFirst()`, `InitLast()` or

`InitOffset()`, which establishes a current position. Callers can then

navigate using the `Next`, `Previous`, `Skip` and `Seek` methods.

The navigator instance does not take or adopt a reference on the provided

`tree` on any of the initialization calls. Callers are responsible for

guaranteeing the lifecycle of the provided tree. A navigator instance can

be reset to the empty state by calling `Reset`.

A navigator only keeps positional state on the 'current data edge', it does

explicitly not keep any 'offset' state. The class does accept and return

offsets in the `Read()`, `Skip()` and 'Seek()` methods as these would

otherwise put a big burden on callers. Callers are expected to maintain

(returned) offset info if they require such granular state.

Public Methods

bool operator bool ()

Returns true if this instance is not empty.

Defined at line 151 of file ../../third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h

CordRepBtree * btree ()

Returns the tree for this instance or nullptr if empty.

Defined at line 153 of file ../../third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h

CordRep * Current ()

Returns the data edge of the current position.

Requires this instance to not be empty.

Defined at line 157 of file ../../third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h

CordRep * InitFirst (CordRepBtree * tree)

Resets this navigator to `tree`, returning the first data edge in the tree.

Defined at line 164 of file ../../third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h

CordRep * InitLast (CordRepBtree * tree)

Resets this navigator to `tree`, returning the last data edge in the tree.

Defined at line 168 of file ../../third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h

Position InitOffset (CordRepBtree * tree, size_t offset)

Resets this navigator to `tree` returning the data edge at position

`offset` and the relative offset of `offset` into that data edge.

Returns `Position.edge = nullptr` if the provided offset is greater

than or equal to the length of the tree, in which case the state of

the navigator instance remains unchanged.

Defined at line 207 of file ../../third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h

CordRep * Next ()

Navigates to the next data edge.

Returns the next data edge or nullptr if there is no next data edge, in

which case the current position remains unchanged.

Defined at line 217 of file ../../third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h

CordRep * Previous ()

Navigates to the previous data edge.

Returns the previous data edge or nullptr if there is no previous data

edge, in which case the current position remains unchanged.

Defined at line 222 of file ../../third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h

Position Seek (size_t offset)

Navigates to the data edge at position `offset`. Returns the navigated to

data edge in `Position.edge` and the relative offset of `offset` into that

data edge in `Position.offset`. Returns `Position.edge = nullptr` if the

provide offset is greater than or equal to the tree's length.

Defined at line 190 of file ../../third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h

ReadResult Read (size_t edge_offset, size_t n)

Reads `n` bytes of data starting at offset `edge_offset` of the current

data edge, and returns the result in `ReadResult.tree`. `ReadResult.n`

contains the 'bytes used` from the last / current data edge in the tree.

This allows users that mix regular navigation (using string views) and

'read into cord' navigation to keep track of the current state, and which

bytes have been consumed from a navigator.

This function returns `ReadResult.tree = nullptr` if the requested length

exceeds the length of the tree starting at the current data edge.

Position Skip (size_t n)

Skips `n` bytes forward from the current data edge, returning the navigated

to data edge in `Position.edge` and `Position.offset` containing the offset

inside that data edge. Note that the state of the navigator is left

unchanged if `n` is smaller than the length of the current data edge.

void Reset ()

Resets this instance to the default / empty state.

Defined at line 162 of file ../../third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h

Records