SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
PakLump.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4
5#include <vpkpp/format/ZIP.h>
6
7namespace bsppp {
8
9constexpr std::string_view BSP_EXTENSION = ".bsp";
10
13class PakLump : public vpkpp::ZIP {
14public:
15 ~PakLump() override;
16
18 [[nodiscard]] static std::unique_ptr<PackFile> open(const std::string& path, const EntryCallback& callback = nullptr);
19
20 static constexpr inline std::string_view GUID = "DEB4270A89F443EF8A8F7FE26F6F308E";
21
22 [[nodiscard]] constexpr std::string_view getGUID() const override {
23 return PakLump::GUID;
24 }
25
26 [[nodiscard]] constexpr bool isCaseSensitive() const noexcept override {
27 return false;
28 }
29
30 bool bake(const std::string& outputDir_ /*= ""*/, vpkpp::BakeOptions options /*= {}*/, const EntryCallback& callback /*= nullptr*/) override;
31
32 [[nodiscard]] explicit operator std::string() const override;
33
34protected:
35 explicit PakLump(const std::string& fullFilePath_);
36
37 const std::string tempPakLumpPath;
38 uint32_t version{};
39 uint32_t mapRevision{};
40
41private:
43};
44
45} // namespace bsppp
#define VPKPP_REGISTER_PACKFILE_OPEN(extension, function)
Definition: PackFile.h:242
Utility class for vpkpp integration - you need to include this header in a C++ file somewhere in your...
Definition: PakLump.h:13
uint32_t version
Definition: PakLump.h:38
uint32_t mapRevision
Definition: PakLump.h:39
bool bake(const std::string &outputDir_, vpkpp::BakeOptions options, const EntryCallback &callback) override
If output folder is an empty string, it will overwrite the original.
Definition: PakLump.cpp:88
constexpr bool isCaseSensitive() const noexcept override
Does the format support case-sensitive file names?
Definition: PakLump.h:26
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open a BSP file.
Definition: PakLump.cpp:26
const std::string tempPakLumpPath
Definition: PakLump.h:37
~PakLump() override
Definition: PakLump.cpp:20
constexpr std::string_view getGUID() const override
Get the GUID corresponding to the pack file type.
Definition: PakLump.h:22
static constexpr std::string_view GUID
Definition: PakLump.h:20
EntryCallbackBase< void > EntryCallback
Definition: PackFile.h:30
Definition: ZIP.h:15
Definition: BSP.h:18
constexpr std::string_view BSP_EXTENSION
Definition: PakLump.h:9