From 28c22b23863ff82581e934be8c0d26b93f51abbb Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 30 May 2022 19:58:13 +0300 Subject: Autocommit at 30.05.2022 @ 19:58 --- src/Models/Table.cpp | 7 +++++++ src/Models/Table.h | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Models') diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index 8c1f54d..c0fe315 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -84,7 +84,14 @@ void Table::readFromFile(std::ifstream& inFile) { } res += inFile.get(); } + + if (*res.get_cstr() == '=') + cells[cells.get_count() - 1].add(new CellFormula(res.get_cstr(), &cells)); + else + cells[cells.get_count() - 1].add(new CellString(res.get_cstr())); } + else + throw std::logic_error(fileLocationExceptionMsg("Error: Could not determine type of value at row ", cells.get_count(), inFile.tellg() % cells.get_count() + 1)); } } diff --git a/src/Models/Table.h b/src/Models/Table.h index ade25d9..41d9d7f 100644 --- a/src/Models/Table.h +++ b/src/Models/Table.h @@ -15,8 +15,9 @@ public: unsigned get_cols() const; void putCell(unsigned row, unsigned col, const char* rawValue); + List getAllCells() const; - void saveToFile(const char* filePath); + void saveToFile(const char* filePath) const; }; #endif -- cgit v1.3.1-26-gb76a