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

Classes

class  FormatDrivers
 The per-format round-trip drivers behind Auditor::roundtrip. More...

Functions

RoundtripReport failed (std::string stage, std::string error)
 A failed outcome.
RoundtripReport skipped (std::string_view reason)
 A skipped outcome — ok, tagged with the reason.
RoundtripReport failWith (RoundtripReport &report, std::string stage, std::string error)
 Mark report failed in place and hand it back — keeps the unknown-chunk tally gathered before the failure.
std::optional< RoundtripReport > classifyRead (RoundtripReport &report, std::string stage, const Result< FileBuffer > &result)
 Classify a client-file read for the audit: content behind an unknown TACT key and zero-byte archive entries (classic-era clients ship thousands of empty placeholder files) cannot be round-tripped and are skips, not failures; other errors fail at stage.
void tallyUnknown (RoundtripReport &report, const formats::ChunkExtras &extras, formats::FourCCEndian endian=formats::FourCCEndian::Reversed)
 Append every unmodeled chunk of a parsed entity to the report's tally, one fourcc spelling per occurrence.
template<typename F>
RoundtripReport guarded (F &&f)
 Run one file's driver, converting any escaping exception into a failed outcome — one pathological file must not kill an hours-long sweep.
std::optional< std::string > firstDivergence (const FileBuffer &original, const FileBuffer &rewritten)
 The first byte divergence between an original and a rewrite, described by offset and sizes — the stability compare's diagnostic for offset formats (no chunk framing to locate the divergence in).
std::optional< std::string > firstDivergenceChunked (const FileBuffer &original, const FileBuffer &rewritten)
 The first byte divergence between an original chunk stream and its rewrite, located within the enclosing chunk — the byte-perfect guarantee's debugging lens (ported from the round-trip tests' requireIdentical).
template<typename F>
bool withVersion (const ClientVersion v, F &&f)
 Invoke f with the targeted release constant matching v as a compile-time template argument — the runtime-to-compile-time bridge of the version dispatch.
constexpr bool versionSupported (std::span< const ClientVersion > grid, const ClientVersion v)
 Whether a format's instantiation grid carries v — the per-format if constexpr guard of the version dispatch.
RoundtripReport unrecognizedVersion (const ClientVersion v)
 The dispatch-failure outcome for a version outside the targeted releases.

Function Documentation

◆ classifyRead()

std::optional< RoundtripReport > wowlib::audit::detail::classifyRead ( RoundtripReport & report,
std::string stage,
const Result< FileBuffer > & result )
inline

Classify a client-file read for the audit: content behind an unknown TACT key and zero-byte archive entries (classic-era clients ship thousands of empty placeholder files) cannot be round-tripped and are skips, not failures; other errors fail at stage.

Parameters
reportthe report under construction.
stagethe stage label for a genuine read failure.
resultthe filesystem read result.
Returns
the outcome to return early, or nullopt when the bytes are usable.

Definition at line 72 of file detail.hpp.

References wowlib::EncryptedContent, wowlib::audit::RoundtripReport::error, failWith(), and skipped().

◆ failed()

RoundtripReport wowlib::audit::detail::failed ( std::string stage,
std::string error )
inline

A failed outcome.

Parameters
stagewhich stage failed.
errorthe failure diagnostic.
Returns
the report.

Definition at line 34 of file detail.hpp.

References wowlib::audit::RoundtripReport::error, wowlib::audit::RoundtripReport::ok, and wowlib::audit::RoundtripReport::stage.

Referenced by guarded(), and unrecognizedVersion().

◆ failWith()

RoundtripReport wowlib::audit::detail::failWith ( RoundtripReport & report,
std::string stage,
std::string error )
inline

Mark report failed in place and hand it back — keeps the unknown-chunk tally gathered before the failure.

Parameters
reportthe report to mark.
stagewhich stage failed.
errorthe failure diagnostic.
Returns
report, moved.

Definition at line 57 of file detail.hpp.

References wowlib::audit::RoundtripReport::error, wowlib::audit::RoundtripReport::ok, and wowlib::audit::RoundtripReport::stage.

Referenced by classifyRead().

◆ firstDivergence()

std::optional< std::string > wowlib::audit::detail::firstDivergence ( const FileBuffer & original,
const FileBuffer & rewritten )
inline

The first byte divergence between an original and a rewrite, described by offset and sizes — the stability compare's diagnostic for offset formats (no chunk framing to locate the divergence in).

Parameters
originalthe reference bytes.
rewrittenthe bytes to compare.
Returns
the description, or nullopt when identical.

Definition at line 118 of file detail.hpp.

◆ firstDivergenceChunked()

std::optional< std::string > wowlib::audit::detail::firstDivergenceChunked ( const FileBuffer & original,
const FileBuffer & rewritten )
inline

