|
wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
|
Version-range canonicalization: the machinery behind collapsing a versioned family's instantiations to its REAL layout permutations. More...
#include <array>#include <span>#include <string>#include <string_view>#include <wowlib/core/client_version.hpp>#include <wowlib/core/expansion.hpp>#include <wowlib/core/reflect.hpp>Go to the source code of this file.
Classes | |
| struct | wowlib::formats::RangeRow |
| One row of a family's welded range table: the alias suffix (stringized from the x-macro) and the range's canonical version. More... | |
Namespaces | |
| namespace | wowlib |
| namespace | wowlib::formats |
Functions | |
| constexpr ClientVersion | wowlib::formats::versionFloor (ClientVersion v, std::span< const ClientVersion > pivots) |
| The latest pivot at or below v — the identity of v's range. | |
| constexpr ClientVersion | wowlib::formats::canonicalVersion (ClientVersion v, std::span< const ClientVersion > pivots, std::span< const ClientVersion > grid) |
| The canonical version v collapses to: the FIRST grid version in v's range. | |
| constexpr std::string | wowlib::formats::rangeSuffix (ClientVersion canonical, std::span< const ClientVersion > pivots, std::span< const ClientVersion > grid) |
| The suffix naming canonical's range on grid: the plain expansion name for a single-version range ("Wotlk"), "FirstToLast" for an interior range ("CataToMop"), and "FirstPlus" for a range reaching the grid's end ("LegionPlus") — trailing ranges grow with every new release, and the Plus spelling keeps their name stable when they do. | |
| constexpr bool | wowlib::formats::rangesValid (std::span< const RangeRow > rows, std::span< const ClientVersion > pivots, std::span< const ClientVersion > grid) |
| Does rows exactly enumerate the family's ranges — ascending, one row per distinct canonical of grid, each named exactly as rangeSuffix derives? | |
Version-range canonicalization: the machinery behind collapsing a versioned family's instantiations to its REAL layout permutations.
A family (record or entity template keyed on a ClientVersion NTTP) usually has only a handful of content permutations — a few layout pivots split the whole client timeline into ranges, and every version inside a range is the same type. Each family therefore declares its PIVOTS (the versions its content or serialization behavior changes at), keeps the annotated struct in a nested detail namespace, and exposes its public name as a CANONICALIZING alias:
template <ClientVersion V> using Foo = detail::Foo<canonicalVersion(V, foo_pivots, grid)>;
so every use-site — entity members, facade walks, user code — collapses to the range's first grid version automatically. The welded aliases become one row per range, named by rangeSuffix() ("Vanilla", "CataToMop", "WotlkPlus"), and rangesValid() consteval-checks each row table against the pivot math so the ranges can never drift.
A pivot that does not separate two grid versions is a no-op — listing a boundary generously is always safe, so families include every documented change even when the current grid does not straddle it.
Definition in file version_range.hpp.