From ce356164bac0f739fea97b8bee61c066b9f2ae87 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 11 May 2015 21:24:57 +0200 Subject: Add < $*.d diff --git a/engine.cpp b/engine.cpp index bc4165a..67c9524 100644 --- a/engine.cpp +++ b/engine.cpp @@ -1,10 +1,11 @@ +#include "enginedata.h" +#include "Maybe.h" #include #include #include +#include #include #include -#include "enginedata.h" -#include "Maybe.h" using namespace std; @@ -24,10 +25,13 @@ int main(int argc,char **argv){ row.items[1].u.rh_uint32=UINT_MAX; row.items[2].u.rh_bytes=new unsigned char[10]; strcpy((char*)row.items[2].u.rh_bytes,"hallo daar"); - hoitb->insert(row); - Maybe found=hoitb->find(serialise((int32_t)-1)); + if(!hoitb->insert(row))cout<<"Failed to insert row!"<insert(row))cout<<"Failed to insert row!"<rows.size()<<" row"<<(hoitb->rows.size()==1?"":"s")<<'.'< found=hoitb->find(serialise((int32_t)-1)); + cout<<"Found for key -1:"< +#include #include using namespace std; @@ -41,24 +43,26 @@ Table::Table(Table &&other):name(move(other.name)),nc(other.nc),header(other.hea other.header=nullptr; } -void Table::insert(Row &&row){ +bool Table::insert(Row &&row){ string key=serialise(this->header[0],row.items[0]); - cerr<<"Inserting into table '"<name<<"' key="<name<<"' key="<name<<"' key="<name<<"' key="< find(const string &key); + bool insert(Row &&row); + bool insert(Row &row); + list find(const string &key); }; diff --git a/util.cpp b/util.cpp new file mode 100644 index 0000000..b85f89e --- /dev/null +++ b/util.cpp @@ -0,0 +1,13 @@ +#include "util.h" +#include + +using namespace std; + +ostream& debug(ostream &os){ + char buf[64]; + time_t timeval=time(NULL); + struct tm *timeinfo=localtime(&timeval); + strftime(buf,64,"%Y-%m-%d %T",timeinfo); + os<<"\x1B[36m["< + +using namespace std; + +ostream& debug(ostream &os); -- cgit v1.2.3-54-g00ecf