|
roo_io
API Documentation for roo_io
|
Multipass bounded iterator reading from [begin, end).
More...
#include <memory_input_iterator.h>
Public Types | |
| using | PtrType = PtrTypeT |
Public Member Functions | |
| MultipassGenericMemoryIterator (PtrType begin, PtrType end) | |
Creates multipass iterator over [begin, end). | |
| byte | read () |
| Reads one byte at current position and advances. | |
| size_t | read (byte *result, size_t count) |
Reads up to count bytes from current position and advances. | |
| void | skip (size_t count) |
Advances by up to count bytes. | |
| Status | status () const |
Returns kEndOfStream after EOS is observed, otherwise kOk. | |
| PtrType | ptr () const |
| Returns pointer at current position. | |
| uint64_t | size () const |
| Returns total iterable size. | |
| uint64_t | position () const |
| Returns current position. | |
| void | rewind () |
| Resets position to start and clears EOS. | |
| void | seek (uint64_t position) |
| Sets absolute position and clears EOS. | |
Multipass bounded iterator reading from [begin, end).
Supports size(), position(), rewind(), and seek().
Memory footprint: three pointers and a boolean.
Implements multipass input iterator contract.
Definition at line 143 of file memory_input_iterator.h.
| using roo_io::MultipassGenericMemoryIterator< PtrTypeT >::PtrType = PtrTypeT |
Definition at line 145 of file memory_input_iterator.h.
|
inline |
Creates multipass iterator over [begin, end).
Definition at line 148 of file memory_input_iterator.h.
|
inline |
Returns current position.
Definition at line 203 of file memory_input_iterator.h.
Referenced by roo_io::MultipassGenericMemoryIterator< PtrTypeT >::seek().
|
inline |
Returns pointer at current position.
Definition at line 197 of file memory_input_iterator.h.
|
inline |
Reads one byte at current position and advances.
If position is already at/after size, returns zero byte and sets EOS.
Definition at line 154 of file memory_input_iterator.h.
|
inline |
Reads up to count bytes from current position and advances.
If already at/after size, returns zero and sets EOS. Reading exactly to end does not set EOS.
Definition at line 166 of file memory_input_iterator.h.
References roo_io::count.
|
inline |
Resets position to start and clears EOS.
Definition at line 206 of file memory_input_iterator.h.
|
inline |
Sets absolute position and clears EOS.
Position is not range-checked here; out-of-range is detected by subsequent read/skip operations.
Definition at line 215 of file memory_input_iterator.h.
References roo_io::MultipassGenericMemoryIterator< PtrTypeT >::position().
|
inline |
Returns total iterable size.
Definition at line 200 of file memory_input_iterator.h.
|
inline |
Advances by up to count bytes.
Advancing past end clamps to end and sets EOS. Advancing exactly to end keeps status kOk.
Definition at line 183 of file memory_input_iterator.h.
References roo_io::count.
|
inline |
Returns kEndOfStream after EOS is observed, otherwise kOk.
Definition at line 194 of file memory_input_iterator.h.
References roo_io::kEndOfStream, and roo_io::kOk.