wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wowlib::formats::detail Namespace Reference

Classes

struct  ChunkSpec
 Stored form of a chunk annotation: the member's binary identity. More...
class  ChunkWriter
 Append-only chunk emission with size backpatching. More...
struct  ContainerSpec
 Stored form of container: the chunk payload is itself a chunk stream; the member is a nested chunked entity read recursively. More...
struct  CountExactlySpec
 Stored form of countExactly: the member's element count is fixed by the format (an ADT map chunk's 145 height samples). More...
struct  CountMatchesSpec
 Stored form of countMatches: when the member is engaged, its element count times scale must equal the named sibling member's count. More...
struct  CountMultipleOfSpec
 Stored form of countMultipleOf: the member's element count must be a multiple of divisor. More...
struct  ExpectedValueSpec
 Stored form of expectedValue: the (integral) data member must hold exactly this value (format-version fields). More...
struct  GatedBySpec
 Stored form of gatedBy (offset entities): the member occupies binary bytes only when the entity's globalFlags has any mask bit set. More...
struct  HeaderSpec
 Stored form of header: raw leading bytes of a container payload, memcpy'd before chunk scanning starts — not a chunk of its own. More...
struct  IndexesInRootSpec
 Stored form of indexesInRoot: every element of the (integral) vector member must be a valid index into the named member of the ASSEMBLY's root entity. More...
struct  IndexesOptionalSpec
 Stored form of indexesOptional: like indexes, but the client's "no reference" sentinel (a negative value, or the all-ones value of an unsigned element) is a legal element. More...
struct  IndexesSpec
 Stored form of indexes: every element of the (integral) vector member must be a valid index into the named sibling member. More...
struct  NonemptySpec
 Stored form of nonempty: the member must hold data for the file to be meaningful to the client, even though read() tolerates its absence. More...
struct  OffsetAfterSpec
 Stored form of offsetAfter (offset entities): the trait-base member's positional layout position — right after the named own member of the entity. More...
struct  OptionalSpec
 Stored form of optional: absence on read is not an error. More...
struct  RepeatedTraits
 Trait: is T a Repeated<U, N> (a repeats-annotated member)? More...
struct  RepeatedTraits< Repeated< U, N > >
struct  RepeatingSpec
 Stored form of repeating: the chunk appears once per element, any number of times (WDL MARE tiles, _mpv PVMI/PVPD/PVBD groups). More...
struct  RepeatsSpec
 Stored form of repeats: the chunk may appear up to max times. More...
struct  SequenceDataSpec
 Stored form of SequenceData (offset entities): the member's nested per-element data may live in an external buffer (M2 .anim files) — the engine resolves each outer element's base span/sink through the I/O context instead of assuming the entity's own buffer. More...
struct  SinceSpec
 Stored form of since: member active for entity versions >= v. More...
struct  UntilSpec
 Stored form of until: member active for entity versions < v. More...

Concepts

concept  HasConvertStep
concept  HasValidateExtra
 A type carrying the imperative half of its contracts (see the validateExtra hook).
concept  SlotSequence
 A container of independent SLOTS rather than one logical array — a chunk that may appear several times, each occurrence complete in itself (Repeated<>, opting in with ValidationSlots).
concept  ValidatableSequence
 A member the walker can iterate element-wise: std::vector, std::array, Repeated<> and std::string all qualify.

Functions

consteval std::uint32_t chunkMagicOf (std::meta::info member)
 The chunk() fourcc of member member, or 0 if it carries none.
template<typename E>
consteval auto writeOrder ()
 The member indices (into membersOf<E>) in the order fresh entities emit their chunks.
std::unexpected< Error > chunkError (ErrorCode code, std::uint32_t fourcc, std::size_t offset, std::string_view what, FourCCEndian endian=FourCCEndian::Reversed)
 Build a chunk-scoped error value.
template<typename E>
consteval FourCCEndian unknownFourccEndian ()
 The id layout to display for chunks the entity has no spec for (garbage magics, unknown chunks): the entity's declared UnknownFourccEndian when present (the forward-magic M2 file family), else the reversed common case.
