diff options
| Commit | b6b8fbd49482cbfc0cc57d61215032d43902ee46 (patch) | |
|---|---|---|
| Author | 2022-05-28 19:34:47 +0300 | |
| Committer | 2022-05-28 19:34:47 +0300 | |
| Files | 35f5e1a23d6a5c79ba87e183eaf796582bfb5fbc /src | |
| FMI-OOP-P2_Tables-b6b8fbd49482cbfc0cc57d61215032d43902ee46.tar FMI-OOP-P2_Tables-b6b8fbd49482cbfc0cc57d61215032d43902ee46.tar.gz FMI-OOP-P2_Tables-b6b8fbd49482cbfc0cc57d61215032d43902ee46.zip | ||
| Parent | df1d4f096d676be8faaf4f1183fdef09ff301706 (diff) | |
Autocommit at 28.05.2022 @ 19:34
2 files changed, 9 insertions, 1 deletions
| -rw-r--r-- | src/Models/CellFormula.cpp | 7 | ||||
| -rw-r--r-- | src/Models/CellFormula.h | 3 |
diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp index 631621d..cc48951 100644 --- a/src/Models/CellFormula.cpp +++ b/src/Models/CellFormula.cpp @@ -48,6 +48,13 @@ void CellFormula::parseAndSetValue(const char* str) { formula.add({(*tableCells)[row][col], (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}); + } } void CellFormula::readFromFile(std::ifstream& file) { diff --git a/src/Models/CellFormula.h b/src/Models/CellFormula.h index 819e758..c4bb509 100644 --- a/src/Models/CellFormula.h +++ b/src/Models/CellFormula.h @@ -2,6 +2,7 @@ #define HEADER_CELLFORMULA #include "Cell.h" +#include "CellDouble.h" #include "../Generic/List/List.hpp" #include "../Generic/Pair/Pair.hpp" @@ -16,8 +17,8 @@ class CellFormula : public Cell { }; const List<List<Cell*>>* tableCells; + List<CellDouble> localCells; - List<Cell*> referencedCells; List<Pair<Cell*, Op>> formula; String rawFormula; |
