wowlib
0.0.0
Read & write World of Warcraft client files — a C++26 core
Toggle main menu visibility
Loading...
Searching...
No Matches
wdbc.hpp
Go to the documentation of this file.
1
#pragma once
2
12
13
#include <cstddef>
14
#include <cstdint>
15
#include <span>
16
#include <type_traits>
17
18
#include <
wowlib/core/buffer.hpp
>
19
#include <
wowlib/core/error.hpp
>
20
#include <
wowlib/db/codec.hpp
>
21
#include <
wowlib/formats/common/fourcc.hpp
>
22
23
namespace
wowlib::db
{
25
inline
constexpr
std::uint32_t
WdbcMagic
=
formats::fourcc
(
"WDBC"
,
formats::FourCCEndian::Forward
);
26
28
struct
WdbcHeader
{
29
std::uint32_t
magic
=
WdbcMagic
;
30
std::uint32_t
recordCount
= 0;
31
std::uint32_t
fieldCount
= 0;
32
std::uint32_t
recordSize
= 0;
33
std::uint32_t
stringBlockSize
= 0;
34
};
35
36
static_assert
(
sizeof
(
WdbcHeader
) == 20 && std::is_trivially_copyable_v<WdbcHeader>);
37
46
Result<void>
readWdbc
(
const
TableInfo
& info, std::span<const std::byte> data,
RecordSink
& sink,
TableState
& state);
47
54
Result<FileBuffer>
writeWdbc
(
const
TableInfo
& info,
const
RecordSource
& source,
const
TableState
& state);
55
}
buffer.hpp
The owning byte buffer file contents are read into.
wowlib::db::RecordSink
The decode target: the codecs build the record vector through this, one field at a time.
Definition
codec.hpp:110
wowlib::db::RecordSource
The encode source: the codecs read the record vector through this.
Definition
codec.hpp:135
codec.hpp
The type-erased boundary between the templated Table<Record> facade (table.hpp) and the per-format co...
error.hpp
The error-handling vocabulary: ErrorCode, Error and the Result<T> alias every fallible wowlib operati...
fourcc.hpp
FourCC chunk identifiers: compile-time conversion of the four-letter codes to the host integers chunk...
wowlib::db
Definition
annotations.hpp:31
wowlib::db::WdbcMagic
constexpr std::uint32_t WdbcMagic
The WDBC magic as memcpy'd off the file front (the bytes "WDBC").
Definition
wdbc.hpp:25
wowlib::db::writeWdbc
Result< FileBuffer > writeWdbc(const TableInfo &info, const RecordSource &source, const TableState &state)
Encode a WDBC image; the string block preserves decoded offsets and appends new/changed strings (byte...
Definition
wdbc.cpp:58
wowlib::db::readWdbc
Result< void > readWdbc(const TableInfo &info, std::span< const std::byte > data, RecordSink &sink, TableState &state)
Decode a WDBC image: 20-byte header, fixed-stride records, string block.
Definition
wdbc.cpp:17
wowlib::formats::fourcc
constexpr std::uint32_t fourcc(const char(&cc)[5], FourCCEndian endian=FourCCEndian::Reversed)
The host integer a scanned chunk id compares equal to for code cc.
Definition
fourcc.hpp:33
wowlib::formats::FourCCEndian::Forward
@ Forward
The characters are stored as written: 'AFID' appears in the file as the bytes "AFID".
Definition
fourcc.hpp:22
wowlib::Result
std::expected< T, Error > Result
Every fallible wowlib operation returns Result<T>; bindings translate the error branch into a target-...
Definition
error.hpp:100
wowlib::db::TableInfo
The per-table identity a codec needs beyond the record data: the client version (format selection,...
Definition
codec.hpp:58
wowlib::db::TableState
The preserved decode state a table carries between read() and write() so a WDBC/WDB2 write is byte-pe...
Definition
codec.hpp:68
wowlib::db::WdbcHeader
The 20-byte WDBC header (wowdev.wiki/DBC).
Definition
wdbc.hpp:28
wowlib::db::WdbcHeader::fieldCount
std::uint32_t fieldCount
Expanded on-disk field slots per record.
Definition
wdbc.hpp:31
wowlib::db::WdbcHeader::recordSize
std::uint32_t recordSize
Record stride in bytes.
Definition
wdbc.hpp:32
wowlib::db::WdbcHeader::stringBlockSize
std::uint32_t stringBlockSize
String block bytes after the records.
Definition
wdbc.hpp:33
wowlib::db::WdbcHeader::magic
std::uint32_t magic
"WDBC".
Definition
wdbc.hpp:29
wowlib::db::WdbcHeader::recordCount
std::uint32_t recordCount
Records in the record block.
Definition
wdbc.hpp:30
src
wowlib
db
wdbc.hpp
Generated by
1.17.0