wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wowlib::db::Column Struct Reference

One column of a record schema, derived from a record member by reflection (typed records) or from the schema catalog (the generic table). More...

#include <wowlib/db/schema.hpp>

Public Member Functions

 Column ()=default
 User-declared (defaulted) so Column is NOT an aggregate: bindings would otherwise synthesize a field-wise constructor, and its const char* name parameter would store a pointer into the marshalling temporary — Column is read-only schema metadata, never constructed from a bound language.
constexpr std::string_view nameView () const
 The member spelling as a view.
constexpr std::string_view dbdNameView () const
 The verbatim WoWDBDefs spelling as a view.
constexpr std::size_t inlineBytes () const
 The bytes the column occupies inside a fixed-stride (WDBC/WDB2) record image: zero when noninline, the flags field included for LocString.
constexpr std::uint32_t fieldSlots () const
 The expanded on-disk field slots the column contributes to a WDBC/WDB2 header field count: arrays count each element, LocString counts every language slot plus the flags field, noninline columns count zero.
constexpr std::size_t stringSlots () const
 The string-block references the column stores per record (the width of the engine's per-record offset journal).

Public Attributes

const char * name = nullptr
 The column name: the snake_case spelling of the WoWDBDefs column ('MapName' -> 'map_name').
const char * dbdName = nullptr
 The verbatim WoWDBDefs spelling of the column ('MapName_lang'); column_index accepts it as an alias.
ColumnType type = ColumnType::Int
 The logical value class.
std::uint8_t bits = 0
 Integer element width in bits; 32 for float/string refs.
bool isSigned = false
 Integer signedness; false for non-Int columns.
std::uint16_t arrayLen = 1
 Element count; 1 for scalar columns.
std::uint8_t localeCount = 0
 LocString language slots (8 or 16); 0 otherwise.
bool isId = false
 Whether this is the table's primary key ($id$).
bool isRelation = false
 Whether this is a relationship key ($relation$).
bool noninline = false
 Whether the column holds no bytes inside the record image ($noninline$).

Detailed Description

One column of a record schema, derived from a record member by reflection (typed records) or from the schema catalog (the generic table).

Array columns are ONE Column with arrayLen > 1 — the WoWDBDefs view of the world, not the expanded on-disk field list. One column of a table schema: its name, value class, integer shape, array length and key roles.

Definition at line 46 of file schema.hpp.

Constructor & Destructor Documentation

◆ Column()

wowlib::db::Column::Column ( )
default

User-declared (defaulted) so Column is NOT an aggregate: bindings would otherwise synthesize a field-wise constructor, and its const char* name parameter would store a pointer into the marshalling temporary — Column is read-only schema metadata, never constructed from a bound language.

Member Function Documentation

◆ dbdNameView()

std::string_view wowlib::db::Column::dbdNameView ( ) const
inlineconstexpr

The verbatim WoWDBDefs spelling as a view.

Returns
the interned upstream name; empty when the column has none.

Definition at line 83 of file schema.hpp.

References dbdName.

◆ fieldSlots()

std::uint32_t wowlib::db::Column::fieldSlots ( ) const
inlineconstexpr

The expanded on-disk field slots the column contributes to a WDBC/WDB2 header field count: arrays count each element, LocString counts every language slot plus the flags field, noninline columns count zero.

Returns
the field slot count.

Definition at line 105 of file schema.hpp.

References arrayLen, localeCount, wowlib::db::LocString, noninline, and type.

◆ inlineBytes()

std::size_t wowlib::db::Column::inlineBytes ( ) const
inlineconstexpr

The bytes the column occupies inside a fixed-stride (WDBC/WDB2) record image: zero when noninline, the flags field included for LocString.

Returns
the on-disk byte width.

Definition at line 90 of file schema.hpp.

References arrayLen, bits, wowlib::db::Float, wowlib::db::Int, localeCount, wowlib::db::LocString, noninline, wowlib::db::String, and type.

◆ nameView()

std::string_view wowlib::db::Column::nameView ( ) const
inlineconstexpr

The member spelling as a view.

Returns
the interned column name.

Definition at line 79 of file schema.hpp.

References name.

Referenced by wowlib::db::DynTable::podColumn(), and wowlib::db::TableCore::validate().

◆ stringSlots()

std::size_t wowlib::db::Column::stringSlots ( ) const
inlineconstexpr

The string-block references the column stores per record (the width of the engine's per-record offset journal).

Returns
String columns: the element count; LocString: the language slot count; 0 otherwise.

Definition at line 115 of file schema.hpp.

References arrayLen, localeCount, wowlib::db::LocString, noninline, wowlib::db::String, and type.

Referenced by wowlib::db::TableCore::validate().

Member Data Documentation

◆ arrayLen

std::uint16_t wowlib::db::Column::arrayLen = 1

Element count; 1 for scalar columns.

Definition at line 60 of file schema.hpp.

Referenced by wowlib::db::detail::classifyMember(), wowlib::db::detail::ColumnRows::ColumnRows(), fieldSlots(), inlineBytes(), and stringSlots().

◆ bits

std::uint8_t wowlib::db::Column::bits = 0

Integer element width in bits; 32 for float/string refs.

Definition at line 56 of file schema.hpp.

Referenced by wowlib::db::detail::classifyMember(), wowlib::db::detail::ColumnRows::ColumnRows(), and inlineBytes().

◆ dbdName

const char* wowlib::db::Column::dbdName = nullptr

The verbatim WoWDBDefs spelling of the column ('MapName_lang'); column_index accepts it as an alias.

Empty for columns without a DBD identity (reflection-derived schemas). The upstream spelling (interned; null = none).

Definition at line 52 of file schema.hpp.

Referenced by dbdNameView().

◆ isId

bool wowlib::db::Column::isId = false

Whether this is the table's primary key ($id$).

Definition at line 64 of file schema.hpp.

Referenced by wowlib::db::detail::ColumnRows::ColumnRows(), wowlib::db::schemaOf(), and wowlib::db::TableCore::validate().

◆ isRelation

bool wowlib::db::Column::isRelation = false

Whether this is a relationship key ($relation$).

Definition at line 66 of file schema.hpp.

Referenced by wowlib::db::schemaOf().

◆ isSigned

bool wowlib::db::Column::isSigned = false

Integer signedness; false for non-Int columns.

Definition at line 58 of file schema.hpp.

Referenced by wowlib::db::detail::classifyMember(), and wowlib::db::DynTable::podColumn().

◆ localeCount

std::uint8_t wowlib::db::Column::localeCount = 0

LocString language slots (8 or 16); 0 otherwise.

Definition at line 62 of file schema.hpp.

Referenced by wowlib::db::detail::classifyMember(), wowlib::db::detail::ColumnRows::ColumnRows(), fieldSlots(), inlineBytes(), and stringSlots().

◆ name

const char* wowlib::db::Column::name = nullptr

The column name: the snake_case spelling of the WoWDBDefs column ('MapName' -> 'map_name').

This spelling is a stable cross-release contract on every binding surface. The member spelling (interned, never dangling).

Definition at line 48 of file schema.hpp.

Referenced by nameView(), and wowlib::db::schemaOf().

◆ noninline

bool wowlib::db::Column::noninline = false

Whether the column holds no bytes inside the record image ($noninline$).

Definition at line 68 of file schema.hpp.

Referenced by fieldSlots(), inlineBytes(), wowlib::db::schemaOf(), and stringSlots().

◆ type


The documentation for this struct was generated from the following file: