24#include <welder/vocabulary.hpp>
36 How a client-database write handles keyless encrypted sections: Preserve
37 re-emits the file's original bytes verbatim (encrypted content intact,
38 edits to decoded rows NOT applied); Drop writes only the decoded rows as
39 a plain unencrypted table, discarding the rows behind missing keys.)")
51 "An encrypted WDC section: its records are behind a TACT key "
52 "wowlib does not hold, so they are absent from records.")
55 "The section's TACT key lookup hash (names the missing key).")]]
58 [[=welder::doc(
"How many records the encrypted section holds.")]]
59 std::uint32_t recordCount = 0;
62 "The ids of the encrypted records, when the file lists them.")]]
63 std::vector<std::uint32_t> ids;
73 std::string_view
name;
74 std::span<const Column>
schema;
127 virtual void reserve(std::size_t n) = 0;
128 virtual std::size_t
add() = 0;
129 virtual std::size_t
size()
const = 0;
130 virtual std::uint32_t
idOf(std::size_t record)
const = 0;
131 virtual void setInt(std::size_t record, std::size_t column, std::size_t element, std::int64_t value) = 0;
132 virtual void setFloat(std::size_t record, std::size_t column, std::size_t element,
float value) = 0;
133 virtual void setString(std::size_t record, std::size_t column, std::size_t element, std::string_view value) = 0;
136 virtual void cloneWithId(std::size_t src, std::uint32_t newId) = 0;
139 virtual std::size_t
findById(std::uint32_t
id)
const = 0;
151 virtual std::size_t
size()
const = 0;
152 virtual std::uint32_t
idOf(std::size_t record)
const = 0;
153 virtual std::int64_t
getInt(std::size_t record, std::size_t column, std::size_t element)
const = 0;
154 virtual std::uint32_t
getSlot(std::size_t record, std::size_t column, std::size_t element)
const = 0;
155 virtual std::string_view
getString(std::size_t record, std::size_t column, std::size_t element)
const = 0;
160 inline std::size_t
recordStride(std::span<const Column> schema) {
161 std::size_t bytes = 0;
162 for (
const Column& col : schema) bytes += col.inlineBytes();
167 inline std::uint32_t
fieldSlotCount(std::span<const Column> schema) {
168 std::uint32_t slots = 0;
169 for (
const Column& col : schema) slots += col.fieldSlots();
175 std::size_t slots = 0;
176 for (
const Column& col : schema) slots += col.stringSlots();
183 for (
const Column& col : schema) n += col.noninline ? 0 : 1;
189 for (
const Column& col : schema)
190 if (col.isId)
return col.noninline;
195 inline std::uint16_t
idFieldIndex(std::span<const Column> schema) {
196 std::uint16_t idx = 0;
197 for (
const Column& col : schema) {
198 if (col.noninline)
continue;
199 if (col.isId)
return idx;
The decode target: the codecs build the record vector through this, one field at a time.
virtual void cloneWithId(std::size_t src, std::uint32_t newId)=0
Clone record src into a fresh record and set its id column to newId (WDC copy-table materialization).
virtual void setFloat(std::size_t record, std::size_t column, std::size_t element, float value)=0
virtual std::size_t add()=0
virtual std::size_t size() const =0
virtual std::uint32_t idOf(std::size_t record) const =0
virtual void setString(std::size_t record, std::size_t column, std::size_t element, std::string_view value)=0
virtual void setInt(std::size_t record, std::size_t column, std::size_t element, std::int64_t value)=0
virtual void reserve(std::size_t n)=0
virtual std::size_t findById(std::uint32_t id) const =0
The first record whose id equals id, or size() when none (copy source lookup).
virtual ~RecordSink()=default
The encode source: the codecs read the record vector through this.
virtual std::size_t size() const =0
virtual std::int64_t getInt(std::size_t record, std::size_t column, std::size_t element) const =0
virtual std::uint32_t getSlot(std::size_t record, std::size_t column, std::size_t element) const =0
virtual ~RecordSource()=default
virtual std::uint32_t idOf(std::size_t record) const =0
virtual std::string_view getString(std::size_t record, std::size_t column, std::size_t element) const =0
Client version identity, the flavor axis that separates a client's CONTENT version from the engine ge...
std::uint16_t idFieldIndex(std::span< const Column > schema)
The inline field index of an inline id column (0 when non-inline).
bool idIsNoninline(std::span< const Column > schema)
Whether the id column is stored outside the record ($noninline$ id).
std::size_t inlineColumnCount(std::span< const Column > schema)
The number of INLINE columns (everything not $noninline$).
consteval std::size_t recordStride()
The fixed record stride of Record inside a WDBC/WDB2 record block.
consteval std::uint32_t fieldSlotCount()
The expanded on-disk field slot count of Record (the WDBC/WDB2 header fieldCount a fresh write derive...
EncryptedPolicy
How write() treats a table that still holds keyless (undecryptable) encrypted sections.
@ Drop
Write only decoded rows as plaintext; keyless rows are dropped.
@ Preserve
Re-emit the original image verbatim; edits are not applied.
consteval std::size_t stringSlotCount()
The string-block references one record of Record stores — the width of the engine's per-record origin...
Schema reflection over generated client-database record structs: the column list, record stride and f...
StringBlock — the decoded representation of a chunk of zero-terminated strings (MOTX,...
One column of a record schema, derived from a record member by reflection (typed records) or from the...
One WDC section whose records could not be decoded because they are encrypted under a TACT key wowlib...
std::uint64_t keyHash
The section's TACT key lookup hash (names the missing key).
std::uint32_t recordCount
How many records the encrypted section holds.
std::vector< std::uint32_t > ids
The ids of the encrypted records, when the file lists them.
The per-table identity a codec needs beyond the record data: the client version (format selection,...
ClientVersion version
The record's client version.
std::span< const Column > schema
The record schema (schemaOf<Record>()).
std::string_view name
The WoWDBDefs table name.
The preserved decode state a table carries between read() and write() so a WDBC/WDB2 write is byte-pe...
std::vector< std::byte > wdb2Copy
Preserved WDB2 copy table, verbatim.
std::vector< std::uint8_t > wdcKinds
Original per-inline-column compression (WdcCompression).
formats::StringBlock strings
Preserved string block; offsets never move.
void reset()
Reset the per-read state before decoding a fresh image.
std::vector< std::byte > wdb2Header
Preserved WDB2 header identity bytes.
std::vector< std::uint32_t > stringOffsets
The original string-block offset of every string field, row-major in record then schema order — the b...
std::vector< std::byte > wdb2Index
Preserved WDB2 id-index block, verbatim.
std::vector< std::byte > wdcOriginal
Raw image kept when the file has encrypted sections.
std::uint32_t wdcTableHash
Preserved WDC3 header tableHash.
std::uint32_t recordSize
Preserved header recordSize.
std::uint32_t fieldCount
Preserved header fieldCount (not always derivable).
std::uint32_t wdcLocale
Preserved WDC3 header locale.
std::vector< EncryptedSection > encrypted
Encrypted WDC sections skipped on read.
std::uint32_t sourceMagic
The magic read() sniffed; 0 for a fresh table.
std::uint32_t wdcLayoutHash
Preserved WDC3 header layoutHash.
std::vector< std::byte > wdc5Prefix
Preserved WDC5 {version, schema string} header prefix.