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
5
#include <
sourcepp/parser/Binary.h
>
6
7
#include "
../PackFile.h
"
8
9
namespace
vpkpp
{
10
11
constexpr
auto
APK_SIGNATURE
=
sourcepp::parser::binary::makeFourCC
(
"W#\0\0"
);
12
constexpr
std::string_view
APK_EXTENSION
=
".apk"
;
13
14
class
APK
:
public
PackFile
{
15
public
:
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
[[nodiscard]] std::optional<std::vector<std::byte>>
readEntry
(
const
std::string& path_)
const override
;
23
24
bool
bake
(
const
std::string& outputDir_
/*= ""*/
,
BakeOptions
options
/*= {}*/
,
const
EntryCallback
& callback
/*= nullptr*/
)
override
;
25
26
[[nodiscard]]
Attribute
getSupportedEntryAttributes
()
const override
;
27
28
protected
:
29
using
PackFile::PackFile
;
30
31
void
addEntryInternal
(
Entry
& entry,
const
std::string& path, std::vector<std::byte>& buffer,
EntryOptions
options)
override
;
32
33
private
:
34
VPKPP_REGISTER_PACKFILE_OPEN
(
APK_EXTENSION
, &
APK::open
);
35
};
36
37
}
// namespace vpkpp
Binary.h
PackFile.h
VPKPP_REGISTER_PACKFILE_OPEN
#define VPKPP_REGISTER_PACKFILE_OPEN(extension, function)
Definition
PackFile.h:245
vpkpp::APK
Definition
APK.h:14
vpkpp::APK::open
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open an APK file.
Definition
APK.cpp:25
vpkpp::APK::readEntry
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
vpkpp::APK::addEntryInternal
void addEntryInternal(Entry &entry, const std::string &path, std::vector< std::byte > &buffer, EntryOptions options) override
Definition
APK.cpp:91
vpkpp::APK::create
static std::unique_ptr< PackFile > create(const std::string &path)
Create an APK file.
Definition
APK.cpp:12
vpkpp::APK::bake
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
vpkpp::APK::getSupportedEntryAttributes
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
vpkpp::APK::PackFile
PackFile(const PackFile &other)=delete
vpkpp::Entry
This class represents the metadata that a file has inside a PackFile.
Definition
Entry.h:14
vpkpp::PackFile::EntryCallback
EntryCallbackBase< void > EntryCallback
Definition
PackFile.h:38
vpkpp::PackFile::PackFile
PackFile(const PackFile &other)=delete
sourcepp::parser::binary::makeFourCC
consteval uint32_t makeFourCC(const char fourCC[4])
Creates a FourCC identifier from a string of 4 characters.
Definition
Binary.h:20
vpkpp
Definition
Attribute.h:5
vpkpp::APK_SIGNATURE
constexpr auto APK_SIGNATURE
Definition
APK.h:11
vpkpp::Attribute
Attribute
Definition
Attribute.h:7
vpkpp::APK_EXTENSION
constexpr std::string_view APK_EXTENSION
Definition
APK.h:12
vpkpp::BakeOptions
Definition
Options.h:19
vpkpp::EntryOptions
Definition
Options.h:33
include
vpkpp
format
APK.h
Generated on
for SourcePP by
1.14.0