template<typename M>
Result< void > readValue (M &dst, std::span< const std::byte > payload, std::uint32_t fourcc, std::size_t offset, FourCCEndian endian)
 Read one chunk payload into member dst, dispatching on the member kind (nested entity, self-serializing, array, raw binary struct).
template<typename M>
Result< void > writeValue (const M &src, FileBuffer &out)
 Append member src's chunk payload to out (payload only — the caller emits the chunk header).
template<ChunkedEntity E>
bool entityEngaged (const E &entity)
 Does a never-journaled nested entity hold anything worth a chunk?
template<typename M>
bool engaged (const M &value)
 Is the member's chunk written when it never appeared in the journal?
template<ChunkedEntity E>
Result< void > readEntity (E &entity, std::span< const std::byte > data)
 Deserialize data into entity — the engine behind ChunkedFile::read(); see that method for the full contract.
template<ChunkedEntity E>
Result< void > writeEntity (const E &entity, FileBuffer &out)
 Serialize entity, appending to out — the engine behind ChunkedFile::write(); see that method for the full contract.
template<typename E>
consteval std::int32_t chunkMemberIndex (std::uint32_t magic)
 The flattened member index (a JournalEntry::member value) of the chunk member carrying magic, or -1 when no member does.
template<ChunkedEntity E>
std::vector< JournalEntry > freshJournal (const E &entity)
 The journal a FRESH write of entity would produce: one entry per engaged (or required) chunk member in canonical write order, repeated/ repeating members expanded to one entry per element, no unknown-chunk or trailing entries.
template<typename Spec, std::meta::info M>
consteval std::optional< Spec > annotation ()
 The first annotation of type Spec on reflected member M, if any.
template<ClientVersion V, std::meta::info M>
consteval bool versionActive ()
 Whether member M participates for entity version V, per its since/until annotations (absent bounds mean unbounded).
consteval void collectMembers (std::meta::info type, std::vector< std::meta::info > &out)
 Collect type's non-static data members with its public bases flattened in FIRST (recursively, declaration order) — mirroring how welder flattens a non-welded base's members into the derived binding.
template<typename E>
consteval auto membersOf ()
 The reflected member list of E, public bases flattened in (see collectMembers).
template<typename E>
consteval std::meta::info memberNamed (std::string_view name)
 The reflected member of E named name (public bases flattened, like membersOf), or the null reflection when no member carries the name — how the sibling-naming annotations (countMatches, indexes, offsetAfter) resolve their target at compile time, so a typo is a static_assert at the use site rather than a silent no-op.
consteval bool nestedInStd (std::meta::info r)
 Whether r is declared inside namespace std (at any nesting depth — libstdc++ hides types in inline namespaces like std::__cxx11).
template<typename T>
consteval bool isStdType ()
 Whether T is a standard-library type (see nestedInStd).
consteval bool hasValidationAnnotation (std::meta::info member)
 Whether member carries any validation annotation.
template<typename T>
consteval bool hasValidationContent ()
 Whether validating a T can produce anything — it declares a validateExtra hook, carries an annotated member, or (recursively) holds something that does.
template<typename Values>
void validateIndexElements (const Values &values, std::size_t targetCount, std::string_view member, std::string_view target, ValidationReport &report)
 Report every element of values that is not a valid index into a targetCount-element target, capped so a corrupt file cannot flood the report.
template<std::integral T>
constexpr bool isNoIndex (T value)
 Whether value is the client's "no reference" sentinel for an index element: negative in a signed lookup, all-ones in an unsigned one (the 0xFFFF an M2 lookup table leaves in unused slots).
template<typename Values>
void validateOptionalIndexElements (const Values &values, std::size_t targetCount, std::string_view member, std::string_view target, ValidationReport &report)
 Report every non-sentinel element of values that is not a valid index into a targetCount-element target (see isNoIndex and the indexesOptional annotation); capped like validateIndexElements.
void validateCountMatches (std::size_t count, std::uint32_t scale, std::size_t targetCount, std::string_view member, std::string_view target, ValidationReport &report)
 Apply one member's countMatches contract against its resolved sibling count (see the annotation): engaged (non-empty) values only.
