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

The conditional-base mechanism that gives a versioned chunked entity exactly the fields its client version defines. More...

#include <type_traits>
#include <wowlib/core/client_version.hpp>
Include dependency graph for version_slot.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wowlib::formats::Absent< Trait >
 A distinct empty base per Trait, so an entity inheriting several inactive version slots never inherits the same empty type twice (ill-formed). More...

Namespaces

namespace  wowlib
namespace  wowlib::formats

Typedefs

template<ClientVersion V, ClientVersion Since, class Trait, ClientVersion Until = VersionNeverRemoved>
using wowlib::formats::Slot = std::conditional_t<(V.formatLineage() >= Since && V.formatLineage() < Until), Trait, Absent<Trait>>
 A version-gated base: the entity inherits Trait (flattening its chunk members in) iff Since <= V < Until, else the empty absent<Trait>.

Variables

constexpr ClientVersion wowlib::formats::VersionNeverRemoved {255, 0, 0, 0}
 Above any supported client build — the default Until (never removed).

Detailed Description

The conditional-base mechanism that gives a versioned chunked entity exactly the fields its client version defines.

Version-gated chunks are grouped by availability range into small unwelded trait structs; the entity inherits each trait through Slot<V, Since, Trait[, Until]> — the trait when Since <= V < Until, else a distinct empty absent<Trait>. welder flattens an active trait's members onto the entity's binding (annotations survive, read off the declaring class); an inactive trait contributes nothing, so the field simply does not exist for that version (setting it is a compile error).

Definition in file version_slot.hpp.