23 #ifndef BLINK_STREAM_H 24 #define BLINK_STREAM_H 49 bool (*read)(
void *state,
void *out,
size_t bytesToRead);
50 bool (*write)(
void *state,
const void *in,
size_t bytesToWrite);
51 uint32_t (*tell)(
void *state);
52 bool (*peek)(
void *state,
void *c);
53 bool (*seekCur)(
void *state, int32_t offset);
54 bool (*seekSet)(
void *state, uint32_t offset);
55 bool (*eof)(
void *state);
60 BLINK_STREAM_NULL = 0,
blink_stream_t BLINK_Stream_initBounded(struct blink_stream *self, blink_stream_t stream, uint32_t max)
Init a bounded stream.
blink_stream_t BLINK_Stream_initBuffer(struct blink_stream *self, void *buf, uint32_t max)
Init a read/write buffer stream.
bool BLINK_Stream_read(blink_stream_t self, void *buf, size_t nbyte)
Read from a stream.
Definition: blink_stream.h:48
bool BLINK_Stream_write(blink_stream_t self, const void *buf, size_t nbyte)
Write to a stream.
buffer stream
Definition: blink_stream.h:61
bool BLINK_Stream_peek(blink_stream_t self, void *buf)
Read next byte in stream without removing it.
user stream
Definition: blink_stream.h:62
uint32_t BLINK_Stream_tell(blink_stream_t self)
Get current position.
size_t BLINK_Stream_max(blink_stream_t self)
Return the maximum position of the stream.
bool BLINK_Stream_seekCur(blink_stream_t self, int32_t offset)
Add offset to current position.
Definition: blink_stream.h:65
bool BLINK_Stream_eof(blink_stream_t self)
Check if stream has reached EOF.
blink_stream_t BLINK_Stream_initUser(struct blink_stream *self, void *state, struct blink_stream_user fn)
Init a user defined stream.
bool BLINK_Stream_seekSet(blink_stream_t self, uint32_t offset)
Set position to offset.
blink_stream_type
Definition: blink_stream.h:59
Definition: blink_stream.h:58
blink_stream_t BLINK_Stream_initBufferReadOnly(struct blink_stream *self, const void *buf, uint32_t max)
Init a read only buffer stream.