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

The type-erased boundary between the templated Table<Record> facade (table.hpp) and the per-format codecs (wdbc. More...

#include <cstddef>
#include <cstdint>
#include <span>
#include <string>
#include <string_view>
#include <vector>
#include <welder/vocabulary.hpp>
#include <wowlib/core/client_version.hpp>
#include <wowlib/db/schema.hpp>
#include <wowlib/formats/common/string_block.hpp>
Include dependency graph for codec.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wowlib::db::EncryptedSection
 One WDC section whose records could not be decoded because they are encrypted under a TACT key wowlib does not hold. More...
struct  wowlib::db::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  wowlib::db::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  wowlib::db::RecordSink
 The decode target: the codecs build the record vector through this, one field at a time. More...
class  wowlib::db::RecordSource
 The encode source: the codecs read the record vector through this. More...

Namespaces

namespace  wowlib
namespace  wowlib::db
namespace  wowlib::db::detail

Enumerations

enum class  wowlib::db::EncryptedPolicy { wowlib::db::Preserve , wowlib::db::Drop }
 How write() treats a table that still holds keyless (undecryptable) encrypted sections. More...

Functions

std::size_t wowlib::db::detail::recordStride (std::span< const Column > schema)
 The fixed record stride (WDBC/WDB2) of schema.
std::uint32_t wowlib::db::detail::fieldSlotCount (std::span< const Column > schema)
 The expanded on-disk field-slot count of schema (WDBC/WDB2 fieldCount).
std::size_t wowlib::db::detail::stringSlotCount (std::span< const Column > schema)
 The per-record string-reference count of schema (the offset journal width).
std::size_t wowlib::db::detail::inlineColumnCount (std::span< const Column > schema)
 The number of INLINE columns (everything not $noninline$).
bool wowlib::db::detail::idIsNoninline (std::span< const Column > schema)
 Whether the id column is stored outside the record ($noninline$ id).
std::uint16_t wowlib::db::detail::idFieldIndex (std::span< const Column > schema)
 The inline field index of an inline id column (0 when non-inline).

Detailed Description

The type-erased boundary between the templated Table<Record> facade (table.hpp) and the per-format codecs (wdbc.

{hpp,cpp}, wdb2.{hpp,cpp}, and the WDC family under wdc/).

The codecs are NOT templated on the record type: they drive the record vector only through the abstract RecordSink (decode target) / RecordSource (encode source), reading and writing one field at a time by (column, element) against the runtime schema (schema.hpp). record_bridge.hpp supplies the one small per-record adapter that implements these; everything heavy — headers, string blocks, WDC3 sections, compression, pallet/common blocks, copy tables, bit packing — is compiled ONCE in the codec .cpp files instead of once per generated table.

Definition in file codec.hpp.