Implements peek buffer on top of the raw io read (with small storage optimization). Hides implementation details of the file/buffer.
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
#ifndef BH_INTERNAL_FILE_H
|
|
#define BH_INTERNAL_FILE_H
|
|
|
|
#include "bh.h"
|
|
#include "io.h"
|
|
#include <bh/file.h>
|
|
|
|
#if defined(BH_PLATFORM_POSIX)
|
|
#include "file_posix.h"
|
|
#elif defined(BH_PLATFORM_WIN)
|
|
#include "file_win.h"
|
|
#else
|
|
#include "file_null.h"
|
|
#endif
|
|
|
|
int bh_file_init(bh_file_t *file,
|
|
const char *path);
|
|
|
|
#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 */
|