summaryrefslogtreecommitdiffhomepage
path: root/ArchiveEx/Archive.h
blob: cc06dc4aa25f70afd51e1f75d7b2110bd4b51add (plain)
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
#pragma once

#include <cstddef>
#include <cstdint>
#include <vector>


namespace Archive
{


static constexpr std::uint32_t VERSION {0x0010};
static constexpr std::size_t BLOCK_SIZE {1024};
static constexpr std::size_t NAMELEN {64};


struct Header
{
	std::uint32_t version;
	std::uint32_t total_entries;
	struct {
		std::uint32_t total_blocks;
		std::uint32_t compressed_size;
		std::uint32_t offset;
	} directory;
};


struct Entry
{
	char name[NAMELEN];
	std::uint32_t original_size;
	std::uint32_t compressed_size;
	std::uint32_t offset;
};


class Archive
{
public:
	explicit Archive(const char* path);
	void PrintNamesOfEntries() const;
	std::size_t DirectoryBlocks() const;
private:
	const char* path;
	Header header;
	std::vector<Entry> entries;
};


}  // namespace Archive