SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
Entry.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <string>
5#include <variant>
6#include <vector>
7
8#include <sourcepp/Math.h>
9
10namespace vpkpp {
11
14class Entry {
15 friend class PackFile;
16
17public:
19 uint32_t flags = 0;
20
23 uint32_t archiveIndex = 0;
24
26 uint64_t length = 0;
27
30 uint64_t compressedLength = 0;
31
33 uint64_t offset = 0;
34
36 std::vector<std::byte> extraData;
37
40 uint32_t crc32 = 0;
41
43 bool unbaked = false;
44
45private:
47 std::variant<std::string, std::vector<std::byte>> unbakedData;
49 bool unbakedUsingByteBuffer = false;
50
51 Entry() = default;
52};
53
54} // namespace vpkpp
This class represents the metadata that a file has inside a PackFile.
Definition: Entry.h:14
bool unbaked
Used to check if entry is saved to disk.
Definition: Entry.h:43
uint32_t flags
Format-specific flags (PCK: File flags, VPK: Internal parser state, ZIP: Compression method / strengt...
Definition: Entry.h:19
uint64_t offset
Offset, format-specific meaning - 0 if unused, or if the offset genuinely is 0.
Definition: Entry.h:33
uint64_t compressedLength
If the format supports compression, this is the compressed length.
Definition: Entry.h:30
uint32_t archiveIndex
Which external archive this entry is in.
Definition: Entry.h:23
uint32_t crc32
CRC32 checksum - 0 if unused.
Definition: Entry.h:40
uint64_t length
Length in bytes (in formats with compression, this is the uncompressed length)
Definition: Entry.h:26
std::vector< std::byte > extraData
Format-specific (PCK: MD5 hash, VPK: Preloaded data)
Definition: Entry.h:36
Definition: Attribute.h:5