Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
1 files changed, 7 insertions, 0 deletions
-rw-r--r--src/Models/Table.cpp7
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index 70579b4..0d3264e 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -6,11 +6,18 @@
#include <cstring>
Table::Table(unsigned rows, unsigned cols) {
+ if (rows == 0 || cols == 0)
+ return;
+
cells = List<List<Cell*>>(rows);
for (unsigned i = 0; i < rows; i++)
cells[i] = List<Cell*>(cols);
}
+unsigned Table::get_cols() const {
+ return cells[0].get_count();
+}
+
bool containsNumber(const char*& str) {
while (*str == ' ') str++;
return ((*str == '+' || *str == '-') && (*(str + 1) >= '0' && *(str + 1) <= '9')) ||