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

#include <wowlib/formats/common/validation.hpp>

Public Member Functions

void add (ValidationSeverity severity, std::string path, std::string message)
 Record a finding, unless the report is already full().
bool full () const
bool truncated () const
 Whether findings were dropped because the report hit its size cap.
void addError (std::string path, std::string message)
 Record an error finding (see add()).
void addWarning (std::string path, std::string message)
 Record a warning finding (see add()).
bool ok () const
 Whether the entity is fit to write: no error-severity findings (warnings do not fail a report).
std::size_t errorCount () const
 The number of error-severity findings.

Static Public Attributes

static constexpr std::size_t MaxFindings = 1000
 The most findings one report holds.

Detailed Description

Definition at line 57 of file validation.hpp.

Member Function Documentation

◆ add()

void wowlib::formats::ValidationReport::add ( ValidationSeverity severity,
std::string path,
std::string message )
inline

Record a finding, unless the report is already full().

Parameters
severitythe finding's severity.
pathmember path from the validated entity ("" for entity-level findings; nesting walkers prefix it).
messagewhat is wrong, with the numbers involved.

Definition at line 70 of file validation.hpp.

References full().

Referenced by addError(), addWarning(), and wowlib::formats::wmo::group::detail::WMOGroupBody< canonicalVersion(V, WmoGroupPivots, WmoVersions)>::validateExtra().

◆ addError()

◆ addWarning()

void wowlib::formats::ValidationReport::addWarning ( std::string path,
std::string message )
inline

◆ errorCount()

std::size_t wowlib::formats::ValidationReport::errorCount ( ) const
inlinenodiscard

The number of error-severity findings.

Definition at line 111 of file validation.hpp.

References wowlib::formats::Error, and wowlib::formats::ValidationIssue::severity.

◆ full()

bool wowlib::formats::ValidationReport::full ( ) const
inlinenodiscard

◆ ok()

bool wowlib::formats::ValidationReport::ok ( ) const
inlinenodiscard

Whether the entity is fit to write: no error-severity findings (warnings do not fail a report).

Definition at line 103 of file validation.hpp.

References wowlib::formats::Error, and wowlib::formats::ValidationIssue::severity.

◆ truncated()

bool wowlib::formats::ValidationReport::truncated ( ) const
inlinenodiscard

Whether findings were dropped because the report hit its size cap.

Definition at line 85 of file validation.hpp.

Member Data Documentation

◆ MaxFindings

std::size_t wowlib::formats::ValidationReport::MaxFindings = 1000
staticconstexpr

The most findings one report holds.

A walk over a corrupt file can violate a contract per element of a million-element array; past this many the report stops growing and records that it was truncated, so validating never becomes the memory problem.

Definition at line 63 of file validation.hpp.

Referenced by full().


The documentation for this class was generated from the following file: