WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
WoWDatabase.h
Go to the documentation of this file.
1#pragma once
2
3#include "GameDatabase.h"
4
5#include <memory>
6#include <string>
7#include <unordered_map>
8
9class GameFile;
10class DB2Table;
11
12namespace wow
13{
15 {
16 public:
18 {
19 }
20
21 unsigned int hash;
22 };
23
25 {
26 public:
28 {
29 }
30
31 int pos;
34 };
35
38 {
39 public:
41 ~WoWDatabase() override;
42
43 // Direct DB2 table access (lazy-loaded, on-demand like wow.export).
44 // Returns nullptr if the table cannot be loaded.
45 const DB2Table* getTable(const std::string& name);
46
49
52 core::FieldStructure*) override;
53 void setFieldPos(core::FieldStructure*, int pos) override;
54 std::string getLayoutHashForTable(const std::string& tableName) override;
55
56 private:
57 std::unique_ptr<DB2Table> buildDB2Table(const std::string& tableName);
58
59 std::unordered_map<std::string, std::unique_ptr<DB2Table>> m_tables;
60 };
61}
62
63// Convenience macro: access the WoWDatabase instance.
64// Requires Game.h to be included for the GAMEDATABASE macro.
65#define WOWDB static_cast<wow::WoWDatabase&>(GAMEDATABASE)
Provides typed, field-name-based access to records in a WDC DB2 file.
Definition DB2Table.h:50
Abstract base class representing a file within the game data archive.
Definition GameFile.h:12
Describes a single field (column) in a database table.
Describes the schema of a database table (name, file path, fields).
unsigned int hash
Definition WoWDatabase.h:21
WoW-specific database that lazy-loads DB2 tables from the CASC archive.
Definition WoWDatabase.h:38
std::string getLayoutHashForTable(const std::string &tableName) override
void setFieldPos(core::FieldStructure *, int pos) override
core::FieldStructure * createFieldStructure()
void readSpecificFieldAttributesFromDBD(const core::DBDVersionField &, const core::DBDColumnDef &, core::FieldStructure *) override
const DB2Table * getTable(const std::string &name)
void readSpecificTableAttributesFromDBD(const core::DBDVersionDef &, core::TableStructure *) override
std::unordered_map< std::string, std::unique_ptr< DB2Table > > m_tables
Definition WoWDatabase.h:59
~WoWDatabase() override
std::unique_ptr< DB2Table > buildDB2Table(const std::string &tableName)
core::TableStructure * createTableStructure()