2024-04-08 03:10:24 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ehs/Array.h"
|
|
|
|
#include "DbTable.h"
|
|
|
|
|
|
|
|
namespace ehs
|
|
|
|
{
|
2024-07-24 01:36:20 -07:00
|
|
|
class EHS_LIB_IO Database
|
2024-04-08 03:10:24 -07:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
UInt_64 hashId;
|
|
|
|
Str_8 id;
|
2024-04-09 01:44:15 -07:00
|
|
|
Version version;
|
2024-04-08 03:10:24 -07:00
|
|
|
Array<DbTable> tables;
|
2024-04-23 22:29:49 -07:00
|
|
|
Str_8 dir;
|
2024-04-08 03:10:24 -07:00
|
|
|
|
|
|
|
public:
|
|
|
|
Database();
|
|
|
|
|
2024-04-09 01:44:15 -07:00
|
|
|
Database(Str_8 id, const Version& version);
|
|
|
|
|
2024-04-23 22:29:49 -07:00
|
|
|
Database(Str_8 filePath);
|
2024-04-08 03:10:24 -07:00
|
|
|
|
2024-04-09 01:44:15 -07:00
|
|
|
Database(Database&& db) noexcept;
|
|
|
|
|
|
|
|
Database(const Database& db);
|
|
|
|
|
|
|
|
Database& operator=(Database&& db) noexcept;
|
|
|
|
|
|
|
|
Database& operator=(const Database& db);
|
|
|
|
|
2024-04-08 03:10:24 -07:00
|
|
|
UInt_64 GetHashId() const;
|
|
|
|
|
2024-04-09 01:44:15 -07:00
|
|
|
void SetId(Str_8 newId);
|
|
|
|
|
2024-04-08 03:10:24 -07:00
|
|
|
Str_8 GetId() const;
|
|
|
|
|
2024-04-09 01:44:15 -07:00
|
|
|
void SetVersion(const Version& newVersion);
|
|
|
|
|
|
|
|
Version GetVersion() const;
|
|
|
|
|
2024-04-08 03:10:24 -07:00
|
|
|
bool HasTable(UInt_64 hashId) const;
|
|
|
|
|
2024-04-09 01:44:15 -07:00
|
|
|
bool HasTable(const Str_8& id) const;
|
2024-04-08 03:10:24 -07:00
|
|
|
|
2024-04-09 01:44:15 -07:00
|
|
|
DbTable* CreateTable(Str_8 id);
|
2024-04-08 03:10:24 -07:00
|
|
|
|
|
|
|
DbTable* GetTable(UInt_64 hashId) const;
|
|
|
|
|
2024-04-09 01:44:15 -07:00
|
|
|
DbTable* GetTable(const Str_8& id) const;
|
2024-04-08 03:10:24 -07:00
|
|
|
|
2024-04-23 22:29:49 -07:00
|
|
|
Str_8 GetDirectory() const;
|
|
|
|
|
|
|
|
void Save(Str_8 directory);
|
2024-04-08 03:10:24 -07:00
|
|
|
};
|
|
|
|
}
|