The first byte divergence between an original chunk stream and its rewrite, located within the enclosing chunk — the byte-perfect guarantee's debugging lens (ported from the round-trip tests' requireIdentical).

Parameters
originalthe reference bytes.
rewrittenthe bytes to compare.
Returns
the description, or nullopt when identical.

Definition at line 134 of file detail.hpp.

References wowlib::formats::fourccToString().

◆ guarded()

template<typename F>
RoundtripReport wowlib::audit::detail::guarded ( F && f)

Run one file's driver, converting any escaping exception into a failed outcome — one pathological file must not kill an hours-long sweep.

Template Parameters
Fthe driver callable type (returns RoundtripReport).
Parameters
fthe driver call.
Returns
the driver's outcome, or failed{stage="exception"}.

Definition at line 100 of file detail.hpp.

References failed().

Referenced by wowlib::audit::detail::FormatDrivers::adt(), wowlib::audit::detail::FormatDrivers::blp(), wowlib::audit::detail::FormatDrivers::m2(), wowlib::audit::detail::FormatDrivers::wdl(), wowlib::audit::detail::FormatDrivers::wdt(), and wowlib::audit::detail::FormatDrivers::wmo().

◆ skipped()

RoundtripReport wowlib::audit::detail::skipped ( std::string_view reason)
inline

A skipped outcome — ok, tagged with the reason.

Parameters
reasonthe skip reason ("wmo-group", "unsupported-version", ...).
Returns
the report.

Definition at line 45 of file detail.hpp.

References wowlib::audit::RoundtripReport::stage.

Referenced by wowlib::audit::detail::FormatDrivers::adt(), classifyRead(), wowlib::audit::detail::FormatDrivers::m2(), wowlib::audit::Auditor::roundtrip(), wowlib::audit::detail::FormatDrivers::wdl(), wowlib::audit::detail::FormatDrivers::wdt(), and wowlib::audit::detail::FormatDrivers::wmo().

◆ tallyUnknown()

void wowlib::audit::detail::tallyUnknown ( RoundtripReport & report,
const formats::ChunkExtras & extras,
formats::FourCCEndian endian = formats::FourCCEndian::Reversed )
inline

Append every unmodeled chunk of a parsed entity to the report's tally, one fourcc spelling per occurrence.

Parameters
reportthe report accumulating the sweep.
extrasthe entity's chunk bookkeeping.

Definition at line 87 of file detail.hpp.

References wowlib::formats::UnknownChunk::fourcc, wowlib::formats::fourccToString(), wowlib::formats::Reversed, wowlib::formats::ChunkExtras::unknown, and wowlib::audit::RoundtripReport::unknownChunks.

◆ unrecognizedVersion()

RoundtripReport wowlib::audit::detail::unrecognizedVersion ( const ClientVersion v)
inline

◆ versionSupported()

bool wowlib::audit::detail::versionSupported ( std::span< const ClientVersion > grid,
const ClientVersion v )
constexpr

Whether a format's instantiation grid carries v — the per-format if constexpr guard of the version dispatch.

Parameters
gridthe format's *_versions array.
vthe version to look for.
Returns
true when the format instantiates for v.

Definition at line 193 of file detail.hpp.

Referenced by wowlib::audit::detail::FormatDrivers::adt(), wowlib::audit::detail::FormatDrivers::m2(), wowlib::audit::detail::FormatDrivers::wdl(), wowlib::audit::detail::FormatDrivers::wdt(), and wowlib::audit::detail::FormatDrivers::wmo().

◆ withVersion()

template<typename F>
bool wowlib::audit::detail::withVersion ( const ClientVersion v,
F && f )

Invoke f with the targeted release constant matching v as a compile-time template argument — the runtime-to-compile-time bridge of the version dispatch.

Template Parameters
Fa functor with a template <ClientVersion V> void operator()().
Parameters
vthe runtime client version.
fthe functor to invoke.
Returns
whether v matched a targeted release (f ran).

Definition at line 166 of file detail.hpp.

References wowlib::versions::Bfa, wowlib::versions::Cata, wowlib::versions::Dragonflight, wowlib::versions::Legion, wowlib::versions::Mop, wowlib::versions::Shadowlands, wowlib::versions::Tbc, wowlib::versions::Tww, wowlib::versions::Vanilla, wowlib::versions::Wod, and wowlib::versions::Wotlk.

Referenced by wowlib::audit::detail::FormatDrivers::adt(), wowlib::audit::detail::FormatDrivers::m2(), wowlib::audit::detail::FormatDrivers::wdl(), wowlib::audit::detail::FormatDrivers::wdt(), and wowlib::audit::detail::FormatDrivers::wmo().