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// ReSharper disable CppRedundantQualifier
2
3#pragma once
4
5#include <array>
6
7#include "../PackFile.h"
8
9namespace vpkpp {
10
11constexpr std::string_view OO7_EXTENSION = ".007";
12
13class OO7 : public PackFileReadOnly {
14public:
16 [[nodiscard]] static std::unique_ptr<PackFile> open(const std::string& path, const EntryCallback& callback = nullptr);
17
18 static constexpr std::string_view GUID = "7E4766FD0F7340069AA923C9D3DAB37B";
19
20 [[nodiscard]] constexpr std::string_view getGUID() const override {
21 return OO7::GUID;
22 }
23
24 [[nodiscard]] bool hasPackFileChecksum() const override;
25
26 [[nodiscard]] bool verifyPackFileChecksum() const override;
27
28 [[nodiscard]] constexpr bool isCaseSensitive() const override {
29 return true;
30 }
31
32 [[nodiscard]] std::optional<std::vector<std::byte>> readEntry(const std::string& path_) const override;
33
34 [[nodiscard]] Attribute getSupportedEntryAttributes() const override;
35
36 [[nodiscard]] explicit operator std::string() const override;
37
38protected:
40
41 uint32_t majorVersion{};
42 uint32_t minorVersion{};
43 bool hasChecksum = false;
44 std::array<std::byte, 16> checksum{};
45
46private:
48};
49
50} // namespace vpkpp
#define VPKPP_REGISTER_PACKFILE_OPEN(extension, function)
Definition PackFile.h:255
uint32_t minorVersion
Definition OO7.h:42
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:41
static constexpr std::string_view GUID
Definition OO7.h:18
constexpr std::string_view getGUID() const override
Get the GUID corresponding to the pack file type.
Definition OO7.h:20
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:28
bool hasChecksum
Definition OO7.h:43
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:44
PackFileReadOnly(const std::string &fullFilePath_)
Definition PackFile.cpp:728
PackFileReadOnly(const std::string &fullFilePath_)
Definition PackFile.cpp:728
EntryCallbackBase< void > EntryCallback
Definition PackFile.h:38
Attribute
Definition Attribute.h:7
constexpr std::string_view OO7_EXTENSION
Definition OO7.h:11