wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wowlib::formats::ChunkedFile< Derived > Struct Template Reference

The serialization face of a chunked entity, mixed in CRTP-style: an entity struct E : ChunkedFile<E> carries the ChunkExtras bookkeeping and gains the read()/write() methods every file representation shares. More...

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

Inheritance diagram for wowlib::formats::ChunkedFile< Derived >:

Public Member Functions

Result< void > read (std::span< const std::byte > data)
 Deserialize file bytes into this entity, replacing its contents.
Result< FileBuffer > write () const
 Serialize this entity.
ValidationReport validate () const
Result< void > ensureValid () const
 Validate and raise on the first error instead of returning a report — the assert-style face of validate().
bool operator== (const ChunkedFile &) const =default
Public Member Functions inherited from wowlib::formats::ChunkExtras
bool operator== (const ChunkExtras &) const =default

Additional Inherited Members

Public Attributes inherited from wowlib::formats::ChunkExtras
std::vector< JournalEntry > journal
std::vector< UnknownChunk > unknown
std::vector< std::byte > trailing

Detailed Description

template<typename Derived>
struct wowlib::formats::ChunkedFile< Derived >

The serialization face of a chunked entity, mixed in CRTP-style: an entity struct E : ChunkedFile<E> carries the ChunkExtras bookkeeping and gains the read()/write() methods every file representation shares.

Method definitions sit at the bottom of this header, past the serializer engine they drive.

Template Parameters
Derivedthe entity itself (the CRTP pattern).

Definition at line 89 of file chunked_file.hpp.

Member Function Documentation

◆ ensureValid()

template<typename Derived>
Result< void > wowlib::formats::ChunkedFile< Derived >::ensureValid ( ) const
nodiscard

Validate and raise on the first error instead of returning a report — the assert-style face of validate().

Returns
nothing; raises when validate() finds any error

Definition at line 764 of file chunked_file.hpp.

References ensureValid(), and validate().

Referenced by ensureValid().

◆ operator==()

template<typename Derived>
bool wowlib::formats::ChunkedFile< Derived >::operator== ( const ChunkedFile< Derived > & ) const
default

◆ read()

template<typename Derived>
Result< void > wowlib::formats::ChunkedFile< Derived >::read ( std::span< const std::byte > data)

Deserialize file bytes into this entity, replacing its contents.

Unmodeled chunks are preserved so an unmodified entity rewrites byte-for-byte.

Parameters
datathe file bytes

Definition at line 745 of file chunked_file.hpp.

References read(), and wowlib::formats::detail::readEntity().

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

◆ validate()

template<typename Derived>
ValidationReport wowlib::formats::ChunkedFile< Derived >::validate ( ) const
nodiscard
Returns
every violated contract, in member order

Definition at line 757 of file chunked_file.hpp.

References validate(), and wowlib::formats::detail::validateEntity().

Referenced by ensureValid(), and validate().

◆ write()

template<typename Derived>
Result< FileBuffer > wowlib::formats::ChunkedFile< Derived >::write ( ) const
nodiscard

Serialize this entity.

Returns
the file bytes

Definition at line 750 of file chunked_file.hpp.

References write(), and wowlib::formats::detail::writeEntity().

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


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