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

Schema reflection over generated client-database record structs: the column list, record stride and field counts the table engine and the per-magic codecs derive from a record type. More...

#include <meta>
#include <algorithm>
#include <array>
#include <ranges>
#include <span>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <type_traits>
#include <vector>
#include <wowlib/core/client_version.hpp>
#include <wowlib/db/annotations.hpp>
#include <wowlib/db/locstring.hpp>
Include dependency graph for schema.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wowlib::db::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  wowlib::db::detail::LocstringTraits< T >
 Trait: is T a LocString<N>? More...
struct  wowlib::db::detail::LocstringTraits< LocString< N > >
struct  wowlib::db::detail::ElementTraits< T >
 Trait: the element type / extent of a member — unwraps std::array. More...
struct  wowlib::db::detail::ElementTraits< std::array< T, N > >

Namespaces

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

Concepts

concept  wowlib::db::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.

Enumerations

enum class  wowlib::db::ColumnType : std::uint8_t { wowlib::db::Int , wowlib::db::Float , wowlib::db::String , wowlib::db::LocString }
 The logical value class of a column. More...

Functions

bool wowlib::db::detail::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 > wowlib::db::detail::annotation ()
 The first annotation of type Spec on reflected member M, if any.
template<typename Member>
consteval Column wowlib::db::detail::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 wowlib::db::detail::recordMembers ()
 The reflected non-static data members of record Record, declaration order.
template<typename Record>
consteval auto wowlib::db::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 wowlib::db::recordStride ()
 The fixed record stride of Record inside a WDBC/WDB2 record block.
template<typename Record>
consteval std::uint32_t wowlib::db::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 wowlib::db::stringSlotCount ()
 The string-block references one record of Record stores — the width of the engine's per-record original-offset journal.

Detailed Description

Schema reflection over generated client-database record structs: the column list, record stride and field counts the table engine and the per-magic codecs derive from a record type.

The record's member TYPES carry the physical column shapes (intN_t width/signedness, float, std::string, LocString<N>, std::array<T, N> arrays); the db annotations carry the roles a type cannot (id / noninline / relation — annotations.hpp).

Definition in file schema.hpp.