|
wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
|
Classes | |
| 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 | ColumnRows |
| The column-store row storage: one exact-width POD buffer per numeric column, one string vector per string-bearing column, one flags vector per LocString column — implementing both codec interfaces over them. More... | |
| struct | ElementTraits |
| Trait: the element type / extent of a member — unwraps std::array. More... | |
| struct | ElementTraits< std::array< T, N > > |
| struct | FixedString |
| A compile-time string NTTP (the column<"id">() spelling). More... | |
| struct | IdSpec |
| Stored form of id: the member is the table's primary key ($id$). More... | |
| struct | LocstringTraits |
| Trait: is T a LocString<N>? More... | |
| struct | LocstringTraits< LocString< N > > |
| struct | NoninlineSpec |
| Stored form of noninline: the member holds no bytes inside the record image — its values come from a satellite block (the WDC id list for ids, the relationship block for relations). 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... | |
| struct | RelationSpec |
| Stored form of relation: the member is a relationship key referencing the parent table's id ($relation$). More... | |
| struct | StringPool |
| A writable string block resolving values to byte-perfect offsets: the journaled original offset while the value still matches, else an equal existing entry, else a fresh append. More... | |
| struct | TypedMismatch |
| The consteval-validation failure carrier: throwing it inside constant evaluation aborts compilation with the message in the diagnostic. More... | |
Enumerations | |
| enum class | AccessKind : std::uint8_t { I8 , U8 , I16 , U16 , I32 , U32 , I64 , U64 , F32 , Str , LocStr } |
| 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 | |
| std::size_t | recordStride (std::span< const Column > schema) |
| The fixed record stride (WDBC/WDB2) of schema. | |
| std::uint32_t | fieldSlotCount (std::span< const Column > schema) |
| The expanded on-disk field-slot count of schema (WDBC/WDB2 fieldCount). | |
| std::size_t | stringSlotCount (std::span< const Column > schema) |
| The per-record string-reference count of schema (the offset journal width). | |
| std::size_t | inlineColumnCount (std::span< const Column > schema) |
| The number of INLINE columns (everything not $noninline$). | |
| bool | idIsNoninline (std::span< const Column > schema) |
| Whether the id column is stored outside the record ($noninline$ id). | |
| std::uint16_t | idFieldIndex (std::span< const Column > schema) |
| The inline field index of an inline id column (0 when non-inline). | |
| std::int64_t | readInt (std::span< const std::byte > image, std::size_t &pos, std::size_t bytes, bool isSigned) |
| Read a little-endian integer of bytes bytes at pos, sign-extended when isSigned, advancing pos. | |
| void | writeInt (FileBuffer &out, std::int64_t value, std::size_t bytes) |
| Append value's low bytes bytes (little-endian) to out. | |
| void | decodeInlineRecord (std::span< const Column > schema, std::size_t record, std::span< const std::byte > image, RecordSink &sink, TableState &state) |
| Decode one fixed-stride record's inline fields into sink and journal its string offsets (record then schema then element order). | |
| void | encodeInlineRecord (std::span< const Column > schema, const RecordSource &source, std::size_t record, FileBuffer &out, StringPool &pool, const TableState &state, std::size_t &cursor) |
| Encode one fixed-stride record's inline fields from source, appending to out and resolving strings through pool (cursor tracks the journal). | |
| template<typename E> | |
| consteval AccessKind | accessKindOf () |
| The AccessKind of element type E (consteval; bool is rejected by classifyMember long before this runs). | |
| template<typename Struct> | |
| consteval std::uint32_t | memberOffset (std::string_view name) |
| The byte offset of Struct's member named name (consteval). | |
| template<typename Record> | |
| consteval auto | columnAccessOf () |
| The per-column access table of Record: one ColumnAccess per member, declaration order — the same 1:1 correspondence schemaOf() rests on. | |
| template<typename Record> | |
| consteval std::size_t | idColumnOf () |
| The $id$ column index of Record (consteval), or SIZE_MAX. | |
| bool | allZero (std::span< const std::byte > bytes) |
| Whether every byte of bytes is zero (an empty span counts as zero). | |
| template<typename Spec, std::meta::info M> | |
| consteval std::optional< Spec > | annotation () |
| The first annotation of type Spec on reflected member M, if any. | |
| template<typename Member> | |
| consteval Column | classifyMember () |
| The physical column shape of a record member of type Member — the name and the annotation-carried roles are the caller's to fill in. | |
| template<typename Record> | |
| consteval auto | recordMembers () |
| The reflected non-static data members of record Record, declaration order. | |
| consteval blob::RangeEntry | typedRangeOf (std::string_view table, ClientVersion version) |
| The blob's column list for (table, version)'s era, as blob-global column indexes [first, first+count), or a thrown TypedMismatch. | |
| consteval std::size_t | typedColumnIndex (std::string_view table, ClientVersion version, std::string_view name) |
| The era-schema column index whose name is name, or a thrown TypedMismatch. | |
| template<typename Record> | |
| consteval bool | typedValidate () |
| Validate Record against the blob (see the file note for the rules); also the projection builder's precondition. | |
| template<typename Record> | |
| consteval auto | typedProjection () |
| The projection map of Record: member position -> era-schema column index, as a static (never-dangling) array. | |
Variables | |
| template<typename Record> | |
| constexpr RecordOps | RecordOpsFor |
| The RecordOps instance of Record — the entire per-record residue. | |
| constexpr unsigned char | TypedSchemaBlob [] |
| The blob, again, for CONSTANT EVALUATION in consumer TUs (the runtime catalog's copy lives inside schema_catalog.cpp). | |
|
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.
| Enumerator | |
|---|---|
| I8 | |
| U8 | |
| I16 | |
| U16 | |
| I32 | |
| U32 | |
| I64 | |
| U64 | Integer elements, by shape. |
| F32 | A float element. |
| Str | A std::string element. |
| LocStr | A LocString<N>: strings at offset, flags on the side. |
Definition at line 45 of file record_bridge.hpp.
|
consteval |
The AccessKind of element type E (consteval; bool is rejected by classifyMember long before this runs).
Definition at line 72 of file record_bridge.hpp.
References F32, I16, I32, I64, I8, Str, U16, U32, U64, and U8.
Referenced by columnAccessOf().
|
inline |
Whether every byte of bytes is zero (an empty span counts as zero).
| bytes | the span to test. |
Definition at line 154 of file schema.hpp.
|
consteval |
The first annotation of type Spec on reflected member M, if any.
| Spec | the annotation payload type (a *_spec struct). |
| M | the reflected member. |
Definition at line 165 of file schema.hpp.
Referenced by wowlib::db::schemaOf().
|
consteval |
The physical column shape of a record member of type Member — the name and the annotation-carried roles are the caller's to fill in.
| Member | the member's declared type. |
Definition at line 176 of file schema.hpp.
References wowlib::db::Column::arrayLen, wowlib::db::Column::bits, wowlib::db::detail::ElementTraits< T >::Extent, wowlib::db::Float, wowlib::db::Int, wowlib::db::Column::isSigned, wowlib::db::Column::localeCount, wowlib::db::LocString, wowlib::db::String, wowlib::db::Column::type, and wowlib::db::detail::LocstringTraits< T >::Value.
Referenced by wowlib::db::schemaOf().
|
consteval |
The per-column access table of Record: one ColumnAccess per member, declaration order — the same 1:1 correspondence schemaOf() rests on.
Definition at line 104 of file record_bridge.hpp.
References accessKindOf(), wowlib::db::detail::ColumnAccess::elemStride, wowlib::db::detail::ColumnAccess::flagsOffset, wowlib::db::detail::ColumnAccess::kind, LocStr, memberOffset(), wowlib::db::detail::ColumnAccess::offset, recordMembers(), and wowlib::db::detail::LocstringTraits< T >::Value.
| void wowlib::db::detail::decodeInlineRecord | ( | std::span< const Column > | schema, |
| std::size_t | record, | ||
| std::span< const std::byte > | image, | ||
| RecordSink & | sink, | ||
| TableState & | state ) |
Decode one fixed-stride record's inline fields into sink and journal its string offsets (record then schema then element order).
Definition at line 64 of file codec_common.cpp.
References wowlib::formats::StringBlock::at(), wowlib::db::Float, wowlib::db::Int, wowlib::db::LocString, readInt(), wowlib::db::RecordSink::setFloat(), wowlib::db::RecordSink::setInt(), wowlib::db::RecordSink::setString(), wowlib::db::String, wowlib::db::TableState::stringOffsets, and wowlib::db::TableState::strings.
Referenced by wowlib::db::readWdb2(), and wowlib::db::readWdbc().
| void wowlib::db::detail::encodeInlineRecord | ( | std::span< const Column > | schema, |
| const RecordSource & | source, | ||
| std::size_t | record, | ||
| FileBuffer & | out, | ||
| StringPool & | pool, | ||
| const TableState & | state, | ||
| std::size_t & | cursor ) |
Encode one fixed-stride record's inline fields from source, appending to out and resolving strings through pool (cursor tracks the journal).
Definition at line 105 of file codec_common.cpp.
References wowlib::db::Float, wowlib::db::RecordSource::getInt(), wowlib::db::RecordSource::getSlot(), wowlib::db::RecordSource::getString(), wowlib::db::Int, wowlib::db::LocString, wowlib::db::detail::StringPool::resolve(), wowlib::db::String, wowlib::db::TableState::stringOffsets, and writeInt().
Referenced by wowlib::db::writeWdb2(), and wowlib::db::writeWdbc().
|
inline |
The expanded on-disk field-slot count of schema (WDBC/WDB2 fieldCount).
Definition at line 154 of file codec.hpp.
Referenced by wowlib::db::writeWdb2(), and wowlib::db::writeWdbc().
|
consteval |
The $id$ column index of Record (consteval), or SIZE_MAX.
Definition at line 150 of file record_bridge.hpp.
References wowlib::db::schemaOf().
|
inline |
|
inline |
|
inline |
The number of INLINE columns (everything not $noninline$).
Definition at line 168 of file codec.hpp.
Referenced by wowlib::db::wdc::readWdc().
|
consteval |
The byte offset of Struct's member named name (consteval).
Definition at line 95 of file record_bridge.hpp.
Referenced by columnAccessOf().
| std::int64_t wowlib::db::detail::readInt | ( | std::span< const std::byte > | image, |
| std::size_t & | pos, | ||
| std::size_t | bytes, | ||
| bool | isSigned ) |
Read a little-endian integer of bytes bytes at pos, sign-extended when isSigned, advancing pos.
Definition at line 12 of file codec_common.cpp.
Referenced by decodeInlineRecord().
|
consteval |
The reflected non-static data members of record Record, declaration order.
Generated records are flat structs — no base flattening.
| Record | the record type. |
Definition at line 207 of file schema.hpp.
Referenced by wowlib::db::TypedTable< Record >::column(), columnAccessOf(), and wowlib::db::schemaOf().
|
inline |
The fixed record stride (WDBC/WDB2) of schema.
Definition at line 147 of file codec.hpp.
Referenced by wowlib::db::readWdb2(), wowlib::db::readWdbc(), wowlib::db::writeWdb2(), and wowlib::db::writeWdbc().
|
inline |
The per-record string-reference count of schema (the offset journal width).
Definition at line 161 of file codec.hpp.
Referenced by wowlib::db::readWdb2(), and wowlib::db::readWdbc().
|
consteval |
The era-schema column index whose name is name, or a thrown TypedMismatch.
Definition at line 98 of file typed.hpp.
References wowlib::db::blob::View::column(), wowlib::db::blob::RangeEntry::columnCount, wowlib::db::blob::View::copyStringAt(), wowlib::db::blob::RangeEntry::firstColumn, wowlib::db::blob::ColumnEntry::nameOff, typedRangeOf(), and TypedSchemaBlob.
Referenced by typedProjection(), and typedValidate().
|
consteval |
The projection map of Record: member position -> era-schema column index, as a static (never-dangling) array.
Definition at line 132 of file typed.hpp.
References wowlib::db::schemaOf(), and typedColumnIndex().
Referenced by wowlib::db::TypedTable< Record >::column(), wowlib::db::TypedTable< Record >::load(), and wowlib::db::TypedTable< Record >::writeBack().
|
consteval |
The blob's column list for (table, version)'s era, as blob-global column indexes [first, first+count), or a thrown TypedMismatch.
Definition at line 79 of file typed.hpp.
References wowlib::db::blob::View::era(), wowlib::db::blob::View::eraCount(), wowlib::db::blob::RangeEntry::eraMask, wowlib::db::blob::View::findTable(), wowlib::db::blob::TableEntry::firstRange, wowlib::ClientVersion::major, wowlib::db::blob::View::range(), wowlib::db::blob::TableEntry::rangeCount, wowlib::db::blob::View::table(), and TypedSchemaBlob.
Referenced by typedColumnIndex(), and typedValidate().
|
consteval |
Validate Record against the blob (see the file note for the rules); also the projection builder's precondition.
Definition at line 109 of file typed.hpp.
References wowlib::db::blob::ColumnEntry::arrayLen, wowlib::db::blob::ColumnEntry::bits, wowlib::db::blob::View::column(), wowlib::db::blob::RangeEntry::firstColumn, wowlib::db::Int, wowlib::db::blob::ColumnEntry::isSigned, wowlib::db::blob::ColumnEntry::localeCount, wowlib::db::LocString, wowlib::db::schemaOf(), wowlib::db::blob::ColumnEntry::type, typedColumnIndex(), typedRangeOf(), and TypedSchemaBlob.
| void wowlib::db::detail::writeInt | ( | FileBuffer & | out, |
| std::int64_t | value, | ||
| std::size_t | bytes ) |
Append value's low bytes bytes (little-endian) to out.
Definition at line 23 of file codec_common.cpp.
Referenced by encodeInlineRecord().
|
inlineconstexpr |
The RecordOps instance of Record — the entire per-record residue.
Definition at line 161 of file record_bridge.hpp.
|
inlineconstexpr |
The blob, again, for CONSTANT EVALUATION in consumer TUs (the runtime catalog's copy lives inside schema_catalog.cpp).
Same file, same bytes; consteval-only use.
Definition at line 66 of file typed.hpp.
Referenced by typedColumnIndex(), typedRangeOf(), and typedValidate().