From 61d9970168b0d68e93664223751aec099e88d776 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 28 May 2022 19:39:49 +0300 Subject: Autocommit at 28.05.2022 @ 19:39 --- src/Models/CellFormula.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/Models/CellFormula.cpp') diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp index cc48951..a53c3e5 100644 --- a/src/Models/CellFormula.cpp +++ b/src/Models/CellFormula.cpp @@ -38,6 +38,9 @@ String CellFormula::getValueForPrint() { void CellFormula::parseAndSetValue(const char* str) { rawFormula = String(str); + Cell* ptr; + Op currOp; + str++; while (*str == ' ') str++; if (*str == 'R') { @@ -46,15 +49,19 @@ void CellFormula::parseAndSetValue(const char* str) { unsigned col = atoi(++str); while (*str != ' ') str++; - formula.add({(*tableCells)[row][col], (Op)*str}); + ptr = (*tableCells)[row][col]; + currOp = (Op)*str; } else { double val = atof(str); while ((*str >= '0' && *str <= '9') || *str == ' ') str++; localCells.add(CellDouble(val)); - formula.add({localCells[localCells.get_count() - 1], (Op)*str}); + ptr = &localCells[localCells.get_count() - 1]; + currOp = (Op)*str; } + formula.add({ptr, currOp}); + } void CellFormula::readFromFile(std::ifstream& file) { -- cgit v1.3.1-23-gd82d