EHS/include/ehs/db/DbObject.h

50 lines
687 B
C++

#pragma once
#include "ehs/Array.h"
#include "DbVar.h"
namespace ehs
{
class DbTable;
class 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;
void Save() const;
void Load();
bool IsLoaded() const;
void Free();
private:
void CreateVariable(DbVarTmpl* master);
};
}