SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Toggle main menu visibility
Loading...
Searching...
No Matches
SDAT.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
SDAT_SIGNATURE
=
sourcepp::parser::binary::makeFourCC
(
"PKG2"
);
12
constexpr
std::string_view
SDAT_EXTENSION
=
".sdat"
;
13
14
class
SDAT
:
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(
SDAT_EXTENSION
, &
SDAT::open
);
35
};
36
37
}
// namespace vpkpp
Binary.h
PackFile.h
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
vpkpp::SDAT
Definition
SDAT.h:14
vpkpp::SDAT::open
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open an SDAT file.
Definition
SDAT.cpp:23
vpkpp::SDAT::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
SDAT.cpp:67
vpkpp::SDAT::addEntryInternal
void addEntryInternal(Entry &entry, const std::string &path, std::vector< std::byte > &buffer, EntryOptions options) override
Definition
SDAT.cpp:86
vpkpp::SDAT::create
static std::unique_ptr< PackFile > create(const std::string &path)
Create an SDAT file.
Definition
SDAT.cpp:12
vpkpp::SDAT::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
SDAT.cpp:93
vpkpp::SDAT::PackFile
PackFile(const PackFile &other)=delete
vpkpp::SDAT::getSupportedEntryAttributes
Attribute getSupportedEntryAttributes() const override
Returns a list of supported entry attributes Mostly for GUI programs that show entries and their meta...
Definition
SDAT.cpp:162
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::Attribute
Attribute
Definition
Attribute.h:7
vpkpp::SDAT_SIGNATURE
constexpr auto SDAT_SIGNATURE
Definition
SDAT.h:11
vpkpp::SDAT_EXTENSION
constexpr std::string_view SDAT_EXTENSION
Definition
SDAT.h:12
vpkpp::BakeOptions
Definition
Options.h:20
vpkpp::EntryOptions
Definition
Options.h:34
include
vpkpp
format
SDAT.h
Generated on
for SourcePP by
1.18.0