From b6b8fbd49482cbfc0cc57d61215032d43902ee46 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 28 May 2022 19:34:47 +0300 Subject: Autocommit at 28.05.2022 @ 19:34 --- src/Models/CellFormula.cpp | 7 +++++++ src/Models/CellFormula.h | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Models') 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>* tableCells; + List localCells; - List referencedCells; List> formula; String rawFormula; -- cgit v1.3.1-23-gd82d