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

Monotonic allocator for custom (non-Blizzard) FileDataIDs. More...

#include <wowlib/fs/fdid_allocator.hpp>

Public Member Functions

 FdidAllocator (FileDataID start=FileDataID{1 '000 '000 '000}, FileDataID max=FileDataID{0xFFFFFFFE})
Result< FileDataID > next ()
 Allocate the next id.
void noteExisting (FileDataID id)
 Bump the allocator past an id seen in a loaded listfile, so re-opening a project never re-hands-out an id already in use.
FileDataID peek () const
 The id the next successful call to next() would return.

Detailed Description

Monotonic allocator for custom (non-Blizzard) FileDataIDs.

Starts at a configurable point far above Blizzard's allocation (~6-7M as of 2026) so future official content never collides with project files. Pure and single-threaded by itself; the owning listfile provider serializes access under its exclusive lock.

Definition at line 20 of file fdid_allocator.hpp.

Constructor & Destructor Documentation

◆ FdidAllocator()

wowlib::fs::detail::FdidAllocator::FdidAllocator ( FileDataID start = FileDataID{1'000'000'000},
FileDataID max = FileDataID{0xFFFFFFFE} )
inlineexplicit
Parameters
startthe first id to hand out.
maxthe last usable id (inclusive); defaults to just below the u32 ceiling.

Definition at line 25 of file fdid_allocator.hpp.

Member Function Documentation

◆ next()

Result< FileDataID > wowlib::fs::detail::FdidAllocator::next ( )
inline

Allocate the next id.

Returns
the id, or FdidSpaceExhausted once max is passed.

Definition at line 30 of file fdid_allocator.hpp.

References wowlib::FdidSpaceExhausted, and wowlib::makeError().

◆ noteExisting()

void wowlib::fs::detail::FdidAllocator::noteExisting ( FileDataID id)
inline

Bump the allocator past an id seen in a loaded listfile, so re-opening a project never re-hands-out an id already in use.

Parameters
idan existing id (only ids inside the custom range move the cursor).

Definition at line 39 of file fdid_allocator.hpp.

Referenced by wowlib::fs::CsvListfile::load().

◆ peek()

FileDataID wowlib::fs::detail::FdidAllocator::peek ( ) const
inline

The id the next successful call to next() would return.

Returns
the upcoming id.

Definition at line 45 of file fdid_allocator.hpp.


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