Add peek buffer to io, hide file/buffer private functions

Implements peek buffer on top of the raw io read (with small storage
optimization). Hides implementation details of the file/buffer.
This commit is contained in:
2024-07-08 22:25:02 +03:00
parent ebb78a4802
commit 785070798c
11 changed files with 524 additions and 128 deletions

View File

@@ -16,6 +16,38 @@
int bh_file_init(bh_file_t *file,
const char *path);
void bh_file_destroy(bh_file_t *file);
#define bh_file_destroy(file) \
bh_io_destroy((bh_io_t *)(file))
void bh_file_destroy_base(bh_file_t *file);
int bh_file_open_base(bh_file_t *file,
int mode);
void bh_file_close_base(bh_file_t *file);
int bh_file_is_open_base(bh_file_t *file);
size_t bh_file_read_base(bh_file_t *file,
char *data,
size_t size);
size_t bh_file_write_base(bh_file_t *file,
const char *data,
size_t size);
void bh_file_flush_base(bh_file_t *file);
int bh_file_seek_base(bh_file_t *file,
bh_off_t pos,
int dir);
bh_off_t bh_file_size_base(bh_file_t *file);
bh_off_t bh_file_tell_base(bh_file_t *file);
bh_off_t bh_file_available_base(bh_file_t *file);
void bh_file_clear_base(bh_file_t *file);
#endif /* BH_INTERNAL_FILE_H */