Banjo API 1.0.0-rc.2
Low-level C99 game development API
Loading...
Searching...
No Matches
stream.h
Go to the documentation of this file.
1
67#ifndef BJ_STREAM_H
68#define BJ_STREAM_H
69
70#include <banjo/api.h>
71#include <banjo/error.h>
72
76struct bj_stream;
77
86#ifndef BJ_NO_TYPEDEF
88#endif
89
90
101 void
102);
103
112 const void* data,
113 size_t length
114);
115
126 const char* path,
127 struct bj_error** error
128);
129
136 struct bj_stream* stream
137);
138
157 struct bj_stream* stream,
158 void* dest,
159 size_t count
160);
161
169 struct bj_stream* stream
170);
171
184 struct bj_stream* stream,
185 ptrdiff_t position,
186 enum bj_seek_origin from
187);
188
196 struct bj_stream* stream
197);
198
206#define bj_stream_read_t(stream, type, buffer) bj_read_stream(stream, buffer, sizeof(type))
207
214#define bj_stream_skip_t(stream, type) bj_read_stream(stream, 0, sizeof(type))
215
216#endif
General-purpose definitions for Banjo API.
bj_audio_play_note_data data
Definition audio_pcm.c:104
Recoverable error handling.
struct bj_stream bj_stream
Definition api.h:349
struct bj_error bj_error
Definition api.h:333
#define BANJO_EXPORT
Definition api.h:163
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:81
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:83
@ BJ_SEEK_END
The end of the stream.
Definition stream.h:84
@ BJ_SEEK_BEGIN
The beginning of the stream.
Definition stream.h:82