-
Notifications
You must be signed in to change notification settings - Fork 29
/
IPackage.h
58 lines (46 loc) · 1.05 KB
/
IPackage.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
54
55
56
57
58
#pragma once
#include <string>
namespace alt
{
class IPackage
{
public:
struct PathInfo
{
alt::IPackage *pkg = nullptr;
std::string fileName;
std::string prefix;
};
enum class Mode
{
READ,
WRITE
};
enum class SeekOrigin
{
SET = 0,
CUR = 1,
END = 2
};
class File
{
public:
virtual ~File() = default;
};
virtual ~IPackage() = default;
virtual Mode GetMode() const = 0;
virtual bool FileExists(const std::string& path) = 0;
virtual File *OpenFile(const std::string& path) = 0;
virtual void CloseFile(File *file) = 0;
virtual uint64_t GetFileSize(File *file) = 0;
virtual void SeekFile(File *file, uint64_t offset, SeekOrigin origin) = 0;
virtual uint64_t TellFile(File *file) = 0;
virtual uint64_t ReadFile(File *file, void *buffer, uint64_t size) = 0;
virtual uint64_t WriteFile(File *file, void *buffer, uint64_t size) = 0;
protected:
IPackage() = default;
private:
IPackage(const IPackage &that) = delete;
IPackage &operator=(const IPackage &that) = delete;
};
} // namespace alt