roo_io
API Documentation for roo_io
Loading...
Searching...
No Matches
multipass_input_stream.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <inttypes.h>
4
5
#include "
roo_io/core/input_stream.h
"
6
7
namespace
roo_io
{
8
9
/// Virtualizes access to files, memory, and other readable sources.
10
///
11
/// Represents an open resource with a seekable read cursor.
12
///
13
/// For iterator-style use, prefer `BufferedMultipassInputStreamIterator` to
14
/// avoid virtual-call overhead per byte.
15
class
MultipassInputStream
:
public
InputStream
{
16
public
:
17
/// Returns stream size in bytes from beginning.
18
///
19
/// Value may differ across calls when underlying source mutates.
20
///
21
/// If pre-call status is neither `kOk` nor `kEndOfStream`, status is
22
/// unchanged and return value is 0.
23
///
24
/// On error, status updates accordingly and return value is 0.
25
virtual
uint64_t
size
() = 0;
26
27
/// Returns current byte offset from beginning of stream.
28
///
29
/// If status is neither `kOk` nor `kEndOfStream`, return value is
30
/// unspecified.
31
virtual
uint64_t
position
()
const
= 0;
32
33
/// Resets stream to starting position.
34
///
35
/// Updates status.
36
///
37
/// If pre-call status is neither `kOk` nor `kEndOfStream`, status is
38
/// unchanged.
39
///
40
/// On success, status becomes `kOk` (clearing EOS if present) and
41
/// `position()` becomes 0.
42
virtual
void
rewind
() {
seek
(0); }
43
44
/// Seeks to byte offset from beginning.
45
///
46
/// Offset may be greater than current `size()`.
47
///
48
/// If pre-call status is neither `kOk` nor `kEndOfStream`, status is
49
/// unchanged.
50
///
51
/// On success, status becomes `kOk` and `position()` equals `offset`.
52
/// On error, status updates accordingly.
53
virtual
void
seek
(
uint64_t
offset
) = 0;
54
};
55
56
}
// namespace roo_io
roo_io::InputStream
Virtualizes access to files, memory, and other readable sources.
Definition
input_stream.h:16
roo_io::MultipassInputStream
Virtualizes access to files, memory, and other readable sources.
Definition
multipass_input_stream.h:15
roo_io::MultipassInputStream::position
virtual uint64_t position() const =0
Returns current byte offset from beginning of stream.
roo_io::MultipassInputStream::size
virtual uint64_t size()=0
Returns stream size in bytes from beginning.
roo_io::MultipassInputStream::seek
virtual void seek(uint64_t offset)=0
Seeks to byte offset from beginning.
roo_io::MultipassInputStream::rewind
virtual void rewind()
Resets stream to starting position.
Definition
multipass_input_stream.h:42
input_stream.h
roo_io
Definition
byte.h:6
roo_io::basic_string_view
roo::basic_string_view< CharT, Traits > basic_string_view
Definition
string_view.h:8
temp_repos
roo_io
src
roo_io
core
multipass_input_stream.h
Generated by
1.9.8