Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
1 files changed, 5 insertions, 1 deletions
-rw-r--r--src/Models/Table.cpp6
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index c8e2cb3..f55e986 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -104,11 +104,15 @@ void Table::readFromFile(std::ifstream& inFile) {
cells[row].add((Cell*)new CellInt(buffer.raw_data()));
}
}
+
+ if (cells[row].get_count() > longestRow)
+ longestRow = cells[row].get_count();
}
}
#include <iostream>
Table::Table(const char* filePath) {
+ longestRow = 0;
std::ifstream inFile(filePath);
if (!inFile.is_open())
throw std::logic_error("Could not open file!");
@@ -130,7 +134,7 @@ unsigned Table::get_rows() const {
}
unsigned Table::get_cols() const {
- return cells[0].get_length();
+ return longestRow;
}
#define abs(a) ((a < 0) ? -a : a)