Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
Commitb45b705ced197e25265700f5ded05a79fa0bd48c (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-30 21:13:39 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-30 21:13:39 +0300
Files43e87154ce45f94517d9a9ef2a5f1f6783676840 /src/Models/Table.cpp
FMI-OOP-P2_Tables-b45b705ced197e25265700f5ded05a79fa0bd48c.tar
FMI-OOP-P2_Tables-b45b705ced197e25265700f5ded05a79fa0bd48c.tar.gz
FMI-OOP-P2_Tables-b45b705ced197e25265700f5ded05a79fa0bd48c.zip
Parent61dca3c2462a88f73c6771b9a198326a36f7f3f6 (diff)
Autocommit at 30.05.2022 @ 21:13
1 files changed, 4 insertions, 4 deletions
-rw-r--r--src/Models/Table.cpp8
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index 0542991..421fae9 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -76,9 +76,9 @@ void Table::readFromFile(std::ifstream& inFile) {
throw std::logic_error(fileLocationExceptionMsg("Error: Expected space, comma or newline but got something else at row ", cells.get_count(), inFile.tellg() % cells.get_count() + 1));
if (exponent == 1)
- cells[cells.get_count() - 1].add(new CellInt(whole));
+ cells[cells.get_count() - 1][colInd++] = new CellInt(whole);
else
- cells[cells.get_count() - 1].add(new CellDouble((double)whole / exponent));
+ cells[cells.get_count() - 1][colInd++] = new CellDouble((double)whole / exponent);
}
// Parsing string or formula
else if (inFile.peek() == '"') {
@@ -92,9 +92,9 @@ void Table::readFromFile(std::ifstream& inFile) {
}
if (*res.get_cstr() == '=')
- cells[cells.get_count() - 1].add(new CellFormula(res.get_cstr(), &cells));
+ cells[cells.get_count() - 1][colInd++] = new CellFormula(res.get_cstr(), &cells);
else
- cells[cells.get_count() - 1].add(new CellString(res.get_cstr()));
+ cells[cells.get_count() - 1][colInd++] = 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));