Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
Commit291ecb302cc7281c254542543a065aec3ba13bb9 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-29 08:44:02 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-29 08:44:02 +0300
Filese6a5c1abcc71e3fd9c67d4714368840101b50cf7 /src/Models/Table.cpp
FMI-OOP-P2_Tables-291ecb302cc7281c254542543a065aec3ba13bb9.tar
FMI-OOP-P2_Tables-291ecb302cc7281c254542543a065aec3ba13bb9.tar.gz
FMI-OOP-P2_Tables-291ecb302cc7281c254542543a065aec3ba13bb9.zip
Parent2d77f9881df1e2e93cd367e9a2be320de0215fcf (diff)
Autocommit at 29.05.2022 @ 08:44
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')) ||