template<ClientVersion V, typename T>
void validateValue (const T &value, ValidationReport &report)
 Validate one value of any shape: a versioned entity (gated by its OWN version), a plain record (gated by the enclosing V), or a sequence of either (walked element-wise, paths subscripted).
template<ClientVersion V, typename T>
void validateMembers (const T &value, ValidationReport &report)
 Walk value's annotation-declared contracts, gating members by client version V and descending into everything with validation content.
template<VersionedEntity E>
void validateEntity (const E &entity, ValidationReport &report)
 Validate a whole entity — the engine behind every validate() method; see ChunkedFile::validate() for the contract.
template<std::size_t N>
consteval std::size_t indexOf (const std::array< ClientVersion, N > &versions, ClientVersion v)
template<template< ClientVersion > class E>
consteval ClientVersion nextCanonical (ClientVersion from, ClientVersion to)
 The next CANONICAL version on E's ladder walking from from toward to — the first range boundary crossed in that direction.

Variables

template<typename T>
constexpr bool IsVectorV = false
 Trait: is T a std::vector (an array-chunk member)?
template<typename U, typename A>
constexpr bool IsVectorV< std::vector< U, A > > = true

Function Documentation

◆ annotation()

◆ chunkError()

std::unexpected< Error > wowlib::formats::detail::chunkError ( ErrorCode code,
std::uint32_t fourcc,
std::size_t offset,
std::string_view what,
FourCCEndian endian = FourCCEndian::Reversed )
inline

Build a chunk-scoped error value.

Parameters
codethe error category.
fourccthe chunk id the error occurred in.
offsetthe chunk's byte offset in the buffer being read.
whatthe failure description.
endianhow the id is laid out on disk (matched members pass their declared layout; unknown-chunk paths default to reversed, the common case).
Returns
the error, ready to return from a Result function.

Definition at line 289 of file chunked_file.hpp.

References wowlib::formats::fourcc(), wowlib::formats::fourccToString(), wowlib::makeError(), and wowlib::formats::Reversed.

Referenced by readEntity(), and readValue().

◆ chunkMagicOf()

std::uint32_t wowlib::formats::detail::chunkMagicOf ( std::meta::info member)
consteval

The chunk() fourcc of member member, or 0 if it carries none.

Definition at line 248 of file chunked_file.hpp.

Referenced by chunkMemberIndex(), and writeOrder().

◆ chunkMemberIndex()

template<typename E>
std::int32_t wowlib::formats::detail::chunkMemberIndex ( std::uint32_t magic)
consteval

The flattened member index (a JournalEntry::member value) of the chunk member carrying magic, or -1 when no member does.

For entity code that builds journal entries by fourcc (resequencedJournal hooks).

Template Parameters
Ethe entity type.
Parameters
magicthe chunk id (see fourCc()).

Definition at line 630 of file chunked_file.hpp.

References chunkMagicOf(), chunkMemberIndex(), and membersOf().

Referenced by chunkMemberIndex(), wowlib::formats::wdl::detail::WDL< V >::oceanMaskTiles(), and wowlib::formats::wdl::detail::WDL< V >::resequencedJournal().

◆ collectMembers()

void wowlib::formats::detail::collectMembers ( std::meta::info type,
std::vector< std::meta::info > & out )
consteval

Collect type's non-static data members with its public bases flattened in FIRST (recursively, declaration order) — mirroring how welder flattens a non-welded base's members into the derived binding.

Lets a versioned entity carry its version-gated chunk members in conditionally-inherited trait bases (present only for the versions they belong to) while the serializer still sees them. Base bookkeeping members (ChunkExtras: journal/unknown/trailing) come along but carry no chunk() annotation, so every chunk loop skips them.

Parameters
typethe reflected class to walk.
outthe member list being built.

Definition at line 64 of file entity_reflect.hpp.

References collectMembers().

Referenced by collectMembers(), and membersOf().

◆ engaged()

template<typename M>
bool wowlib::formats::detail::engaged ( const M & value)

Is the member's chunk written when it never appeared in the journal?

Required chunks always write (clients ship size-0 required chunks); optional ones only when they hold data. A plain data-chunk member's engagement is not observable — it always writes, so optional plain data chunks must not be declared (single-record optional chunks like MDAL are modeled as vectors instead).

