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

Append-only chunk emission with size backpatching. More...

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

Public Member Functions

 ChunkWriter (FileBuffer &out)
std::size_t beginChunk (std::uint32_t fourcc)
 Emit a chunk header with a placeholder size.
void endChunk (std::size_t sizeAt)
 Backpatch the size of the chunk opened at sizeAt with the byte count appended since.
void append (const void *bytes, std::size_t n)
 Append n raw bytes from bytes.

Detailed Description

Append-only chunk emission with size backpatching.

Definition at line 353 of file chunked_file.hpp.

Constructor & Destructor Documentation

◆ ChunkWriter()

wowlib::formats::detail::ChunkWriter::ChunkWriter ( FileBuffer & out)
inlineexplicit
Parameters
outthe buffer every emission appends to.

Definition at line 356 of file chunked_file.hpp.

Member Function Documentation

◆ append()

void wowlib::formats::detail::ChunkWriter::append ( const void * bytes,
std::size_t n )
inline

Append n raw bytes from bytes.

Parameters
bytesthe source.
nthe byte count.

Definition at line 380 of file chunked_file.hpp.

Referenced by beginChunk(), wowlib::formats::detail::writeEntity(), and wowlib::formats::detail::writeValue().

◆ beginChunk()

std::size_t wowlib::formats::detail::ChunkWriter::beginChunk ( std::uint32_t fourcc)
inline

Emit a chunk header with a placeholder size.

Parameters
fourccthe chunk id, in disk layout.
Returns
the placeholder's buffer position, for endChunk().

Definition at line 361 of file chunked_file.hpp.

References append(), and wowlib::formats::fourcc().

Referenced by wowlib::formats::detail::writeEntity().

◆ endChunk()

void wowlib::formats::detail::ChunkWriter::endChunk ( std::size_t sizeAt)
inline

Backpatch the size of the chunk opened at sizeAt with the byte count appended since.

Parameters
sizeAtthe value beginChunk() returned.

Definition at line 372 of file chunked_file.hpp.

Referenced by wowlib::formats::detail::writeEntity().


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