SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Toggle main menu visibility
Loading...
Searching...
No Matches
RIFF.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <filesystem>
4
#include <span>
5
#include <utility>
6
#include <vector>
7
8
#include <
sourcepp/parser/Binary.h
>
9
10
namespace
sndpp
{
11
12
constexpr
auto
RIFF_SIGNATURE
=
sourcepp::parser::binary::makeFourCC
(
"RIFF"
);
13
constexpr
auto
RIFX_SIGNATURE
=
sourcepp::parser::binary::makeFourCC
(
"RIFX"
);
14
constexpr
auto
FFIR_SIGNATURE
=
sourcepp::parser::binary::makeFourCC
(
"FFIR"
);
15
16
class
RIFF
{
17
public
:
18
explicit
RIFF
(uint32_t
type
, uint32_t
signature
=
RIFF_SIGNATURE
);
19
20
explicit
RIFF
(std::vector<std::byte>&& riffData, uint32_t type_);
21
22
explicit
RIFF
(std::span<const std::byte> riffData, uint32_t type_);
23
24
explicit
RIFF
(
const
std::filesystem::path& riffPath, uint32_t type_);
25
26
[[nodiscard]]
explicit
operator
bool()
const
;
27
28
[[nodiscard]] uint32_t
getSignature
()
const
;
29
30
[[nodiscard]]
bool
isBigEndian
()
const
;
31
32
[[nodiscard]]
const
std::vector<std::pair<uint32_t, std::span<std::byte>>>&
getChunks
()
const
;
33
34
[[nodiscard]]
bool
hasChunk
(uint32_t chunkType)
const
;
35
36
[[nodiscard]] std::vector<std::byte>
getFirstChunk
(uint32_t chunkType)
const
;
37
38
[[nodiscard]]
bool
hasNthChunk
(uint32_t chunkType, uint32_t n)
const
;
39
40
[[nodiscard]] std::vector<std::byte>
getNthChunk
(uint32_t chunkType, uint32_t n)
const
;
41
42
protected
:
43
uint32_t
signature
;
44
uint32_t
type
;
45
std::vector<std::pair<uint32_t, std::span<std::byte>>>
chunks
;
46
47
std::vector<std::byte>
data
;
48
};
49
50
}
// namespace sndpp
Binary.h
sndpp::RIFF::getFirstChunk
std::vector< std::byte > getFirstChunk(uint32_t chunkType) const
Definition
RIFF.cpp:75
sndpp::RIFF::data
std::vector< std::byte > data
Definition
RIFF.h:47
sndpp::RIFF::getChunks
const std::vector< std::pair< uint32_t, std::span< std::byte > > > & getChunks() const
Definition
RIFF.cpp:65
sndpp::RIFF::getNthChunk
std::vector< std::byte > getNthChunk(uint32_t chunkType, uint32_t n) const
Definition
RIFF.cpp:91
sndpp::RIFF::signature
uint32_t signature
Definition
RIFF.h:43
sndpp::RIFF::type
uint32_t type
Definition
RIFF.h:44
sndpp::RIFF::hasChunk
bool hasChunk(uint32_t chunkType) const
Definition
RIFF.cpp:69
sndpp::RIFF::getSignature
uint32_t getSignature() const
Definition
RIFF.cpp:57
sndpp::RIFF::RIFF
RIFF(uint32_t type, uint32_t signature=RIFF_SIGNATURE)
Definition
RIFF.cpp:11
sndpp::RIFF::chunks
std::vector< std::pair< uint32_t, std::span< std::byte > > > chunks
Definition
RIFF.h:45
sndpp::RIFF::isBigEndian
bool isBigEndian() const
Definition
RIFF.cpp:61
sndpp::RIFF::hasNthChunk
bool hasNthChunk(uint32_t chunkType, uint32_t n) const
Definition
RIFF.cpp:84
sndpp
Definition
RIFF.h:10
sndpp::FFIR_SIGNATURE
constexpr auto FFIR_SIGNATURE
Definition
RIFF.h:14
sndpp::RIFX_SIGNATURE
constexpr auto RIFX_SIGNATURE
Definition
RIFF.h:13
sndpp::RIFF_SIGNATURE
constexpr auto RIFF_SIGNATURE
Definition
RIFF.h:12
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
include
sndpp
RIFF.h
Generated on
for SourcePP by
1.17.0