aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <hallo@tomsmeding.nl>2015-05-11 10:16:25 +0200
committertomsmeding <hallo@tomsmeding.nl>2015-05-11 10:16:25 +0200
commitdb4b20dea8278579ef8e02e528595178c7b500d0 (patch)
tree3f3ba424ec476b04ef446b9deb12228d2eff76dd
parent95c5eb96cf65019131a97e93031d4cdf38eca3c2 (diff)
Bit of cleanup
-rw-r--r--engine.cpp1
-rw-r--r--enginedata.cpp23
2 files changed, 18 insertions, 6 deletions
diff --git a/engine.cpp b/engine.cpp
index b4753f4..dd0f5f4 100644
--- a/engine.cpp
+++ b/engine.cpp
@@ -6,6 +6,7 @@
using namespace std;
+
map<string,Table> tables;
diff --git a/enginedata.cpp b/enginedata.cpp
index c4d5e27..f1e9b2c 100644
--- a/enginedata.cpp
+++ b/enginedata.cpp
@@ -2,8 +2,12 @@
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(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;
@@ -14,14 +18,21 @@ Row::Row(const Row &other):table(other.table){ //copy constr
}
-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
+//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(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);}
+void Table::insert(Row &&row){
+ rows.push_back(move(row));
+}
+void Table::insert(Row &row){
+ rows.emplace_back(row);
+}