SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
GRP.h
Go to the documentation of this file.
1// ReSharper disable CppRedundantQualifier
2
3#pragma once
4
5#include "../PackFile.h"
6
7namespace vpkpp {
8
9constexpr int8_t GRP_FILENAME_MAX_SIZE = 12;
10constexpr std::string_view GRP_SIGNATURE = "KenSilverman";
11constexpr std::string_view GRP_EXTENSION = ".grp";
12
13class GRP : public PackFile {
14public:
16 static std::unique_ptr<PackFile> create(const std::string& path);
17
19 [[nodiscard]] static std::unique_ptr<PackFile> open(const std::string& path, const EntryCallback& callback = nullptr);
20
21 [[nodiscard]] std::optional<std::vector<std::byte>> readEntry(const std::string& path_) const override;
22
23 bool bake(const std::string& outputDir_ /*= ""*/, BakeOptions options /*= {}*/, const EntryCallback& callback /*= nullptr*/) override;
24
25 [[nodiscard]] Attribute getSupportedEntryAttributes() const override;
26
27protected:
29
30 void addEntryInternal(Entry& entry, const std::string& path, std::vector<std::byte>& buffer, EntryOptions options) override;
31
32private:
33 VPKPP_REGISTER_PACKFILE_OPEN(GRP_EXTENSION, &GRP::open);
34};
35
36} // namespace vpkpp
This class represents the metadata that a file has inside a PackFile.
Definition Entry.h:14
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open a GRP file.
Definition GRP.cpp:22
static std::unique_ptr< PackFile > create(const std::string &path)
Create a GRP file.
Definition GRP.cpp:12
std::optional< std::vector< std::byte > > readEntry(const std::string &path_) const override
Try to read the entry's data to a bytebuffer.
Definition GRP.cpp:63
PackFile(const PackFile &other)=delete
bool bake(const std::string &outputDir_, BakeOptions options, const EntryCallback &callback) override
If output folder is an empty string, it will overwrite the original.
Definition GRP.cpp:89
Attribute getSupportedEntryAttributes() const override
Returns a list of supported entry attributes Mostly for GUI programs that show entries and their meta...
Definition GRP.cpp:144
void addEntryInternal(Entry &entry, const std::string &path, std::vector< std::byte > &buffer, EntryOptions options) override
Definition GRP.cpp:82
EntryCallbackBase< void > EntryCallback
Definition PackFile.h:38
PackFile(const PackFile &other)=delete
constexpr std::string_view GRP_SIGNATURE
Definition GRP.h:10
constexpr std::string_view GRP_EXTENSION
Definition GRP.h:11
Attribute
Definition Attribute.h:7
constexpr int8_t GRP_FILENAME_MAX_SIZE
Definition GRP.h:9