|
wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
|
#include <wowlib/formats/common/string_block.hpp>
Classes | |
| struct | Entry |
| One decoded string and the blob byte offset other chunks reference it by. More... | |
Public Member Functions | |
| StringBlock ()=default | |
| Result< void > | read (std::span< const std::byte > payload) |
| Decode a chunk payload (the serializer's read hook): every run of non-zero bytes becomes an entry at its offset; zero bytes between runs are padding and are reproduced by write(). | |
| Result< void > | write (FileBuffer &out) const |
| Blobify (the serializer's write hook): append size() zero bytes to out, then lay each entry's characters down at its offset — the zero fill provides the terminators and the padding. | |
| std::string_view | at (std::uint32_t offset) const |
| The string at a byte offset another chunk stored; empty if the offset lands on padding or out of range. | |
| std::uint32_t | add (std::string_view string) |
| Append a string; existing offsets never move. | |
| const std::vector< Entry > & | entries () const |
| The decoded entries, in blob order. | |
| bool | empty () const |
| Whether the on-disk blob holds any bytes. | |
| std::size_t | size () const |
| The on-disk blob size in bytes, trailing padding included. | |
Definition at line 23 of file string_block.hpp.
|
default |
|
inline |
Append a string; existing offsets never move.
| string | the string to append (no embedded zero bytes) |
Definition at line 90 of file string_block.hpp.
|
inlinenodiscard |
The string at a byte offset another chunk stored; empty if the offset lands on padding or out of range.
| offset | byte offset into the on-disk blob |
Definition at line 76 of file string_block.hpp.
References wowlib::formats::StringBlock::Entry::offset, and wowlib::formats::StringBlock::Entry::value.
Referenced by wowlib::db::detail::decodeInlineRecord().
|
inlinenodiscard |
Whether the on-disk blob holds any bytes.
Definition at line 109 of file string_block.hpp.
|
inlinenodiscard |
The decoded entries, in blob order.
Definition at line 103 of file string_block.hpp.
|
inline |
Decode a chunk payload (the serializer's read hook): every run of non-zero bytes becomes an entry at its offset; zero bytes between runs are padding and are reproduced by write().
| payload | the chunk payload bytes. |
Definition at line 41 of file string_block.hpp.
Referenced by wowlib::db::readWdb2(), and wowlib::db::readWdbc().
|
inline |
The on-disk blob size in bytes, trailing padding included.
Definition at line 114 of file string_block.hpp.
Referenced by wowlib::db::writeWdb2(), and wowlib::db::writeWdbc().
|
inline |
Blobify (the serializer's write hook): append size() zero bytes to out, then lay each entry's characters down at its offset — the zero fill provides the terminators and the padding.
| out | the destination buffer (appended, not cleared). |
Definition at line 63 of file string_block.hpp.
Referenced by wowlib::db::writeWdb2(), and wowlib::db::writeWdbc().