a bit of further work

This commit is contained in:
2021-06-30 23:29:09 +02:00
parent 5c7908ac4b
commit b55115f7c3
10 changed files with 309 additions and 56 deletions

28
table.cpp Normal file
View File

@@ -0,0 +1,28 @@
#include "table.h"
Table::Table(const std::string name, const std::vector<ColDefNode> columns) {
m_name = name;
m_col_defs = columns;
m_rows.clear();
}
ColDefNode Table::get_column_def(const std::string col_name) {
auto name_cmp = [col_name](ColDefNode cd){ return cd.name == col_name; };
auto col_def = std::find_if(begin(m_col_defs), end(m_col_defs), name_cmp );
if (col_def != std::end(m_col_defs)) {
return *col_def;
} else {
// TODO throw exception
}
}
void Table::print() {
std::cout << "** " << m_name << " **" << std::endl;
for(auto row : m_rows) {
for( auto col : row) {
std::cout << col << ",";
}
std::cout << std::endl;
}
}