-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile.h
53 lines (41 loc) · 1010 Bytes
/
file.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Bermuda Syndrome engine rewrite
* Copyright (C) 2007-2011 Gregory Montoir
*/
#ifndef FILE_H__
#define FILE_H__
#include "intern.h"
struct File_impl;
File_impl *FileImpl_create();
File_impl *FileImpl_create(uint32_t offset, uint32_t size);
struct File {
File();
File(File_impl *impl);
~File();
bool open(const char *path, const char *mode = "rb");
void close();
bool ioErr() const;
uint32_t size();
uint32_t tell();
void seek(int offs, int origin = SEEK_SET);
uint32_t read(void *ptr, uint32_t len);
uint8_t readByte();
uint16_t readUint16LE();
uint32_t readUint32LE();
void write(void *ptr, uint32_t size);
void writeByte(uint8_t b);
void writeUint16LE(uint16_t n);
void writeUint32LE(uint32_t n);
char *_path;
File_impl *_impl;
};
struct MemoryMappedFile_impl;
struct MemoryMappedFile {
MemoryMappedFile();
~MemoryMappedFile();
bool open(const char *path, const char *mode = "rb");
void close();
void *getPtr();
MemoryMappedFile_impl *_impl;
};
#endif // FILE_H__