Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
pack.hpp
Go to the documentation of this file.
1
21
22
#pragma once
23
24
#include <cstdint>
25
#include <filesystem>
26
#include <optional>
27
#include <string>
28
#include <unordered_map>
29
#include <vector>
30
31
namespace
assets {
32
33
class
PackArchive {
34
public
:
35
explicit
PackArchive(
const
std::filesystem::path& path);
36
37
[[nodiscard]]
38
auto
read(std::string_view rel_path)
const
-> std::optional<std::vector<uint8_t>>;
39
40
[[nodiscard]]
41
auto
path()
const
->
const
std::filesystem::path& {
42
return
m_path;
43
}
44
45
[[nodiscard]]
46
auto
entryCount()
const
-> std::size_t {
47
return
m_entries.size();
48
}
49
50
private
:
51
static
constexpr
uint8_t k_flag_compressed = 1;
52
53
struct
Entry {
54
std::string rel_path;
55
uint64_t offset;
56
uint64_t orig_size;
57
uint64_t stored_size;
58
uint8_t flags;
59
};
60
61
static
auto
fnv1a64(std::string_view s) -> uint64_t;
62
63
std::filesystem::path m_path;
64
std::unordered_map<uint64_t, Entry> m_entries;
65
};
66
67
}
engine
src
toast
assets
pack.hpp
Generated by
1.17.0