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

A writable string block resolving values to byte-perfect offsets: the journaled original offset while the value still matches, else an equal existing entry, else a fresh append. More...

#include <wowlib/db/codec_detail.hpp>

Public Member Functions

 StringPool (const formats::StringBlock &source)
 Copy source (leading with the mandatory zero byte) and index it.
std::uint32_t resolve (std::string_view value, const std::vector< std::uint32_t > &journal, std::size_t &cursor)
 The offset to store for value: journal[cursor] when it still holds value, else a deduped/appended offset.

Public Attributes

formats::StringBlock block
std::unordered_map< std::string, std::uint32_t > lookup

Detailed Description

A writable string block resolving values to byte-perfect offsets: the journaled original offset while the value still matches, else an equal existing entry, else a fresh append.

Definition at line 33 of file codec_detail.hpp.

Constructor & Destructor Documentation

◆ StringPool()

wowlib::db::detail::StringPool::StringPool ( const formats::StringBlock & source)
explicit

Copy source (leading with the mandatory zero byte) and index it.

Definition at line 43 of file codec_common.cpp.

References block, and lookup.

Member Function Documentation

◆ resolve()

std::uint32_t wowlib::db::detail::StringPool::resolve ( std::string_view value,
const std::vector< std::uint32_t > & journal,
std::size_t & cursor )

The offset to store for value: journal[cursor] when it still holds value, else a deduped/appended offset.

cursor advances one slot.

Definition at line 49 of file codec_common.cpp.

References block, and lookup.

Referenced by wowlib::db::detail::encodeInlineRecord().

Member Data Documentation

◆ block

formats::StringBlock wowlib::db::detail::StringPool::block

Definition at line 34 of file codec_detail.hpp.

Referenced by resolve(), StringPool(), wowlib::db::writeWdb2(), and wowlib::db::writeWdbc().

◆ lookup

std::unordered_map<std::string, std::uint32_t> wowlib::db::detail::StringPool::lookup

Definition at line 35 of file codec_detail.hpp.

Referenced by resolve(), and StringPool().


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