SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
OO7.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4
5#include "../PackFile.h"
6
7namespace vpkpp {
8
9constexpr std::string_view OO7_EXTENSION = ".007";
10
11class OO7 : public PackFileReadOnly {
12public:
14 [[nodiscard]] static std::unique_ptr<PackFile> open(const std::string& path, const EntryCallback& callback = nullptr);
15
16 static constexpr inline std::string_view GUID = "7E4766FD0F7340069AA923C9D3DAB37B";
17
18 [[nodiscard]] constexpr std::string_view getGUID() const override {
19 return OO7::GUID;
20 }
21
22 [[nodiscard]] bool hasPackFileChecksum() const override;
23
24 [[nodiscard]] bool verifyPackFileChecksum() const override;
25
26 [[nodiscard]] constexpr bool isCaseSensitive() const override {
27 return true;
28 }
29
30 [[nodiscard]] std::optional<std::vector<std::byte>> readEntry(const std::string& path_) const override;
31
32 [[nodiscard]] Attribute getSupportedEntryAttributes() const override;
33
34 [[nodiscard]] explicit operator std::string() const override;
35
36protected:
38
39 uint32_t majorVersion{};
40 uint32_t minorVersion{};
41 bool hasChecksum = false;
42 std::array<std::byte, 16> checksum{};
43
44private:
46};
47
48} // namespace vpkpp
#define VPKPP_REGISTER_PACKFILE_OPEN(extension, function)
Definition: PackFile.h:242
Definition: OO7.h:11
uint32_t minorVersion
Definition: OO7.h:40
Attribute getSupportedEntryAttributes() const override
Returns a list of supported entry attributes Mostly for GUI programs that show entries and their meta...
Definition: OO7.cpp:159
uint32_t majorVersion
Definition: OO7.h:39
static constexpr std::string_view GUID
Definition: OO7.h:16
constexpr std::string_view getGUID() const override
Get the GUID corresponding to the pack file type.
Definition: OO7.h:18
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open a 007 file.
Definition: OO7.cpp:12
constexpr bool isCaseSensitive() const override
Does the format support case-sensitive file names?
Definition: OO7.h:26
bool hasChecksum
Definition: OO7.h:41
bool verifyPackFileChecksum() const override
Verify the checksum of the entire file, returns true on success Will return true if there is no check...
Definition: OO7.cpp:110
std::optional< std::vector< std::byte > > readEntry(const std::string &path_) const override
Try to read the entry's data to a bytebuffer.
Definition: OO7.cpp:129
bool hasPackFileChecksum() const override
Returns true if the entire file has a checksum.
Definition: OO7.cpp:106
std::array< std::byte, 16 > checksum
Definition: OO7.h:42
PackFileReadOnly(const std::string &fullFilePath_)
Definition: PackFile.cpp:720
EntryCallbackBase< void > EntryCallback
Definition: PackFile.h:30
Definition: Attribute.h:5
Attribute
Definition: Attribute.h:7
constexpr std::string_view OO7_EXTENSION
Definition: OO7.h:9