#include "enginedata.h" #include #include using namespace std; Row::Row(const int _nc,const Table *const _t):nc(_nc),table(_t){ items=new RowItem[nc]; } Row::~Row(void){ if(items)delete[] items; } Row::Row(Row &&other):nc(other.nc),table(other.table),items(other.items){ //move constr other.table=nullptr; other.items=nullptr; } Row::Row(const Row &other):nc(other.nc),table(other.table){ //copy constr items=new RowItem[table->nc]; memcpy(items,other.items,table->nc*sizeof(RowItem)); } ostream& operator<<(ostream &os,const Row &r){ os<<'['; for(int i=0;iheader[i],r.items[i]); } os<<']'; return os; } //copies from _hd, so you can freely delete or edit the passed colheader array Table::Table(const string &_n,const int _nc,const ColHeader *const _hd):name(_n),nc(_nc){ header=new ColHeader[nc]; memcpy(header,_hd,nc*sizeof(ColHeader)); } Table::~Table(void){ if(header)delete[] header; } Table::Table(Table &&other):name(move(other.name)),nc(other.nc),header(other.header),rows(move(other.rows)){ other.header=nullptr; } void Table::insert(Row &&row){ string key=serialise(this->header[0],row.items[0]); cerr<<"Inserting into table '"<name<<"' key="<name<<"' key="<