Banjo API 0.0.1
C99 game development API
Loading...
Searching...
No Matches
stream.h
Go to the documentation of this file.
1
8#ifndef BJ_STREAM_H
9#define BJ_STREAM_H
10
11#include <banjo/api.h>
12#include <banjo/error.h>
13
17struct bj_stream;
18
27
28
39 void
40);
41
50 const void* data,
51 size_t length
52);
53
64 const char* path,
65 struct bj_error** error
66);
67
74 struct bj_stream* stream
75);
76
95 struct bj_stream* stream,
96 void* dest,
97 size_t count
98);
99
107 struct bj_stream* stream
108);
109
122 struct bj_stream* stream,
123 ptrdiff_t position,
124 enum bj_seek_origin from
125);
126
134 struct bj_stream* stream
135);
136
144#define bj_stream_read_t(stream, type, buffer) bj_read_stream(stream, buffer, sizeof(type))
145
152#define bj_stream_skip_t(stream, type) bj_read_stream(stream, 0, sizeof(type))
153
154#endif
General-purpose definitions for Banjo API.
Recoverable error handling.
struct bj_stream bj_stream
Definition api.h:352
#define BANJO_EXPORT
Definition api.h:155
Error structure.
Definition error.h:131
struct bj_stream * bj_open_stream_read(const void *data, size_t length)
Creates a new struct bj_stream for reading from a memory buffer.
size_t bj_seek_stream(struct bj_stream *stream, ptrdiff_t position, enum bj_seek_origin from)
Seeks to a new position in the stream relative to a specified origin.
size_t bj_get_stream_length(struct bj_stream *stream)
Get the size of the stream.
struct bj_stream * bj_allocate_stream(void)
Allocate a new bj_stream object.
struct bj_stream * bj_open_stream_file(const char *path, struct bj_error **error)
Creates a new struct bj_stream for reading from a file.
bj_seek_origin
Position in a bj_stream to use for origin.
Definition stream.h:22
size_t bj_tell_stream(struct bj_stream *stream)
Returns the current position of the cursor in the stream.
void bj_close_stream(struct bj_stream *stream)
Deletes a struct bj_stream object and releases associated memory.
size_t bj_read_stream(struct bj_stream *stream, void *dest, size_t count)
Reads data from the stream into a destination buffer.
@ BJ_SEEK_CURRENT
The current position of the stream.
Definition stream.h:24
@ BJ_SEEK_END
The end of the stream.
Definition stream.h:25
@ BJ_SEEK_BEGIN
The beginning of the stream.
Definition stream.h:23