EHS/include/ehs/db/DbObject.h

52 lines
744 B
C++

#pragma once
#include "ehs/Array.h"
#include "DbVar.h"
namespace ehs
{
class DbTable;
class EHS_LIB_IO DbObject
{
private:
friend class DbTable;
friend class DbVar;
UInt_64 id;
DbTable* parent;
Array<DbVar> vars;
public:
DbObject();
DbObject(UInt_64 id);
DbObject(DbObject&& obj) noexcept;
DbObject(const DbObject& obj);
DbObject& operator=(DbObject&& obj) noexcept;
DbObject& operator=(const DbObject& obj);
UInt_64 GetId() const;
bool HasVariable(UInt_64 hashId) const;
DbVar* GetVariable(UInt_64 hashId) const;
DbVar* GetVariable(const Str_8& id) const;
void Save() const;
void Load();
bool IsLoaded() const;
void Free();
private:
void CreateVariable(DbVarTmpl* master);
};
}