roo_io
API Documentation for roo_io
Loading...
Searching...
No Matches
input_iterator.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstdint>
4
5
#include "
roo_io/base/byte.h
"
6
#include "
roo_io/status.h
"
7
8
/// Input iterator contract for byte streams.
9
///
10
/// Use this in performance-critical paths where byte-level operations are
11
/// inlined.
12
///
13
/// Baseline contract:
14
/// @code
15
/// class MyInputIterator {
16
/// public:
17
/// // Iterator is movable.
18
/// // MyInputIterator(MyInputIterator&& other);
19
///
20
/// // Reads one byte and updates status().
21
/// // Returned byte is meaningful only when status() == kOk.
22
/// // If pre-call status != kOk, status is unchanged and return value is
23
/// // unspecified.
24
/// byte read();
25
///
26
/// // Reads up to count bytes into result and updates status().
27
/// // Returns >0 on success (kOk), 0 at EOS (kEndOfStream), and 0 or more on
28
/// // error depending on bytes read before failure.
29
/// // If pre-call status != kOk, status is unchanged and return value is 0.
30
/// size_t read(byte* result, size_t count);
31
///
32
/// // Skips count bytes and updates status().
33
/// // If pre-call status != kOk, status is unchanged.
34
/// // Reaching exactly the end keeps status() == kOk.
35
/// // Crossing past end sets status() == kEndOfStream.
36
/// // Equivalent behavior: while (count-- > 0) read();
37
/// void skip(size_t count);
38
///
39
/// // Returns current status; does not modify status.
40
/// // Typical values: kOk for success, kEndOfStream after crossing stream
41
/// // end, or an error status after failure.
42
/// Status status() const;
43
/// };
44
/// @endcode
byte.h
status.h
temp_repos
roo_io
src
roo_io
core
input_iterator.h
Generated by
1.9.8