diff options
| Commit | 61d9970168b0d68e93664223751aec099e88d776 (patch) | |
|---|---|---|
| Author | 2022-05-28 19:39:49 +0300 | |
| Committer | 2022-05-28 19:39:49 +0300 | |
| Files | cc0593cd031c5e3097f97572183724a4293b45ac /src | |
| FMI-OOP-P2_Tables-61d9970168b0d68e93664223751aec099e88d776.tar FMI-OOP-P2_Tables-61d9970168b0d68e93664223751aec099e88d776.tar.gz FMI-OOP-P2_Tables-61d9970168b0d68e93664223751aec099e88d776.zip | ||
| Parent | b6b8fbd49482cbfc0cc57d61215032d43902ee46 (diff) | |
Autocommit at 28.05.2022 @ 19:39
1 files changed, 9 insertions, 2 deletions
| -rw-r--r-- | src/Models/CellFormula.cpp | 11 |
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) { |
