aboutsummaryrefslogtreecommitdiff
path: root/enginedata.cpp
diff options
context:
space:
mode:
authortomsmeding <hallo@tomsmeding.nl>2015-05-11 10:00:29 +0200
committertomsmeding <hallo@tomsmeding.nl>2015-05-11 10:01:23 +0200
commit95c5eb96cf65019131a97e93031d4cdf38eca3c2 (patch)
tree06226daa75ef0f5ecf50f58ce620f52e353b74a9 /enginedata.cpp
Initial
Diffstat (limited to 'enginedata.cpp')
-rw-r--r--enginedata.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/enginedata.cpp b/enginedata.cpp
new file mode 100644
index 0000000..c4d5e27
--- /dev/null
+++ b/enginedata.cpp
@@ -0,0 +1,27 @@
+#include "enginedata.h"
+
+using namespace std;
+
+Row::Row(const int nc,const Table *const _t):table(_t){items=new RowItem[nc];}
+Row::~Row(void){if(items)delete[] items;}
+Row::Row(Row &&other):table(other.table),items(other.items){ //move constr
+ other.table=NULL;
+ other.items=NULL;
+}
+Row::Row(const Row &other):table(other.table){ //copy constr
+ items=new RowItem[table->nc];
+ memcpy(items,other.items,table->nc*sizeof(RowItem));
+}
+
+
+Table::Table(const string &_n,const int _nc,const ColHeader *const _hd):name(_n),nc(_nc){ //copies from _hd, so you can freely delete it or whatever
+ 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=NULL;
+}
+
+void Table::insert(Row &&row){rows.push_back(move(row));}
+void Table::insert(Row &row){rows.emplace_back(row);}