|
roo_io
API Documentation for roo_io
|
#include <buffered_multipass_input_stream_iterator.h>
Public Member Functions | |
| BufferedMultipassInputStreamIterator () | |
Creates a detached iterator with kClosed status. | |
| BufferedMultipassInputStreamIterator (roo_io::MultipassInputStream &input) | |
Creates iterator over input. | |
| BufferedMultipassInputStreamIterator (BufferedMultipassInputStreamIterator &&other) | |
| Move-constructs iterator state. | |
| BufferedMultipassInputStreamIterator & | operator= (BufferedMultipassInputStreamIterator &&other) |
| Move-assigns iterator state. | |
| byte | read () |
| Reads one byte. | |
| size_t | read (byte *buf, size_t count) |
Reads up to count bytes into buf. | |
| void | skip (size_t count) |
Skips up to count bytes. | |
| Status | status () const |
| Returns current iterator status. | |
| uint64_t | size () const |
Returns stream size when iterator status is kOk or kEndOfStream. | |
| uint64_t | position () const |
Returns current read position when status is kOk or kEndOfStream. | |
| void | rewind () |
| Rewinds to stream start. | |
| void | seek (uint64_t position) |
Seeks to absolute position. | |
| bool | ok () const |
Returns whether status() == kOk. | |
| bool | eos () const |
Returns whether status() == kEndOfStream. | |
| void | reset (roo_io::MultipassInputStream &input) |
Rebinds iterator to input and clears buffered state. | |
| void | reset () |
| Detaches from stream and releases internal buffer. | |
Definition at line 13 of file buffered_multipass_input_stream_iterator.h.
|
inline |
Creates a detached iterator with kClosed status.
Definition at line 16 of file buffered_multipass_input_stream_iterator.h.
|
inline |
Creates iterator over input.
Initializes status() from input.status(). Allocates internal buffer when initial status is kOk or kEndOfStream.
Definition at line 27 of file buffered_multipass_input_stream_iterator.h.
References roo_io::kEndOfStream, roo_io::kMultipassInputStreamIteratorBufferSize, and roo_io::kOk.
|
inline |
Move-constructs iterator state.
Source iterator becomes detached with kClosed status.
Definition at line 38 of file buffered_multipass_input_stream_iterator.h.
References roo_io::kClosed.
|
inline |
Returns whether status() == kEndOfStream.
true iff current status is kEndOfStream. Definition at line 241 of file buffered_multipass_input_stream_iterator.h.
References roo_io::kEndOfStream, and status().
Referenced by roo_io::MultipassInputStreamReader::isOpen().
|
inline |
Returns whether status() == kOk.
true iff current status is kOk. Definition at line 236 of file buffered_multipass_input_stream_iterator.h.
References roo_io::kOk, and status().
Referenced by roo_io::FileIterable::FileIterator::FileIterator(), roo_io::MultipassInputStreamReader::isOpen(), and roo_io::MultipassInputStreamReader::ok().
|
inline |
Move-assigns iterator state.
Source iterator becomes detached with kClosed status.
Definition at line 54 of file buffered_multipass_input_stream_iterator.h.
References roo_io::kClosed.
|
inline |
Returns current read position when status is kOk or kEndOfStream.
Otherwise returns zero.
Definition at line 180 of file buffered_multipass_input_stream_iterator.h.
References roo_io::kEndOfStream, roo_io::kOk, and roo_io::MultipassInputStream::position().
Referenced by roo_io::FileIterable::FileIterator::position(), roo_io::MultipassInputStreamReader::position(), and seek().
|
inline |
Reads one byte.
If buffered data is available, returns it without changing status(). If status() != kOk, returns zero byte and leaves status unchanged. Otherwise reads from underlying stream; when that read returns zero, updates status() from input.status().
Definition at line 78 of file buffered_multipass_input_stream_iterator.h.
References roo_io::kMultipassInputStreamIteratorBufferSize, roo_io::kOk, roo_io::InputStream::read(), and roo_io::InputStream::status().
Referenced by roo_io::MultipassInputStreamReader::read(), roo_io::FileIterable::FileIterator::read(), and roo_io::FileIterable::FileIterator::read().
Reads up to count bytes into buf.
Uses buffered bytes first. If status() != kOk, returns zero and leaves status unchanged. When delegated stream read returns zero, updates status() from input.status().
Definition at line 103 of file buffered_multipass_input_stream_iterator.h.
References roo_io::count, roo_io::kMultipassInputStreamIteratorBufferSize, roo_io::kOk, roo_io::InputStream::read(), and roo_io::InputStream::status().
|
inline |
Detaches from stream and releases internal buffer.
Sets status to kClosed.
Definition at line 261 of file buffered_multipass_input_stream_iterator.h.
References roo_io::kClosed.
|
inline |
Rebinds iterator to input and clears buffered state.
Updates status() to input.status(). Allocates buffer lazily when needed and status is kOk/kEndOfStream.
Definition at line 247 of file buffered_multipass_input_stream_iterator.h.
References roo_io::kEndOfStream, roo_io::kMultipassInputStreamIteratorBufferSize, and roo_io::kOk.
Referenced by roo_io::MultipassInputStreamReader::close(), and roo_io::MultipassInputStreamReader::reset().
|
inline |
Rewinds to stream start.
If status is neither kOk nor kEndOfStream, no-op. If current position still lies within buffered window, only adjusts buffer offset and leaves status unchanged. Otherwise delegates rewind to underlying stream, clears buffer, and updates status() from input.status().
Definition at line 193 of file buffered_multipass_input_stream_iterator.h.
References roo_io::kEndOfStream, roo_io::kOk, roo_io::MultipassInputStream::position(), roo_io::MultipassInputStream::rewind(), and roo_io::InputStream::status().
Referenced by roo_io::MultipassInputStreamReader::rewind(), and roo_io::FileIterable::FileIterator::rewind().
Seeks to absolute position.
If status is neither kOk nor kEndOfStream, no-op. If target lies within buffered window, adjusts offset only. Otherwise delegates seek to underlying stream, clears buffer, and synchronizes from input.status().
As implemented, accepted seek requests set iterator status to kOk at the end of the call.
Definition at line 217 of file buffered_multipass_input_stream_iterator.h.
References roo_io::kEndOfStream, roo_io::kOk, position(), roo_io::MultipassInputStream::position(), roo_io::MultipassInputStream::seek(), and roo_io::InputStream::status().
Referenced by roo_io::MultipassInputStreamReader::seek(), and roo_io::FileIterable::FileIterator::seek().
|
inline |
Returns stream size when iterator status is kOk or kEndOfStream.
Otherwise returns zero.
Definition at line 171 of file buffered_multipass_input_stream_iterator.h.
References roo_io::kEndOfStream, roo_io::kOk, and roo_io::MultipassInputStream::size().
Referenced by roo_io::FileIterable::FileIterator::size(), and roo_io::MultipassInputStreamReader::size().
Skips up to count bytes.
If skip is satisfied from buffered bytes, status() is unchanged. Otherwise clears local buffer state and, when status() == kOk, delegates remaining skip to underlying stream and updates status() from input.status().
Definition at line 148 of file buffered_multipass_input_stream_iterator.h.
References roo_io::count, roo_io::kOk, roo_io::InputStream::skip(), and roo_io::InputStream::status().
Referenced by roo_io::MultipassInputStreamReader::skip(), and roo_io::FileIterable::FileIterator::skip().
|
inline |
Returns current iterator status.
Definition at line 164 of file buffered_multipass_input_stream_iterator.h.
Referenced by eos(), roo_io::FileIterable::FileIterator::FileIterator(), ok(), roo_io::MultipassInputStreamReader::status(), and roo_io::FileIterable::FileIterator::status().