-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathFile.hpp
41 lines (31 loc) · 873 Bytes
/
File.hpp
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
#ifndef ___INANITY_FILE_HPP___
#define ___INANITY_FILE_HPP___
#include "Storage.hpp"
#include "meta/decl.hpp"
BEGIN_INANITY
/// Abstract file class.
/** File represents a continious region of address space. */
class File : public Storage
{
public:
/// Comparer for STL classes.
struct Comparer
{
bool operator()(File* a, File* b) const;
};
public:
virtual void* GetData() const = 0;
virtual size_t GetSize() const = 0;
/// Returns a part of the file.
ptr<File> Slice(size_t offset, size_t size);
ptr<File> SliceFrom(size_t offset);
/// Concatenate files.
ptr<File> Concat(ptr<File> other);
/// Storage's methods.
bigsize_t GetBigSize() const final override;
void Read(bigsize_t offset, size_t size, void* data) override;
ptr<InputStream> GetInputStream(bigsize_t offset, bigsize_t size) override;
META_DECLARE_CLASS(File);
};
END_INANITY
#endif