roo_io
API Documentation for roo_io
Loading...
Searching...
No Matches
multipass_input_iterator.h
Go to the documentation of this file.
1#include <cstdint>
2
3#include "roo_io/base/byte.h"
5#include "roo_io/status.h"
6
7/// Multipass input iterator contract (extends input iterator contract).
8///
9/// Baseline contract additions:
10/// @code
11/// class MyMultipassInputIterator {
12/// public:
13/// // Iterator is movable.
14/// MyMultipassInputIterator(MyMultipassInputIterator&& other);
15///
16/// // Same read/read(skip)/status semantics as input iterator.
17/// // Successful reads advance position.
18/// byte read();
19/// size_t read(byte* result, size_t count);
20/// void skip(size_t count);
21/// Status status() const;
22///
23/// // Returns stream size in bytes from beginning.
24/// // Updates status.
25/// // Value may change across calls for concurrently mutating sources.
26/// // If pre-call status is neither kOk nor kEndOfStream, status is unchanged
27/// // and return value is 0.
28/// uint64_t size();
29///
30/// // Returns current byte offset from beginning.
31/// // Does not modify status.
32/// // If status is neither kOk nor kEndOfStream, return value is unspecified.
33/// uint64_t position() const;
34///
35/// // Rewinds to beginning.
36/// // Updates status.
37/// // If pre-call status is neither kOk nor kEndOfStream, status is
38/// // unchanged.
39/// // On success, status becomes kOk and position() == 0.
40/// void rewind();
41///
42/// // Seeks to byte offset from beginning (offset may exceed current size()).
43/// // Updates status.
44/// // If pre-call status is neither kOk nor kEndOfStream, status is
45/// // unchanged.
46/// // On success, status becomes kOk and position() == requested offset.
47/// void seek(uint64_t position);
48/// @endcode
49/// };