2024-04-08 03:10:24 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ehs/Array.h"
|
|
|
|
#include "DbVar.h"
|
|
|
|
|
|
|
|
namespace ehs
|
|
|
|
{
|
|
|
|
class DbTable;
|
|
|
|
|
|
|
|
class DbObject
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
friend class DbTable;
|
2024-04-09 01:44:15 -07:00
|
|
|
friend class DbVar;
|
2024-04-08 03:10:24 -07:00
|
|
|
|
|
|
|
UInt_64 id;
|
|
|
|
DbTable* parent;
|
2024-04-09 01:44:15 -07:00
|
|
|
Array<DbVar> vars;
|
2024-04-08 03:10:24 -07:00
|
|
|
|
|
|
|
public:
|
|
|
|
DbObject();
|
|
|
|
|
2024-04-09 01:44:15 -07:00
|
|
|
DbObject(UInt_64 id);
|
|
|
|
|
2024-04-08 03:10:24 -07:00
|
|
|
DbObject(DbObject&& obj) noexcept;
|
|
|
|
|
|
|
|
DbObject(const DbObject& obj);
|
|
|
|
|
|
|
|
DbObject& operator=(DbObject&& obj) noexcept;
|
|
|
|
|
|
|
|
DbObject& operator=(const DbObject& obj);
|
|
|
|
|
2024-04-09 01:44:15 -07:00
|
|
|
UInt_64 GetId() const;
|
2024-04-08 03:10:24 -07:00
|
|
|
|
2024-04-09 01:44:15 -07:00
|
|
|
bool HasVariable(UInt_64 hashId) const;
|
2024-04-08 03:10:24 -07:00
|
|
|
|
|
|
|
DbVar* GetVariable(UInt_64 hashId) const;
|
|
|
|
|
2024-04-09 01:44:15 -07:00
|
|
|
void Save() const;
|
2024-04-08 03:10:24 -07:00
|
|
|
|
|
|
|
void Load();
|
|
|
|
|
|
|
|
bool IsLoaded() const;
|
|
|
|
|
|
|
|
void Free();
|
|
|
|
|
2024-04-09 01:44:15 -07:00
|
|
|
private:
|
|
|
|
void CreateVariable(DbVarTmpl* master);
|
2024-04-08 03:10:24 -07:00
|
|
|
};
|
|
|
|
}
|