SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
APK.h
Go to the documentation of this file.
1// ReSharper disable CppRedundantQualifier
2
3#pragma once
4
6
7#include "../PackFile.h"
8
9namespace vpkpp {
10
12constexpr std::string_view APK_EXTENSION = ".apk";
13
14class APK : public PackFile {
15public:
17 static std::unique_ptr<PackFile> create(const std::string& path);
18
20 [[nodiscard]] static std::unique_ptr<PackFile> open(const std::string& path, const EntryCallback& callback = nullptr);
21
22 static constexpr std::string_view GUID = "F93DC196E4324EA4B035E6FF2645D8C5";
23
24 [[nodiscard]] constexpr std::string_view getGUID() const override {
25 return APK::GUID;
26 }
27
28 [[nodiscard]] std::optional<std::vector<std::byte>> readEntry(const std::string& path_) const override;
29
30 bool bake(const std::string& outputDir_ /*= ""*/, BakeOptions options /*= {}*/, const EntryCallback& callback /*= nullptr*/) override;
31
32 [[nodiscard]] Attribute getSupportedEntryAttributes() const override;
33
34protected:
36
37 void addEntryInternal(Entry& entry, const std::string& path, std::vector<std::byte>& buffer, EntryOptions options) override;
38
39private:
41};
42
43} // namespace vpkpp
#define VPKPP_REGISTER_PACKFILE_OPEN(extension, function)
Definition PackFile.h:255
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open an APK file.
Definition APK.cpp:25
std::optional< std::vector< std::byte > > readEntry(const std::string &path_) const override
Try to read the entry's data to a bytebuffer.
Definition APK.cpp:72
void addEntryInternal(Entry &entry, const std::string &path, std::vector< std::byte > &buffer, EntryOptions options) override
Definition APK.cpp:91
static std::unique_ptr< PackFile > create(const std::string &path)
Create an APK file.
Definition APK.cpp:12
static constexpr std::string_view GUID
Definition APK.h:22
constexpr std::string_view getGUID() const override
Get the GUID corresponding to the pack file type.
Definition APK.h:24
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 APK.cpp:98
Attribute getSupportedEntryAttributes() const override
Returns a list of supported entry attributes Mostly for GUI programs that show entries and their meta...
Definition APK.cpp:163
PackFile(const PackFile &other)=delete
This class represents the metadata that a file has inside a PackFile.
Definition Entry.h:14
EntryCallbackBase< void > EntryCallback
Definition PackFile.h:38
PackFile(const PackFile &other)=delete
consteval uint32_t makeFourCC(const char fourCC[4])
Creates a FourCC identifier from a string of 4 characters.
Definition Binary.h:20
constexpr auto APK_SIGNATURE
Definition APK.h:11
Attribute
Definition Attribute.h:7
constexpr std::string_view APK_EXTENSION
Definition APK.h:12