Banjo API 1.1.0-alpha
Low-level C99 game development API
Loading...
Searching...
No Matches
text_wrapper.h
Go to the documentation of this file.
1
53#ifndef BJ_TEXT_WRAPPER_H
54#define BJ_TEXT_WRAPPER_H
55
56#include <banjo/api.h>
57#include <banjo/stream.h>
58#include <banjo/string.h>
59
63struct bj_text_wrapper;
64
74#ifndef BJ_NO_TYPEDEF
76#endif
77
96 struct bj_stream* stream
97);
98
111 struct bj_text_wrapper* wrapper
112);
113
133 struct bj_text_wrapper* wrapper,
134 struct bj_str* chunk,
135 size_t max_bytes
136);
137
161 struct bj_text_wrapper* wrapper,
162 struct bj_str* line,
163 size_t max_bytes
164);
165
180 struct bj_text_wrapper* wrapper,
181 struct bj_str* character
182);
183
204 struct bj_text_wrapper* wrapper,
205 struct bj_str text
206);
207
221 struct bj_text_wrapper* wrapper,
222 struct bj_str text
223);
224
237 struct bj_text_wrapper* wrapper
238);
239
255 const struct bj_text_wrapper* wrapper
256);
257
264 struct bj_text_wrapper* wrapper
265);
266
278 struct bj_text_wrapper* wrapper,
279 enum bj_text_line_ending ending
280);
281
289 const struct bj_text_wrapper* wrapper
290);
291
292#endif
General-purpose definitions for Banjo API.
struct bj_stream bj_stream
Definition api.h:374
#define BANJO_EXPORT
Definition api.h:179
uint32_t bj_bool
Boolean type used throughout the Banjo API.
Definition api.h:264
struct bj_text_wrapper bj_text_wrapper
Definition api.h:378
bj_stream_status
Why the last read or write of a stream fell short.
Definition stream.h:150
A borrowed view of a sequence of bytes.
Definition string.h:57
bj_bool bj_read_text_wrapper_line(struct bj_text_wrapper *wrapper, struct bj_str *line, size_t max_bytes)
Reads one line, without its terminator.
void bj_clear_text_wrapper_status(struct bj_text_wrapper *wrapper)
Sets the wrapper's status back to BJ_STREAM_STATUS_OK.
struct bj_text_wrapper * bj_create_text_wrapper(struct bj_stream *stream)
Create a text wrapper over a stream.
enum bj_stream_status bj_text_wrapper_status(const struct bj_text_wrapper *wrapper)
Why the last read or write of the wrapper fell short.
void bj_set_text_wrapper_line_ending(struct bj_text_wrapper *wrapper, enum bj_text_line_ending ending)
Sets the line ending the wrapper's line writes append.
bj_bool bj_flush_text_wrapper(struct bj_text_wrapper *wrapper)
Pushes the wrapper's text into the stream, then relays the stream's own flush.
bj_bool bj_read_text_wrapper(struct bj_text_wrapper *wrapper, struct bj_str *chunk, size_t max_bytes)
Reads a chunk of text of up to max_bytes bytes.
bj_bool bj_write_text_wrapper(struct bj_text_wrapper *wrapper, struct bj_str text)
Writes text, sanitizing malformed bytes.
bj_text_line_ending
The line ending a wrapper's line writes append.
enum bj_text_line_ending bj_text_wrapper_line_ending(const struct bj_text_wrapper *wrapper)
The line ending the wrapper's line writes append.
bj_bool bj_write_text_wrapper_line(struct bj_text_wrapper *wrapper, struct bj_str text)
Writes text, then the wrapper's line ending.
void bj_destroy_text_wrapper(struct bj_text_wrapper *wrapper)
Destroy a text wrapper and release its memory.
bj_bool bj_peek_text_wrapper(struct bj_text_wrapper *wrapper, struct bj_str *character)
Previews the next character without consuming it.
@ BJ_TEXT_LINE_ENDING_CRLF
A carriage return, then a line feed.
@ BJ_TEXT_LINE_ENDING_NATIVE
The platform's convention, resolved when set.
@ BJ_TEXT_LINE_ENDING_CR
A carriage return.
@ BJ_TEXT_LINE_ENDING_LF
A line feed.
Header file for struct bj_stream struct and related functions.
UTF-8 string views and owning strings.