wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wowlib::formats::Repeated< T, N > Class Template Reference

Storage for a chunk that may appear up to N times in one entity (MOTV texcoord sets, MOCV vertex-color layers). More...

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

Public Types

using value_type = T
 The per-occurrence payload type — spelled like a standard container's so the generic walkers (validation) treat slots as a sequence.

Public Member Functions

T * push ()
 Claim the next slot (the serializer's per-encounter hook).
std::size_t size () const
bool empty () const
bool full () const
void clear ()
 Reset to no filled slots; slot contents return to default-constructed.
T & operator[] (std::size_t i)
const T & operator[] (std::size_t i) const
T * begin ()
T * end ()
const T * begin () const
const T * end () const

Static Public Member Functions

static constexpr std::size_t capacity ()

Static Public Attributes

static constexpr bool ValidationSlots = true
 Each slot is a complete occurrence of the chunk, not one element of a larger array: a count contract holds per filled slot (see the validation walker's SlotSequence).

Detailed Description

template<typename T, std::size_t N>
class wowlib::formats::Repeated< T, N >

Storage for a chunk that may appear up to N times in one entity (MOTV texcoord sets, MOCV vertex-color layers).

Slots fill in encounter order.

Template Parameters
Tthe per-occurrence payload type.
Nthe maximum occurrence count (matches the member's repeats(N) annotation).

Definition at line 154 of file chunked_file.hpp.

Member Typedef Documentation

◆ value_type

template<typename T, std::size_t N>
using wowlib::formats::Repeated< T, N >::value_type = T

The per-occurrence payload type — spelled like a standard container's so the generic walkers (validation) treat slots as a sequence.

Definition at line 158 of file chunked_file.hpp.

Member Function Documentation

◆ begin() [1/2]

template<typename T, std::size_t N>
T * wowlib::formats::Repeated< T, N >::begin ( )
inlinenodiscard
Returns
the start of the filled slots (range-for support).

Definition at line 198 of file chunked_file.hpp.

◆ begin() [2/2]

template<typename T, std::size_t N>
const T * wowlib::formats::Repeated< T, N >::begin ( ) const
inlinenodiscard

Returns
the start of the filled slots (range-for support).

Definition at line 204 of file chunked_file.hpp.

◆ capacity()

template<typename T, std::size_t N>
constexpr std::size_t wowlib::formats::Repeated< T, N >::capacity ( )
inlinestaticnodiscardconstexpr
Returns
the slot capacity N.

Definition at line 188 of file chunked_file.hpp.

◆ clear()

template<typename T, std::size_t N>
void wowlib::formats::Repeated< T, N >::clear ( )
inline

Reset to no filled slots; slot contents return to default-constructed.

Definition at line 182 of file chunked_file.hpp.

◆ empty()

template<typename T, std::size_t N>
bool wowlib::formats::Repeated< T, N >::empty ( ) const
inlinenodiscard
Returns
whether no slot is filled.

Definition at line 176 of file chunked_file.hpp.

◆ end() [1/2]

template<typename T, std::size_t N>
T * wowlib::formats::Repeated< T, N >::end ( )
inlinenodiscard
Returns
past-the-end of the filled slots.

Definition at line 201 of file chunked_file.hpp.

◆ end() [2/2]

template<typename T, std::size_t N>
const T * wowlib::formats::Repeated< T, N >::end ( ) const
inlinenodiscard

Returns
past-the-end of the filled slots.

Definition at line 207 of file chunked_file.hpp.

◆ full()

template<typename T, std::size_t N>
bool wowlib::formats::Repeated< T, N >::full ( ) const
inlinenodiscard
Returns
whether every slot is filled.

Definition at line 179 of file chunked_file.hpp.

◆ operator[]() [1/2]

template<typename T, std::size_t N>
T & wowlib::formats::Repeated< T, N >::operator[] ( std::size_t i)
inlinenodiscard
Parameters
ia filled-slot index, < size().
Returns
the i-th filled slot.

Definition at line 192 of file chunked_file.hpp.

◆ operator[]() [2/2]

template<typename T, std::size_t N>
const T & wowlib::formats::Repeated< T, N >::operator[] ( std::size_t i) const
inlinenodiscard

Parameters
ia filled-slot index, < size().
Returns
the i-th filled slot.

Definition at line 195 of file chunked_file.hpp.

◆ push()

template<typename T, std::size_t N>
T * wowlib::formats::Repeated< T, N >::push ( )
inline

Claim the next slot (the serializer's per-encounter hook).

Returns
the slot to read into, or nullptr if all N are taken.

Definition at line 167 of file chunked_file.hpp.

◆ size()

template<typename T, std::size_t N>
std::size_t wowlib::formats::Repeated< T, N >::size ( ) const
inlinenodiscard
Returns
the number of filled slots.

Definition at line 173 of file chunked_file.hpp.

Member Data Documentation

◆ ValidationSlots

template<typename T, std::size_t N>
bool wowlib::formats::Repeated< T, N >::ValidationSlots = true
staticconstexpr

Each slot is a complete occurrence of the chunk, not one element of a larger array: a count contract holds per filled slot (see the validation walker's SlotSequence).

Definition at line 163 of file chunked_file.hpp.


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