EHS/include/ehs/db/DbObject.h

52 lines
744 B
C
Raw Normal View History

2024-04-08 03:10:24 -07:00
#pragma once
#include "ehs/Array.h"
#include "DbVar.h"
namespace ehs
{
class DbTable;
2024-07-24 01:36:20 -07:00
class EHS_LIB_IO DbObject
2024-04-08 03:10:24 -07:00
{
private:
friend class DbTable;
friend class DbVar;
2024-04-08 03:10:24 -07:00
UInt_64 id;
DbTable* parent;
Array<DbVar> vars;
2024-04-08 03:10:24 -07:00
public:
DbObject();
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);
UInt_64 GetId() const;
2024-04-08 03:10:24 -07:00
bool HasVariable(UInt_64 hashId) const;
2024-04-08 03:10:24 -07:00
DbVar* GetVariable(UInt_64 hashId) const;
DbVar* GetVariable(const Str_8& id) const;
void Save() const;
2024-04-08 03:10:24 -07:00
void Load();
bool IsLoaded() const;
void Free();
private:
void CreateVariable(DbVarTmpl* master);
2024-04-08 03:10:24 -07:00
};
}