Loading...
Searching...
No Matches
stream_i.h
1#pragma once
2#include <stdint.h>
3#include <stdbool.h>
4#include "stream.h"
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#define STREAM_CACHE_SIZE 512u
11
12typedef struct StreamVTable StreamVTable;
13
14typedef void (*StreamFreeFn)(Stream* stream);
15typedef bool (*StreamEOFFn)(Stream* stream);
16typedef void (*StreamCleanFn)(Stream* stream);
17typedef bool (*StreamSeekFn)(Stream* stream, int32_t offset, StreamOffset offset_type);
18typedef size_t (*StreamTellFn)(Stream* stream);
19typedef size_t (*StreamSizeFn)(Stream* stream);
20typedef size_t (*StreamWriteFn)(Stream* stream, const uint8_t* data, size_t size);
21typedef size_t (*StreamReadFn)(Stream* stream, uint8_t* data, size_t count);
22typedef bool (*StreamDeleteAndInsertFn)(
23 Stream* stream,
24 size_t delete_size,
25 StreamWriteCB write_cb,
26 const void* ctx);
27
29 const StreamFreeFn free;
30 const StreamEOFFn eof;
31 const StreamCleanFn clean;
32 const StreamSeekFn seek;
33 const StreamTellFn tell;
34 const StreamSizeFn size;
35 const StreamWriteFn write;
36 const StreamReadFn read;
37 const StreamDeleteAndInsertFn delete_and_insert;
38};
39
40struct Stream {
41 const StreamVTable* vtable;
42};
43
44#ifdef __cplusplus
45}
46#endif
Definition stream_i.h:40
Definition stream_i.h:28