From 7febd01493afa6b5406a8c09ab16eba1d30270a9 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 14 Jun 2022 09:08:56 +0300 Subject: Autocommit at 14.06.2022 @ 09:08 --- src/Models/Table.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Models/Table.cpp') 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 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) -- cgit v1.3.1-23-gd82d