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#ifndef BJ_NO_TYPEDEF
29#endif
30
31
42 void
43);
44
53 const void* data,
54 size_t length
55);
56
67 const char* path,
68 struct bj_error** error
69);
70
77 struct bj_stream* stream
78);
79
98 struct bj_stream* stream,
99 void* dest,
100 size_t count
101);
102
110 struct bj_stream* stream
111);
112
125 struct bj_stream* stream,
126 ptrdiff_t position,
127 enum bj_seek_origin from
128);
129
137 struct bj_stream* stream
138);
139
147#define bj_stream_read_t(stream, type, buffer) bj_read_stream(stream, buffer, sizeof(type))
148
155#define bj_stream_skip_t(stream, type) bj_read_stream(stream, 0, sizeof(type))
156
157#endif
General-purpose definitions for Banjo API.
bj_audio_play_note_data data
Definition audio_pcm.c:22
Recoverable error handling.
struct bj_stream bj_stream
Definition api.h:291
struct bj_error bj_error
Definition api.h:275
#define BANJO_EXPORT
Definition api.h:106
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