wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
schema_blob.hpp File Reference

The WDBS schema-blob format: a constexpr-parseable view over the compact binary dbdgen emits (--schema-blob-out), carrying every table's per-range column lists for every targeted era. More...

#include <cstddef>
#include <cstdint>
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <wowlib/core/client_version.hpp>
#include <wowlib/db/schema.hpp>
Include dependency graph for schema_blob.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wowlib::db::blob::TableEntry
 One table's directory entry, decoded. More...
struct  wowlib::db::blob::RangeEntry
 One schema range: a run of columns valid for the eras in the mask. More...
struct  wowlib::db::blob::ColumnEntry
 One column, decoded to the raw blob facts (the catalog turns this into a wowlib::db::Column with an interned name). More...
class  wowlib::db::blob::View
 A structural view over one WDBS blob. More...

Namespaces

namespace  wowlib
namespace  wowlib::db
namespace  wowlib::db::blob

Variables

constexpr std::uint32_t wowlib::db::blob::Magic = 0x53424457u
 The WDBS magic ('WDBS' little-endian).
constexpr std::uint32_t wowlib::db::blob::FormatVersion = 2
 The one format version this reader understands.
constexpr std::size_t wowlib::db::blob::HeaderBytes = 28
 Section entry sizes (bytes), fixed by the format.
constexpr std::size_t wowlib::db::blob::EraBytes = 12
constexpr std::size_t wowlib::db::blob::TableBytes = 16
constexpr std::size_t wowlib::db::blob::RangeBytes = 8
constexpr std::size_t wowlib::db::blob::ColumnBytes = 16

Detailed Description

The WDBS schema-blob format: a constexpr-parseable view over the compact binary dbdgen emits (--schema-blob-out), carrying every table's per-range column lists for every targeted era.

One format, two consumers. The runtime wowlib::db::SchemaCatalog materializes wowlib::db::Column spans from it (schema_catalog.hpp); the consteval typed-record validation reads the very same bytes through #embed and this view, so a user struct is checked against the exact data the runtime engine will use. Everything here is constexpr and allocation-free for that reason — the only non-constexpr member is wowlib::db::blob::View::stringAt, whose reinterpret_cast from the byte pool is a runtime-only operation (consteval callers copy bytes via wowlib::db::blob::View::copyStringAt instead).

Layout (WDBS v2, little-endian, sections in file order, no padding between sections):

section count entry layout
header 1 _u32 magic 'WDBS', _u32 version, _u32 tables, _u32 ranges, _u32 columns, _u32 strpool, u8 eras, u8[3] pad
eras header.eras _u16 major, _u16 minor, _u16 patch, _u16 pad, _u32 build
tables header.tables (sorted by name) _u32 nameOff, _u32 diskNameOff, _u32 firstRange, _u32 rangeCount
ranges header.ranges _u32 firstColumn, _u16 columnCount, _u16 eraMask
columns header.columns _u32 nameOff, u8 type, u8 bits, u8 flags, u8 localeCount, _u16 arrayLen, _u16 pad, _u32 dbdNameOff
strpool header.strpool bytes NUL-terminated, offset 0 = ""

eraMask is a bitmask over the blob's OWN era table (bit i = era i) — never a lo..hi span, because a table absent from a middle era produces a range whose target list has a hole. type mirrors wowlib::db::ColumnType; flags is 1 signed | 2 id | 4 relation | 8 noninline. dbdNameOff (new in v2) is the verbatim WoWDBDefs column spelling ("MapName_lang") — the lookup alias beside the canonical snake name; 0 (the empty pool string) when the column has no DBD identity.

Definition in file schema_blob.hpp.