|
wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
|
The generic client-database table: schema resolved at runtime from the schema catalog, rows in a column store, format engine and preserved decode state inherited from TableBase (read/write/validate/strings/ encryptedSections all bind once, there). More...
#include <wowlib/db/dyn_table.hpp>
Public Member Functions | |
| DynTable ()=default | |
| An unwired table: every inherited operation reports InvalidEntityState until one is opened properly. | |
| DynTable (const DynTable &other) | |
| DynTable & | operator= (const DynTable &other) |
| DynTable (DynTable &&other) noexcept | |
| DynTable & | operator= (DynTable &&other) noexcept |
| ~DynTable ()=default | |
| std::size_t | rowCount () const |
| The number of rows. | |
| std::size_t | columnCount () const |
| The number of schema columns. | |
| std::span< const Column > | schema () const |
| ClientVersion | version () const |
| The client version the table serializes for. | |
| std::string_view | name () const |
| The table name (WoWDBDefs identifier). | |
| Result< Column > | columnInfo (std::size_t column) const |
| Column column's schema entry, by value (the welded metadata face of schema). | |
| Result< std::size_t > | columnIndex (std::string_view name) const |
| The index of column name. | |
| std::size_t | appendRow () |
| Append a fresh zero/empty row. | |
| Result< void > | eraseRow (std::size_t row) |
| Remove row row. | |
| void | clearRows () |
| Drop every row (schema and preserved decode state stay). | |
| Result< std::size_t > | findById (std::uint32_t id) const |
| The first row whose $id$ equals id. | |
| Result< std::int64_t > | getInt (std::size_t row, std::size_t column, std::size_t element=0) const |
| Read an integer element. | |
| Result< void > | setInt (std::size_t row, std::size_t column, std::int64_t value, std::size_t element=0) |
| Write an integer element (truncates to the column's exact width, as the typed member assignment did). | |
| Result< float > | getFloat (std::size_t row, std::size_t column, std::size_t element=0) const |
| Read a float element. | |
| Result< void > | setFloat (std::size_t row, std::size_t column, float value, std::size_t element=0) |
| Write a float element. | |
| Result< std::string_view > | getString (std::size_t row, std::size_t column, std::size_t element=0) const |
| Read a string element (String columns: the array element; LocString columns: the locale slot). | |
| Result< void > | setString (std::size_t row, std::size_t column, std::string_view value, std::size_t element=0) |
| Write a string element. | |
| Result< std::uint32_t > | locstringFlags (std::size_t row, std::size_t column) const |
| Read a LocString column's flags word. | |
| Result< void > | setLocstringFlags (std::size_t row, std::size_t column, std::uint32_t flags) |
| Write a LocString column's flags word. | |
| Result< PodColumnView > | podColumn (std::size_t column) const |
| The zero-copy view of numeric/float column column. | |
| Public Member Functions inherited from wowlib::db::TableBase | |
| Result< void > | read (std::span< const std::byte > data) |
| Decode a table file image. | |
| Result< void > | read (fs::FileSystem &fs, const FileKey &key) |
| Load the table from a client filesystem. | |
| Result< FileBuffer > | write (EncryptedPolicy policy=EncryptedPolicy::Preserve) const |
| Serialize the table to a file image; a loaded table re-emits the format it was read from. | |
| Result< void > | write (fs::FileSystem &fs, const FileKey &key, EncryptedPolicy policy=EncryptedPolicy::Preserve) const |
| Serialize the table into a client filesystem (project overlay); the target path's extension picks .dbc/.db2 in the mixed eras. | |
| const formats::StringBlock & | strings () const |
| The preserved string block the record string fields were decoded from; offsets never move, write() appends new strings past its end. | |
| const std::vector< EncryptedSection > & | encryptedSections () const |
| The encrypted sections skipped on read: their records are not in records, but the file re-writes them verbatim. | |
| bool | fullyDecoded () const |
| Whether the whole table decoded — false when encrypted sections were skipped. | |
| formats::ValidationReport | validate () const |
| Result< void > | ensureValid () const |
| Validate and raise on the first error instead of returning a report — the assert-style face of validate(). | |
| const TableCore & | core () const |
| The erased engine (bindings build live record views off it). | |
Static Public Member Functions | |
| static DynTable | fromSchema (const TableSchema &schema, ClientVersion version) |
| Open a table over an explicitly resolved schema — the caller guarantees the schema's backing catalog outlives the table (the embedded catalog does so trivially; a runtime-loaded one is the caller's to keep). | |
Additional Inherited Members | |
| Protected Attributes inherited from wowlib::db::TableBase | |
| TableCore | _core |
The generic client-database table: schema resolved at runtime from the schema catalog, rows in a column store, format engine and preserved decode state inherited from TableBase (read/write/validate/strings/ encryptedSections all bind once, there).
Copy/move re-wire the inherited core at the new storage — the same contract every generated table honored.
Definition at line 147 of file dyn_table.hpp.
|
default |
An unwired table: every inherited operation reports InvalidEntityState until one is opened properly.
References DynTable(), schema(), and version().
Referenced by DynTable(), DynTable(), DynTable(), fromSchema(), operator=(), and operator=().
| wowlib::db::DynTable::DynTable | ( | const DynTable & | other | ) |
Definition at line 331 of file dyn_table.cpp.
References DynTable().
|
noexcept |
Definition at line 347 of file dyn_table.cpp.
References DynTable().
|
default |
|
inline |
Append a fresh zero/empty row.
Definition at line 229 of file dyn_table.hpp.
|
inline |
Drop every row (schema and preserved decode state stay).
Drop every row (the schema and preserved decode state stay).
Definition at line 242 of file dyn_table.hpp.
|
inline |
The number of schema columns.
Definition at line 189 of file dyn_table.hpp.
| Result< std::size_t > wowlib::db::DynTable::columnIndex | ( | std::string_view | name | ) | const |
The index of column name.
| name | the column name — the canonical snake_case spelling ("map_name") or the verbatim WoWDBDefs spelling ("MapName_lang") as an alias; case-sensitive either way. |
| name | the column name, case-sensitive |
Definition at line 375 of file dyn_table.cpp.
References wowlib::makeError(), name(), schema(), and wowlib::TableUnknown.
Column column's schema entry, by value (the welded metadata face of schema).
| column | the column index. |
| column | the column index |
Definition at line 367 of file dyn_table.cpp.
References wowlib::makeError(), wowlib::OffsetOutOfBounds, and schema().
| Result< void > wowlib::db::DynTable::eraseRow | ( | std::size_t | row | ) |
Remove row row.
| row | the row index. |
| row | the row index |
Definition at line 387 of file dyn_table.cpp.
References wowlib::makeError(), and wowlib::OffsetOutOfBounds.
| Result< std::size_t > wowlib::db::DynTable::findById | ( | std::uint32_t | id | ) | const |
The first row whose $id$ equals id.
| id | the primary key value. |
| id | the primary key value |
Definition at line 395 of file dyn_table.cpp.
References wowlib::makeError(), and wowlib::TableUnknown.
|
static |
Open a table over an explicitly resolved schema — the caller guarantees the schema's backing catalog outlives the table (the embedded catalog does so trivially; a runtime-loaded one is the caller's to keep).
| schema | the resolved schema views. |
| version | the client version the table serializes for. |
Definition at line 321 of file dyn_table.cpp.
References DynTable(), schema(), and version().
| Result< float > wowlib::db::DynTable::getFloat | ( | std::size_t | row, |
| std::size_t | column, | ||
| std::size_t | element = 0 ) const |
Read a float element.
Read a float cell.
| row | the row index |
| column | a Float column's index |
| element | the array element |
Definition at line 437 of file dyn_table.cpp.
References wowlib::db::Float.
| Result< std::int64_t > wowlib::db::DynTable::getInt | ( | std::size_t | row, |
| std::size_t | column, | ||
| std::size_t | element = 0 ) const |
Read an integer element.
LocString columns answer their FLAGS word through locstringFlags, not here.
| row | the row index. |
| column | an Int column's index. |
| element | the array element (0 for scalars). |
| row | the row index |
| column | an Int column's index |
| element | the array element |
Definition at line 425 of file dyn_table.cpp.
References wowlib::db::Int.
| Result< std::string_view > wowlib::db::DynTable::getString | ( | std::size_t | row, |
| std::size_t | column, | ||
| std::size_t | element = 0 ) const |
Read a string element (String columns: the array element; LocString columns: the locale slot).
The view is valid until the cell mutates.
| row | the row index. |
| column | a String/LocString column's index. |
| element | the array element / locale slot. Read a string cell (String columns: the array element; LocString columns: the locale slot). |
| row | the row index |
| column | a String/LocString column's index |
| element | the array element / locale slot |
Definition at line 452 of file dyn_table.cpp.
References wowlib::db::LocString, and wowlib::db::String.
| Result< std::uint32_t > wowlib::db::DynTable::locstringFlags | ( | std::size_t | row, |
| std::size_t | column ) const |
Read a LocString column's flags word.
Read a LocString column's flags word.
| row | the row index |
| column | a LocString column's index |
Definition at line 472 of file dyn_table.cpp.
References wowlib::db::LocString.
|
inline |
The table name (WoWDBDefs identifier).
Definition at line 200 of file dyn_table.hpp.
Referenced by columnIndex().
Definition at line 336 of file dyn_table.cpp.
References DynTable().
Definition at line 356 of file dyn_table.cpp.
References DynTable().
| Result< PodColumnView > wowlib::db::DynTable::podColumn | ( | std::size_t | column | ) | const |
The zero-copy view of numeric/float column column.
| column | the column index. |
Definition at line 484 of file dyn_table.cpp.
References wowlib::db::PodColumnView::bytes, wowlib::db::detail::ColumnRows::Facts::elemBytes, wowlib::db::PodColumnView::elemBytes, wowlib::db::PodColumnView::elemsPerRow, wowlib::db::Float, wowlib::db::Int, wowlib::db::PodColumnView::isFloat, wowlib::db::Column::isSigned, wowlib::db::PodColumnView::isSigned, wowlib::makeError(), wowlib::db::Column::nameView(), wowlib::OffsetOutOfBounds, wowlib::db::detail::ColumnRows::Facts::podSlots, schema(), wowlib::SchemaMismatch, and wowlib::db::Column::type.
|
inline |
|
inline |
Definition at line 192 of file dyn_table.hpp.
Referenced by columnIndex(), columnInfo(), DynTable(), fromSchema(), and podColumn().
| Result< void > wowlib::db::DynTable::setFloat | ( | std::size_t | row, |
| std::size_t | column, | ||
| float | value, | ||
| std::size_t | element = 0 ) |
Write a float element.
Write a float cell.
| row | the row index |
| column | a Float column's index |
| value | the value to store |
| element | the array element |
Definition at line 446 of file dyn_table.cpp.
References wowlib::db::Float.
| Result< void > wowlib::db::DynTable::setInt | ( | std::size_t | row, |
| std::size_t | column, | ||
| std::int64_t | value, | ||
| std::size_t | element = 0 ) |
Write an integer element (truncates to the column's exact width, as the typed member assignment did).
LocString columns answer their FLAGS word through locstringFlags, not here.
| row | the row index. |
| column | an Int column's index. |
| element | the array element (0 for scalars). |
| row | the row index |
| column | an Int column's index |
| element | the array element Write an integer cell (truncates to the column's exact width, exactly as the typed member assignment did). |
| row | the row index |
| column | an Int column's index |
| value | the value to store |
| element | the array element |
Definition at line 431 of file dyn_table.cpp.
References wowlib::db::Int.
| Result< void > wowlib::db::DynTable::setLocstringFlags | ( | std::size_t | row, |
| std::size_t | column, | ||
| std::uint32_t | flags ) |
Write a LocString column's flags word.
Write a LocString column's flags word.
| row | the row index |
| column | a LocString column's index |
| flags | the flags word |
Definition at line 478 of file dyn_table.cpp.
References wowlib::db::LocString.
| Result< void > wowlib::db::DynTable::setString | ( | std::size_t | row, |
| std::size_t | column, | ||
| std::string_view | value, | ||
| std::size_t | element = 0 ) |
Write a string element.
Write a string cell (String columns: the array element; LocString columns: the locale slot).
| row | the row index |
| column | a String/LocString column's index |
| value | the text to store |
| element | the array element / locale slot |
Definition at line 461 of file dyn_table.cpp.
References wowlib::db::LocString, and wowlib::db::String.
|
inline |
The client version the table serializes for.
Definition at line 196 of file dyn_table.hpp.
Referenced by DynTable(), and fromSchema().