Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models
diff options
context:
space:
mode:
Commitfcb095cdbdee891365054a978533a9a0480ff03b (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-28 19:19:43 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-28 19:19:43 +0300
Files497df49e9899643ebe36f70ab2ca66fc4ffd45c7 /src/Models
FMI-OOP-P2_Tables-fcb095cdbdee891365054a978533a9a0480ff03b.tar
FMI-OOP-P2_Tables-fcb095cdbdee891365054a978533a9a0480ff03b.tar.gz
FMI-OOP-P2_Tables-fcb095cdbdee891365054a978533a9a0480ff03b.zip
Parentc038f8f4bdbd3d1fdfa328d2eac0efdcaeb9cb09 (diff)
Autocommit at 28.05.2022 @ 19:19
2 files changed, 10 insertions, 3 deletions
-rw-r--r--src/Models/CellFormula.cpp9
-rw-r--r--src/Models/CellFormula.h4
diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp
index 3029a19..395e31c 100644
--- a/src/Models/CellFormula.cpp
+++ b/src/Models/CellFormula.cpp
@@ -2,7 +2,8 @@
#include "CellDouble.h"
#include <cstring>
-CellFormula::CellFormula(const char* str) : referencedCells(), formula(), rawFormula() {
+CellFormula::CellFormula(const char* str, const List<List<Cell*>>* tableCells) : referencedCells(), formula(), rawFormula() {
+ this->tableCells = tableCells;
parseAndSetValue(str);
}
@@ -35,9 +36,13 @@ String CellFormula::getValueForPrint() {
}
void CellFormula::parseAndSetValue(const char* str) {
+ rawFormula = String(str);
+
str++;
while (*str == ' ') str++;
- double number = atof(str);
+ if (*str == 'R') {
+ unsigned row = atoi(++str);
+ }
}
void CellFormula::readFromFile(std::ifstream& file) {
diff --git a/src/Models/CellFormula.h b/src/Models/CellFormula.h
index eebe120..28134ab 100644
--- a/src/Models/CellFormula.h
+++ b/src/Models/CellFormula.h
@@ -16,6 +16,8 @@ class CellFormula : public Cell {
pow = 0b100000,
};
+ const List<List<Cell*>>* tableCells;
+
List<Cell*> referencedCells;
List<Pair<Cell*, Op>> formula;
String rawFormula;
@@ -24,7 +26,7 @@ class CellFormula : public Cell {
public:
CellFormula() = default;
- CellFormula(const char* str);
+ CellFormula(const char* str, const List<List<Cell*>>* tableCells);
double getNumeralValue() override;
String getValueForPrint() override;