SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
SDAT.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 SDAT_EXTENSION = ".sdat";
13
14class SDAT : 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 [[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
28protected:
30
31 void addEntryInternal(Entry& entry, const std::string& path, std::vector<std::byte>& buffer, EntryOptions options) override;
32
33private:
34 VPKPP_REGISTER_PACKFILE_OPEN(SDAT_EXTENSION, &SDAT::open);
35};
36
37} // namespace vpkpp
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
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open an SDAT file.
Definition SDAT.cpp:23
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
void addEntryInternal(Entry &entry, const std::string &path, std::vector< std::byte > &buffer, EntryOptions options) override
Definition SDAT.cpp:86
static std::unique_ptr< PackFile > create(const std::string &path)
Create an SDAT file.
Definition SDAT.cpp:12
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
PackFile(const PackFile &other)=delete
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
consteval uint32_t makeFourCC(const char fourCC[4])
Creates a FourCC identifier from a string of 4 characters.
Definition Binary.h:20
Attribute
Definition Attribute.h:7
constexpr auto SDAT_SIGNATURE
Definition SDAT.h:11
constexpr std::string_view SDAT_EXTENSION
Definition SDAT.h:12