Parameters
valuethe member value.
Returns
whether the member holds observable data.

Definition at line 346 of file chunked_file.hpp.

References entityEngaged(), IsVectorV, and wowlib::formats::detail::RepeatedTraits< T >::Value.

Referenced by freshJournal().

◆ entityEngaged()

template<ChunkedEntity E>
bool wowlib::formats::detail::entityEngaged ( const E & entity)

Does a never-journaled nested entity hold anything worth a chunk?

An entity that came from a file has a journal; a fresh one engages once any of its container-shaped members (or nested entities) hold data. Plain data-chunk members do not engage a container by themselves — their content is not distinguishable from the default.

Parameters
entitythe nested entity.
Returns
whether writing it would emit observable content.

Definition at line 677 of file chunked_file.hpp.

References annotation(), entityEngaged(), IsVectorV, membersOf(), wowlib::formats::detail::RepeatedTraits< T >::Value, and versionActive().

Referenced by engaged(), entityEngaged(), and wowlib::formats::wdt::detail::WDT< V >::write().

◆ freshJournal()

template<ChunkedEntity E>
std::vector< JournalEntry > wowlib::formats::detail::freshJournal ( const E & entity)

The journal a FRESH write of entity would produce: one entry per engaged (or required) chunk member in canonical write order, repeated/ repeating members expanded to one entry per element, no unknown-chunk or trailing entries.

The starting point for a resequencedJournal hook, which reorders it (and re-appends the preserved unknown chunks) before handing it to writeEntity.

Parameters
entitythe entity to enumerate.
Returns
the canonical-order journal.

Definition at line 646 of file chunked_file.hpp.

References annotation(), engaged(), freshJournal(), membersOf(), wowlib::formats::detail::RepeatedTraits< T >::Value, versionActive(), and writeOrder().

Referenced by freshJournal(), and wowlib::formats::wdl::detail::WDL< V >::resequencedJournal().

◆ hasValidationAnnotation()

bool wowlib::formats::detail::hasValidationAnnotation ( std::meta::info member)
consteval

Whether member carries any validation annotation.

Definition at line 228 of file validation.hpp.

Referenced by hasValidationContent().

◆ hasValidationContent()

template<typename T>
bool wowlib::formats::detail::hasValidationContent ( )
consteval

Whether validating a T can produce anything — it declares a validateExtra hook, carries an annotated member, or (recursively) holds something that does.

Drives where the walk descends, so an entity pays no runtime cost for members with no contracts at all.

