|
wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
|
Namespaces | |
| namespace | blob |
| namespace | detail |
| namespace | wdc |
Classes | |
| struct | Column |
| One column of a record schema, derived from a record member by reflection (typed records) or from the schema catalog (the generic table). More... | |
| struct | ColumnAccess |
| Everything the erased core needs to touch one column of a record: where it lives, what it is, and how its array elements stride. More... | |
| class | DynTable |
| The generic client-database table: schema resolved at runtime from the schema catalog, rows in a column store, format engine and preserved decode state inherited from TableBase (read/write/validate/strings/ encryptedSections all bind once, there). More... | |
| struct | EncryptedSection |
| One WDC section whose records could not be decoded because they are encrypted under a TACT key wowlib does not hold. More... | |
| class | ErasedRecordSink |
| RecordSink over a live std::vector<Record>& — the decode target. More... | |
| class | ErasedRecordSource |
| RecordSource over a const std::vector<Record>& — the encode source. More... | |
| struct | LocString |
| A decoded pre-Cataclysm localized string column: Langs language slots (8 before TBC 2.1.0.6692 added ruRU, 16 after) plus the trailing locale flags field. More... | |
| struct | PodColumnView |
| A scalar column's whole storage, for zero-copy array views: the raw exact-width buffer plus the facts to type it (rows x elements_per_row matrix, row-major). More... | |
| struct | RecordOps |
| The one thing that stays per-record: a table of thunks over the record VECTOR (only they know sizeof(Record)) plus the access table above. More... | |
| class | RecordSink |
| The decode target: the codecs build the record vector through this, one field at a time. More... | |
| class | RecordSource |
| The encode source: the codecs read the record vector through this. More... | |
| class | SchemaCatalog |
| The parsed, materialized form of one WDBS schema blob. More... | |
| class | Table |
| A client database table: the typed records of one DBFilesClient file. More... | |
| class | TableBase |
| The welded supertype of every generated table class: the whole table surface — decode, encode, validation, the preserved-state getters — bound ONCE and inherited, in every language, by all ~4200 generated (table x era) classes. More... | |
| class | TableCore |
| The erased engine of one table: identity + records access + preserved decode state, with every operation's body compiled once. More... | |
| struct | TableInfo |
| The per-table identity a codec needs beyond the record data: the client version (format selection, diagnostics), the WoWDBDefs table name (diagnostics), and the runtime schema. More... | |
| struct | TableSchema |
| One resolved (table, client version) schema: what SchemaCatalog::lookup hands the engine. More... | |
| struct | TableState |
| The preserved decode state a table carries between read() and write() so a WDBC/WDB2 write is byte-perfect and a WDC write reproduces the original compression. More... | |
| class | TypedTable |
| A typed, consteval-validated face over one DynTable: the table itself stays fully generic (every column decodes, byte-perfect round-trip holds); this projects rows into Record values, copies edits back, and hands out zero-copy typed column spans. More... | |
| struct | Wdb2Header |
| The 48-byte WDB2 header (wowdev.wiki/DB2). More... | |
| struct | WdbcHeader |
| The 20-byte WDBC header (wowdev.wiki/DBC). More... | |
Concepts | |
| concept | TableRecord |
| A type the table engine can carry as its record: a flat generated (or hand-written test) struct naming its client version and table. | |
Typedefs | |
| using | LocString8 = LocString<8> |
| The vanilla-era column shape: 8 language slots (pre-2.1.0.6692). | |
| using | LocString16 = LocString<16> |
| The TBC..WotLK column shape: 16 language slots (2.1.0.6692+). | |
Enumerations | |
| enum class | EncryptedPolicy { Preserve , Drop } |
| How write() treats a table that still holds keyless (undecryptable) encrypted sections. More... | |
| enum class | ColumnType : std::uint8_t { Int , Float , String , LocString } |
| The logical value class of a column. More... | |
| enum class | AccessKind |
| The storage kind of one record member, as the erased accessors see it: exact width and signedness for integers (the store must truncate the codec's int64 exactly as the typed member assignment did), float, std::string, or LocString. More... | |
Functions | |
| constexpr std::optional< std::size_t > | localeColumnSlot (Locale locale) |
| The langstringref column slot locale occupies, in the client's fixed column order (0 enUS/enGB, 1 koKR, 2 frFR, 3 deDE, 4 zhCN, 5 zhTW, 6 esES, 7 esMX, 8 ruRU, 10 ptBR, 11 itIT — slots 9 and 12..15 belong to locales wowlib does not model). | |
| template<typename Record> | |
| consteval auto | schemaOf () |
| The column schema of record Record, derived by reflection: one Column per member, declaration order, with the annotation-carried roles applied. | |
| template<typename Record> | |
| consteval std::size_t | recordStride () |
| The fixed record stride of Record inside a WDBC/WDB2 record block. | |
| template<typename Record> | |
| consteval std::uint32_t | fieldSlotCount () |
| The expanded on-disk field slot count of Record (the WDBC/WDB2 header fieldCount a fresh write derives). | |
| template<typename Record> | |
| consteval std::size_t | stringSlotCount () |
| The string-block references one record of Record stores — the width of the engine's per-record original-offset journal. | |
| Result< void > | readWdb2 (const TableInfo &info, std::span< const std::byte > data, RecordSink &sink, TableState &state) |
| Decode a WDB2 image: header, optional id-index block, fixed-stride records, string block, optional trailing copy table (index/copy preserved verbatim). | |
| Result< FileBuffer > | writeWdb2 (const TableInfo &info, const RecordSource &source, const TableState &state) |
| Encode a WDB2 image; header identity and the verbatim index/copy blocks are re-emitted. | |
| 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. | |
| 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-perfect for an unmodified table). | |
Variables | |
| constexpr detail::IdSpec | Id {} |
| Mark the table's primary-key column ($id$ in WoWDBDefs). | |
| constexpr detail::NoninlineSpec | Noninline {} |
| Mark a column stored outside the record image ($noninline$ in WoWDBDefs): ids delivered by the WDC id list, relations delivered by the relationship block. | |
| constexpr detail::RelationSpec | Relation {} |
| Mark a relationship-key column ($relation$ in WoWDBDefs): its value references the id of the table's parent (e.g. | |
| constexpr std::uint32_t | Wdb2Magic = formats::fourcc("WDB2", formats::FourCCEndian::Forward) |
| The WDB2 magic as memcpy'd off the file front (the bytes "WDB2"). | |
| constexpr std::size_t | Wdb2IndexEntryBytes = 6 |
| The per-id index block entry stride when maxId != 0: int32 indices[maxId - minId + 1] followed by int16 string_lengths[maxId - minId + 1] — 6 bytes per id in total. | |
| constexpr std::uint32_t | WdbcMagic = formats::fourcc("WDBC", formats::FourCCEndian::Forward) |
| The WDBC magic as memcpy'd off the file front (the bytes "WDBC"). | |
| using wowlib::db::LocString16 = LocString<16> |
The TBC..WotLK column shape: 16 language slots (2.1.0.6692+).
Definition at line 101 of file locstring.hpp.
| using wowlib::db::LocString8 = LocString<8> |
The vanilla-era column shape: 8 language slots (pre-2.1.0.6692).
Definition at line 98 of file locstring.hpp.
|
strong |
The storage kind of one record member, as the erased accessors see it: exact width and signedness for integers (the store must truncate the codec's int64 exactly as the typed member assignment did), float, std::string, or LocString.
Definition at line 45 of file record_bridge.hpp.
|
strong |
The logical value class of a column.
The logical value class of a table column.
| Enumerator | |
|---|---|
| Int | An integer column; Column::bits / Column::isSigned give the shape. |
| Float | A 32-bit IEEE float column. |
| String | A string-block reference column (u32 offset on disk). |
| LocString | A pre-Cataclysm localized string column (see LocString). |
Definition at line 34 of file schema.hpp.
|
strong |
|
consteval |
The expanded on-disk field slot count of Record (the WDBC/WDB2 header fieldCount a fresh write derives).
| Record | the record type. |
Definition at line 250 of file schema.hpp.
References schemaOf().
|
constexpr |
The langstringref column slot locale occupies, in the client's fixed column order (0 enUS/enGB, 1 koKR, 2 frFR, 3 deDE, 4 zhCN, 5 zhTW, 6 esES, 7 esMX, 8 ruRU, 10 ptBR, 11 itIT — slots 9 and 12..15 belong to locales wowlib does not model).
| locale | the locale. |
Definition at line 28 of file locstring.hpp.
References wowlib::deDE, wowlib::enGB, wowlib::enUS, wowlib::esES, wowlib::esMX, wowlib::frFR, wowlib::itIT, wowlib::koKR, wowlib::ptBR, wowlib::ruRU, wowlib::zhCN, and wowlib::zhTW.
Referenced by wowlib::db::LocString< 8 >::at(), and wowlib::db::LocString< 8 >::set().
| Result< void > wowlib::db::readWdb2 | ( | const TableInfo & | info, |
| std::span< const std::byte > | data, | ||
| RecordSink & | sink, | ||
| TableState & | state ) |
Decode a WDB2 image: header, optional id-index block, fixed-stride records, string block, optional trailing copy table (index/copy preserved verbatim).
| info | the table identity + schema. |
| data | the whole file content. |
| sink | the decode target. |
| state | the preserved-state store (reset and filled here). |
Definition at line 14 of file wdb2.cpp.
References wowlib::db::RecordSink::add(), wowlib::db::RecordSink::clear(), wowlib::db::Wdb2Header::copyTableSize, wowlib::db::detail::decodeInlineRecord(), wowlib::db::TableState::fieldCount, wowlib::db::Wdb2Header::fieldCount, wowlib::db::Wdb2Header::magic, wowlib::makeError(), wowlib::db::Wdb2Header::maxId, wowlib::db::Wdb2Header::minId, wowlib::db::TableInfo::name, wowlib::formats::StringBlock::read(), wowlib::db::Wdb2Header::recordCount, wowlib::db::TableState::recordSize, wowlib::db::Wdb2Header::recordSize, wowlib::db::detail::recordStride(), wowlib::db::RecordSink::reserve(), wowlib::db::TableState::reset(), wowlib::db::TableInfo::schema, wowlib::SchemaMismatch, wowlib::db::TableState::sourceMagic, wowlib::db::Wdb2Header::stringBlockSize, wowlib::db::TableState::stringOffsets, wowlib::db::TableState::strings, wowlib::db::detail::stringSlotCount(), wowlib::TableTruncated, wowlib::db::TableState::wdb2Copy, wowlib::db::TableState::wdb2Header, wowlib::db::TableState::wdb2Index, and Wdb2IndexEntryBytes.
Referenced by wowlib::db::TableCore::read().
| Result< void > wowlib::db::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.
Records are appended to sink; state keeps the string block and the per-field original-offset journal for a byte-perfect write-back.
| info | the table identity + schema. |
| data | the whole file content. |
| sink | the decode target (records appended in file order). |
| state | the preserved-state store (reset and filled here). |
Definition at line 17 of file wdbc.cpp.
References wowlib::db::RecordSink::add(), wowlib::db::RecordSink::clear(), wowlib::db::detail::decodeInlineRecord(), wowlib::db::TableState::fieldCount, wowlib::db::WdbcHeader::fieldCount, wowlib::db::WdbcHeader::magic, wowlib::makeError(), wowlib::db::TableInfo::name, wowlib::formats::StringBlock::read(), wowlib::db::WdbcHeader::recordCount, wowlib::db::TableState::recordSize, wowlib::db::WdbcHeader::recordSize, wowlib::db::detail::recordStride(), wowlib::db::RecordSink::reserve(), wowlib::db::TableState::reset(), wowlib::db::TableInfo::schema, wowlib::SchemaMismatch, wowlib::db::TableState::sourceMagic, wowlib::db::WdbcHeader::stringBlockSize, wowlib::db::TableState::stringOffsets, wowlib::db::TableState::strings, wowlib::db::detail::stringSlotCount(), and wowlib::TableTruncated.
Referenced by wowlib::db::TableCore::read().
|
consteval |
The fixed record stride of Record inside a WDBC/WDB2 record block.
| Record | the record type. |
Definition at line 239 of file schema.hpp.
References schemaOf().
|
consteval |
The column schema of record Record, derived by reflection: one Column per member, declaration order, with the annotation-carried roles applied.
| Record | the record type. |
Definition at line 220 of file schema.hpp.
References wowlib::db::detail::annotation(), wowlib::db::detail::classifyMember(), wowlib::db::Column::isId, wowlib::db::Column::isRelation, wowlib::db::Column::name, wowlib::db::Column::noninline, and wowlib::db::detail::recordMembers().
Referenced by fieldSlotCount(), wowlib::db::detail::idColumnOf(), wowlib::db::TypedTable< Record >::load(), recordStride(), stringSlotCount(), wowlib::db::detail::typedProjection(), wowlib::db::detail::typedValidate(), and wowlib::db::TypedTable< Record >::writeBack().
|
consteval |
The string-block references one record of Record stores — the width of the engine's per-record original-offset journal.
| Record | the record type. |
Definition at line 261 of file schema.hpp.
References schemaOf().
| Result< FileBuffer > wowlib::db::writeWdb2 | ( | const TableInfo & | info, |
| const RecordSource & | source, | ||
| const TableState & | state ) |
Encode a WDB2 image; header identity and the verbatim index/copy blocks are re-emitted.
Rebuilding the id-index is unsupported while the format is unverified, so changing the record count of an indexed table is an error.
| info | the table identity + schema. |
| source | the records to encode. |
| state | the preserved-state store. |
Definition at line 68 of file wdb2.cpp.
References wowlib::db::detail::StringPool::block, wowlib::ClientVersion::build, wowlib::db::Wdb2Header::build, wowlib::db::Wdb2Header::copyTableSize, wowlib::db::detail::encodeInlineRecord(), wowlib::db::TableState::fieldCount, wowlib::db::Wdb2Header::fieldCount, wowlib::db::detail::fieldSlotCount(), wowlib::InvalidEntityState, wowlib::db::Wdb2Header::magic, wowlib::makeError(), wowlib::db::TableInfo::name, wowlib::db::Wdb2Header::recordCount, wowlib::db::TableState::recordSize, wowlib::db::Wdb2Header::recordSize, wowlib::db::detail::recordStride(), wowlib::db::TableInfo::schema, wowlib::db::RecordSource::size(), wowlib::formats::StringBlock::size(), wowlib::db::TableState::sourceMagic, wowlib::db::Wdb2Header::stringBlockSize, wowlib::db::TableState::strings, wowlib::db::TableInfo::version, wowlib::db::TableState::wdb2Copy, wowlib::db::TableState::wdb2Header, wowlib::db::TableState::wdb2Index, Wdb2Magic, and wowlib::formats::StringBlock::write().
| Result< FileBuffer > wowlib::db::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-perfect for an unmodified table).
| info | the table identity + schema. |
| source | the records to encode. |
| state | the preserved-state store (read only). |
Definition at line 58 of file wdbc.cpp.
References wowlib::db::detail::StringPool::block, wowlib::db::detail::encodeInlineRecord(), wowlib::db::TableState::fieldCount, wowlib::db::WdbcHeader::fieldCount, wowlib::db::detail::fieldSlotCount(), wowlib::db::WdbcHeader::recordCount, wowlib::db::TableState::recordSize, wowlib::db::WdbcHeader::recordSize, wowlib::db::detail::recordStride(), wowlib::db::TableInfo::schema, wowlib::db::RecordSource::size(), wowlib::formats::StringBlock::size(), wowlib::db::TableState::sourceMagic, wowlib::db::WdbcHeader::stringBlockSize, wowlib::db::TableState::strings, and wowlib::formats::StringBlock::write().
|
inlineconstexpr |
Mark the table's primary-key column ($id$ in WoWDBDefs).
Exactly one member per record carries it.
Definition at line 49 of file annotations.hpp.
|
inlineconstexpr |
Mark a column stored outside the record image ($noninline$ in WoWDBDefs): ids delivered by the WDC id list, relations delivered by the relationship block.
Combined with id or relation.
Definition at line 54 of file annotations.hpp.
|
inlineconstexpr |
Mark a relationship-key column ($relation$ in WoWDBDefs): its value references the id of the table's parent (e.g.
SpellID on the SpellX* satellites).
Definition at line 59 of file annotations.hpp.
|
inlineconstexpr |
The per-id index block entry stride when maxId != 0: int32 indices[maxId - minId + 1] followed by int16 string_lengths[maxId - minId + 1] — 6 bytes per id in total.
Definition at line 50 of file wdb2.hpp.
Referenced by readWdb2().
|
inlineconstexpr |
The WDB2 magic as memcpy'd off the file front (the bytes "WDB2").
Definition at line 27 of file wdb2.hpp.
Referenced by wowlib::db::TableCore::read(), and writeWdb2().
|
inlineconstexpr |
The WDBC magic as memcpy'd off the file front (the bytes "WDBC").
Definition at line 25 of file wdbc.hpp.
Referenced by wowlib::db::TableCore::read().