|
wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
|
A parsed WDC-family file: the (normalized) header, shared tables, and located sections. More...
#include <wowlib/db/wdc/image.hpp>
Public Member Functions | |
| bool | idIsNoninline () const |
| Whether the id comes from the idList rather than a record field (flag 0x04); when false, the idIndex'th inline field is the id. | |
| bool | isSparse () const |
| Whether this file uses the sparse offset-map layout (flag 0x01). | |
| std::vector< std::uint32_t > | fieldAdditionalOffsets () const |
| The byte offset into palletData / commonData where each field's additional data begins (accumulated in field order). | |
| std::uint64_t | fieldRaw (std::size_t field, std::uint32_t element, std::uint32_t arrayCount, std::span< const std::byte > recordBytes, std::uint32_t id, const std::vector< std::uint32_t > &additional) const |
| Decode array element element of inline field field for one record. | |
| std::size_t | elemBitWidth (std::size_t field, std::uint32_t arrayCount) const |
| The bit width of one element of inline field field: for the inline kinds, the field's total width divided across arrayCount elements; for pallet/common the natural 32. | |
| bool | fieldIsSigned (std::size_t field) const |
| Whether field field's storage is the signed bitpacked kind (after WDC1 normalization). | |
Static Public Member Functions | |
| static Result< WdcImage > | parse (std::span< const std::byte > data) |
| Parse and structurally validate data as a WDC-family file, sniffing the flavor off the magic. | |
Public Attributes | |
| std::uint32_t | magic = 0 |
| The flavor actually parsed. | |
| Wdc3Header | header {} |
| WDC1 header fields are mapped onto this. | |
| Wdc5HeaderPrefix | wdc5 {} |
| Valid when magic == Wdc5Magic. | |
| StringRefMode | stringMode = StringRefMode::FieldRelative |
| std::span< const std::byte > | file |
| std::vector< WdcFieldStructure > | fieldStructure |
| std::vector< WdcFieldStorage > | fieldStorage |
| std::span< const std::byte > | palletData |
| std::span< const std::byte > | commonData |
| std::vector< WdcSection > | sections |
| std::vector< std::byte > | ownedOffsetMap |
| Owned backing for WDC1's normalized sparse map (filtered entries + the ids the dense map only implied). | |
| std::vector< std::uint32_t > | ownedOffsetMapIds |
A parsed WDC-family file: the (normalized) header, shared tables, and located sections.
The raw file span is retained so string references — which resolve to absolute file offsets — can be chased.
| std::size_t wowlib::db::wdc::WdcImage::elemBitWidth | ( | std::size_t | field, |
| std::uint32_t | arrayCount ) const |
The bit width of one element of inline field field: for the inline kinds, the field's total width divided across arrayCount elements; for pallet/common the natural 32.
| field | the field index. |
| arrayCount | the column's element count. |
Definition at line 308 of file image.cpp.
References wowlib::db::wdc::Bitpacked, wowlib::db::wdc::BitpackedSigned, fieldStorage, and wowlib::db::wdc::None.
Referenced by fieldRaw().
| std::vector< std::uint32_t > wowlib::db::wdc::WdcImage::fieldAdditionalOffsets | ( | ) | const |
The byte offset into palletData / commonData where each field's additional data begins (accumulated in field order).
Sized like fieldStorage; entries for non-pallet/common fields are unused.
Definition at line 256 of file image.cpp.
References wowlib::db::wdc::CommonData, fieldStorage, wowlib::db::wdc::Pallet, and wowlib::db::wdc::PalletArray.
|
inline |
Whether field field's storage is the signed bitpacked kind (after WDC1 normalization).
| field | the field index. |
Definition at line 130 of file image.hpp.
References wowlib::db::wdc::BitpackedSigned, and fieldStorage.
| std::uint64_t wowlib::db::wdc::WdcImage::fieldRaw | ( | std::size_t | field, |
| std::uint32_t | element, | ||
| std::uint32_t | arrayCount, | ||
| std::span< const std::byte > | recordBytes, | ||
| std::uint32_t | id, | ||
| const std::vector< std::uint32_t > & | additional ) const |
Decode array element element of inline field field for one record.
| field | the column index into fieldStorage. |
| element | the array element (0 for scalars). |
| arrayCount | the column's element count (1 for scalars) — for the inline kinds fieldSizeBits is the field's TOTAL width, split evenly across elements. |
| recordBytes | the record's byte span (fieldOffsetBits is relative to its start). |
| id | the record's id (common-data lookups key on it). |
| additional | fieldAdditionalOffsets() (pallet/common bases). |
Definition at line 273 of file image.cpp.
References wowlib::db::wdc::Bitpacked, wowlib::db::wdc::BitpackedSigned, wowlib::db::wdc::CommonData, elemBitWidth(), fieldStorage, wowlib::db::wdc::None, wowlib::db::wdc::Pallet, wowlib::db::wdc::PalletArray, and wowlib::db::wdc::BitReader::read().
|
inline |
Whether the id comes from the idList rather than a record field (flag 0x04); when false, the idIndex'th inline field is the id.
Definition at line 85 of file image.hpp.
References header, and wowlib::db::wdc::WdcFlagNoninlineId.
|
inline |
Whether this file uses the sparse offset-map layout (flag 0x01).
Definition at line 90 of file image.hpp.
References header, and wowlib::db::wdc::WdcFlagSparse.
Parse and structurally validate data as a WDC-family file, sniffing the flavor off the magic.
| data | the whole file content. |
Definition at line 28 of file image.cpp.
References magic, wowlib::makeError(), wowlib::TableMagicUnknown, wowlib::db::wdc::Wdc1Magic, wowlib::db::wdc::Wdc3Magic, wowlib::db::wdc::Wdc4Magic, and wowlib::db::wdc::Wdc5Magic.
Referenced by wowlib::db::wdc::readWdc().
| std::span<const std::byte> wowlib::db::wdc::WdcImage::commonData |
| std::vector<WdcFieldStorage> wowlib::db::wdc::WdcImage::fieldStorage |
Definition at line 68 of file image.hpp.
Referenced by elemBitWidth(), fieldAdditionalOffsets(), fieldIsSigned(), fieldRaw(), and wowlib::db::wdc::readWdc().
| std::vector<WdcFieldStructure> wowlib::db::wdc::WdcImage::fieldStructure |
| Wdc3Header wowlib::db::wdc::WdcImage::header {} |
WDC1 header fields are mapped onto this.
Definition at line 63 of file image.hpp.
Referenced by idIsNoninline(), isSparse(), and wowlib::db::wdc::readWdc().
| std::uint32_t wowlib::db::wdc::WdcImage::magic = 0 |
The flavor actually parsed.
Definition at line 62 of file image.hpp.
Referenced by parse(), and wowlib::db::wdc::readWdc().
| std::vector<std::byte> wowlib::db::wdc::WdcImage::ownedOffsetMap |
| std::vector<std::uint32_t> wowlib::db::wdc::WdcImage::ownedOffsetMapIds |
| std::span<const std::byte> wowlib::db::wdc::WdcImage::palletData |
| std::vector<WdcSection> wowlib::db::wdc::WdcImage::sections |
| StringRefMode wowlib::db::wdc::WdcImage::stringMode = StringRefMode::FieldRelative |
| Wdc5HeaderPrefix wowlib::db::wdc::WdcImage::wdc5 {} |
Valid when magic == Wdc5Magic.
Definition at line 64 of file image.hpp.
Referenced by wowlib::db::wdc::readWdc().