Trivially-copyable types stop the recursion: binary structs carry no annotations by policy (their contracts live in the enclosing entity's hook), and scalars have none to carry. Standard-library class types stop it too — their internals are not our records — but sequences are followed into their element type first, so std::vector<M2Bone> is walked while std::string is not.

Template Parameters
Tthe member or record type to classify.

Definition at line 258 of file validation.hpp.

References hasValidationAnnotation(), hasValidationContent(), isStdType(), and membersOf().

Referenced by hasValidationContent(), validateMembers(), and validateValue().

◆ indexOf()

template<std::size_t N>
std::size_t wowlib::formats::detail::indexOf ( const std::array< ClientVersion, N > & versions,
ClientVersion v )
consteval

◆ isNoIndex()

template<std::integral T>
bool wowlib::formats::detail::isNoIndex ( T value)
constexpr

Whether value is the client's "no reference" sentinel for an index element: negative in a signed lookup, all-ones in an unsigned one (the 0xFFFF an M2 lookup table leaves in unused slots).

Parameters
valuethe index element.
Returns
whether it references nothing.

Definition at line 315 of file validation.hpp.

Referenced by validateOptionalIndexElements(), and wowlib::formats::m2::detail::validateProfileAgainstRoot().

◆ isStdType()

template<typename T>
bool wowlib::formats::detail::isStdType ( )
consteval

Whether T is a standard-library type (see nestedInStd).

Template Parameters
Tthe type to classify.

Definition at line 115 of file entity_reflect.hpp.

References nestedInStd().

Referenced by hasValidationContent().

◆ memberNamed()

template<typename E>
std::meta::info wowlib::formats::detail::memberNamed ( std::string_view name)
consteval

The reflected member of E named name (public bases flattened, like membersOf), or the null reflection when no member carries the name — how the sibling-naming annotations (countMatches, indexes, offsetAfter) resolve their target at compile time, so a typo is a static_assert at the use site rather than a silent no-op.

Template Parameters
Ethe entity type.
Parameters
namethe member identifier to find.
Returns
the reflected member, or std::meta::info{}.

Definition at line 91 of file entity_reflect.hpp.

References membersOf().

Referenced by wowlib::formats::wmo::detail::WMO< V >::validate(), and validateMembers().

◆ membersOf()

◆ nestedInStd()

bool wowlib::formats::detail::nestedInStd ( std::meta::info r)
consteval

Whether r is declared inside namespace std (at any nesting depth — libstdc++ hides types in inline namespaces like std::__cxx11).

The validation walker stops there: standard-library internals are not our records, and reflecting into them would walk implementation details.

Parameters
rthe reflected entity (typically a type).
Returns
whether std encloses it.

Definition at line 103 of file entity_reflect.hpp.

Referenced by isStdType().

◆ nextCanonical()

template<template< ClientVersion > class E>
ClientVersion wowlib::formats::detail::nextCanonical ( ClientVersion from,
ClientVersion to )
consteval

The next CANONICAL version on E's ladder walking from from toward to — the first range boundary crossed in that direction.

Precondition
from and to are grid versions with different canonicals.

Definition at line 71 of file convert.hpp.

References wowlib::formats::canonicalVersion(), indexOf(), wowlib::formats::SupportedVersions, and wowlib::formats::VersionPivots.

Referenced by wowlib::formats::convert(), and wowlib::formats::hasConvertPath().

◆ readEntity()

template<ChunkedEntity E>
Result< void > wowlib::formats::detail::readEntity ( E & entity,
std::span< const std::byte > data )

Deserialize data into entity — the engine behind ChunkedFile::read(); see that method for the full contract.

Parameters
entitythe destination entity; overwritten member-by-member.
datathe file (or container-chunk payload) bytes.
Returns
nothing, or the first structural error (ChunkTruncated, ChunkSizeMismatch, ChunkMissing).

Definition at line 396 of file chunked_file.hpp.

References annotation(), chunkError(), wowlib::ChunkMissing, wowlib::ChunkTruncated, wowlib::formats::fourcc(), wowlib::formats::fourccToString(), IsVectorV, wowlib::makeError(), membersOf(), readValue(), unknownFourccEndian(), wowlib::formats::detail::RepeatedTraits< T >::Value, and versionActive().

Referenced by wowlib::formats::ChunkedFile< Derived >::read(), and readValue().

◆ readValue()

template<typename M>
Result< void > wowlib::formats::detail::readValue ( M & dst,
std::span< const std::byte > payload,
std::uint32_t fourcc,
std::size_t offset,
FourCCEndian endian )

Read one chunk payload into member dst, dispatching on the member kind (nested entity, self-serializing, array, raw binary struct).

Parameters
dstthe destination member.
payloadthe chunk payload bytes.
fourccthe chunk id (for diagnostics).
offsetthe chunk's byte offset (for diagnostics).
endianthe chunk id's disk layout (for diagnostics).
Returns
nothing, or the structural error.

Definition at line 694 of file chunked_file.hpp.

References chunkError(), wowlib::ChunkSizeMismatch, wowlib::formats::fourcc(), IsVectorV, readEntity(), and readValue().

Referenced by wowlib::formats::adt::detail::ADT< V >::parseFile(), readEntity(), wowlib::formats::adt::detail::MapChunk< V >::readFrom(), and readValue().

◆ unknownFourccEndian()

template<typename E>
FourCCEndian wowlib::formats::detail::unknownFourccEndian ( )
consteval

The id layout to display for chunks the entity has no spec for (garbage magics, unknown chunks): the entity's declared UnknownFourccEndian when present (the forward-magic M2 file family), else the reversed common case.

Template Parameters
Ethe chunked entity.

Definition at line 304 of file chunked_file.hpp.

References wowlib::formats::Reversed.

Referenced by readEntity().

◆ validateCountMatches()

void wowlib::formats::detail::validateCountMatches ( std::size_t count,
std::uint32_t scale,
std::size_t targetCount,
std::string_view member,
std::string_view target,
ValidationReport & report )
inline

Apply one member's countMatches contract against its resolved sibling count (see the annotation): engaged (non-empty) values only.

Parameters
countthe member's element count.
scalethe annotation's scale factor.
targetCountthe sibling's element count.
memberthe checked member's path (for the findings).
targetthe sibling's name (for the findings).
reportthe report findings land in.

Definition at line 363 of file validation.hpp.

References wowlib::formats::ValidationReport::addError().

Referenced by validateMembers().

◆ validateEntity()

template<VersionedEntity E>
void wowlib::formats::detail::validateEntity ( const E & entity,
ValidationReport & report )

Validate a whole entity — the engine behind every validate() method; see ChunkedFile::validate() for the contract.

Parameters
entitythe entity to check.
reportthe report findings land in.

Definition at line 568 of file validation.hpp.

References validateValue().

Referenced by wowlib::formats::adt::detail::ADT< V >::validate(), wowlib::formats::ChunkedFile< Derived >::validate(), wowlib::formats::m2::detail::M2< V >::validate(), wowlib::formats::m2::M2OffsetBlock< Derived >::validate(), wowlib::formats::wdt::detail::WDT< V >::validate(), and wowlib::formats::wmo::detail::WMO< V >::validate().

◆ validateIndexElements()

template<typename Values>
void wowlib::formats::detail::validateIndexElements ( const Values & values,
std::size_t targetCount,
std::string_view member,
std::string_view target,
ValidationReport & report )

Report every element of values that is not a valid index into a targetCount-element target, capped so a corrupt file cannot flood the report.

Parameters
valuesthe index elements to check.
targetCountthe indexed member's element count.
memberthe checked member's path (for the findings).
targetthe indexed member's name (for the findings).
reportthe report findings land in.

Definition at line 288 of file validation.hpp.

References wowlib::formats::ValidationReport::addError().

Referenced by wowlib::formats::adt::detail::ADT< V >::validate(), wowlib::formats::wmo::detail::WMO< V >::validate(), wowlib::formats::wmo::group::detail::WMOGroupBody< canonicalVersion(V, WmoGroupPivots, WmoVersions)>::validateExtra(), validateMembers(), and wowlib::formats::m2::detail::validateProfileAgainstRoot().

◆ validateMembers()

template<ClientVersion V, typename T>
void wowlib::formats::detail::validateMembers ( const T & value,
ValidationReport & report )

Walk value's annotation-declared contracts, gating members by client version V and descending into everything with validation content.

The caller adds the validateExtra hook (see validateValue).

Template Parameters
Vthe governing client version — the enclosing entity's, so records inherit the version gating of the file they sit in.
Parameters
valuethe entity or record to check.
reportthe report findings land in.

Definition at line 391 of file validation.hpp.

References wowlib::formats::ValidationReport::addError(), annotation(), wowlib::formats::ValidationReport::full(), hasValidationContent(), IsVectorV, memberNamed(), membersOf(), validateCountMatches(), validateIndexElements(), validateOptionalIndexElements(), validateValue(), and versionActive().

Referenced by validateValue().

◆ validateOptionalIndexElements()

template<typename Values>
void wowlib::formats::detail::validateOptionalIndexElements ( const Values & values,
std::size_t targetCount,
std::string_view member,
std::string_view target,
ValidationReport & report )

Report every non-sentinel element of values that is not a valid index into a targetCount-element target (see isNoIndex and the indexesOptional annotation); capped like validateIndexElements.

Parameters
valuesthe index elements to check.
targetCountthe indexed member's element count.
memberthe checked member's path (for the findings).
targetthe indexed member's name (for the findings).
reportthe report findings land in.

Definition at line 331 of file validation.hpp.

References wowlib::formats::ValidationReport::addError(), and isNoIndex().

Referenced by wowlib::formats::m2::detail::M2< V >::validate(), and validateMembers().

◆ validateValue()

template<ClientVersion V, typename T>
void wowlib::formats::detail::validateValue ( const T & value,
ValidationReport & report )

Validate one value of any shape: a versioned entity (gated by its OWN version), a plain record (gated by the enclosing V), or a sequence of either (walked element-wise, paths subscripted).

Types with no validation content cost nothing — the walk is compiled out.

Template Parameters
Vthe enclosing entity's client version.
Parameters
valuethe value to check.
reportthe report findings land in.

Definition at line 541 of file validation.hpp.

References wowlib::formats::ValidationReport::full(), hasValidationContent(), validateMembers(), and validateValue().

Referenced by validateEntity(), validateMembers(), and validateValue().

◆ versionActive()

template<ClientVersion V, std::meta::info M>
bool wowlib::formats::detail::versionActive ( )
consteval

Whether member M participates for entity version V, per its since/until annotations (absent bounds mean unbounded).

Template Parameters
Vthe entity's client version.
Mthe reflected member.

Definition at line 43 of file entity_reflect.hpp.

References annotation().

Referenced by wowlib::formats::m2::M2OffsetBlock< Derived >::_readMembers(), wowlib::formats::m2::M2OffsetBlock< Derived >::_writeMembers(), entityEngaged(), freshJournal(), wowlib::formats::m2::M2OffsetBlock< Derived >::imageSize(), wowlib::formats::m2::layoutSize(), wowlib::formats::m2::M2OffsetBlock< Derived >::memberOffset(), readEntity(), validateMembers(), and writeEntity().

◆ writeEntity()

template<ChunkedEntity E>
Result< void > wowlib::formats::detail::writeEntity ( const E & entity,
FileBuffer & out )

Serialize entity, appending to out — the engine behind ChunkedFile::write(); see that method for the full contract.

Parameters
entitythe entity to serialize.
outthe destination buffer (appended, not cleared).
Returns
nothing, or the first error.

Definition at line 499 of file chunked_file.hpp.

References annotation(), wowlib::formats::detail::ChunkWriter::append(), wowlib::formats::detail::ChunkWriter::beginChunk(), wowlib::ChunkSizeMismatch, wowlib::formats::detail::ChunkWriter::endChunk(), wowlib::formats::fourccToString(), wowlib::makeError(), membersOf(), wowlib::formats::detail::RepeatedTraits< T >::Value, versionActive(), and writeValue().

Referenced by wowlib::formats::ChunkedFile< Derived >::write(), and writeValue().

◆ writeOrder()

template<typename E>
auto wowlib::formats::detail::writeOrder ( )
consteval

The member indices (into membersOf<E>) in the order fresh entities emit their chunks.

When E declares a canonical ChunkOrder (a static array of fourccs — needed once an entity's chunk members are scattered across conditionally-inherited trait bases, whose flatten order is by-trait, not canonical), the chunk members follow it; otherwise members keep their declaration/flatten order. A ChunkOrder must list every chunk member exactly once (asserted).

Definition at line 261 of file chunked_file.hpp.

References chunkMagicOf(), and membersOf().

Referenced by freshJournal().

◆ writeValue()

template<typename M>
Result< void > wowlib::formats::detail::writeValue ( const M & src,
FileBuffer & out )

Append member src's chunk payload to out (payload only — the caller emits the chunk header).

Parameters
srcthe member to serialize.
outthe destination buffer.
Returns
nothing, or the first nested error.

Definition at line 728 of file chunked_file.hpp.

References wowlib::formats::detail::ChunkWriter::append(), IsVectorV, writeEntity(), and writeValue().

Referenced by writeEntity(), wowlib::formats::adt::detail::ADT< V >::writeFile(), wowlib::formats::adt::detail::MapChunk< V >::writeTo(), and writeValue().

Variable Documentation

◆ IsVectorV

template<typename T>
bool wowlib::formats::detail::IsVectorV = false
inlineconstexpr

Trait: is T a std::vector (an array-chunk member)?

Definition at line 51 of file entity_reflect.hpp.

Referenced by engaged(), entityEngaged(), readEntity(), readValue(), validateMembers(), and writeValue().

◆ IsVectorV< std::vector< U, A > >

template<typename U, typename A>
bool wowlib::formats::detail::IsVectorV< std::vector< U, A > > = true
inlineconstexpr

Definition at line 53 of file entity_reflect.hpp.