Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models
diff options
context:
space:
mode:
2 files changed, 11 insertions, 2 deletions
-rw-r--r--src/Models/CellFormula.cpp10
-rw-r--r--src/Models/CellFormula.h3
diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp
index e488b0f..2c28d4b 100644
--- a/src/Models/CellFormula.cpp
+++ b/src/Models/CellFormula.cpp
@@ -1,9 +1,15 @@
#include "CellFormula.h"
#include <cstring>
+double CellFormula::calculate(unsigned index) {
+ switch(formula[index].right) {
+ case none: return formula[index].left;
+ }
+}
+
String CellFormula::getValueForPrint() {
- double result = 0;
- return String() += value;
+ double result = calculate();
+ return "";
}
void CellFormula::parseAndSetValue(const char* str) {
diff --git a/src/Models/CellFormula.h b/src/Models/CellFormula.h
index 505d305..3074846 100644
--- a/src/Models/CellFormula.h
+++ b/src/Models/CellFormula.h
@@ -7,6 +7,7 @@
class CellFormula : public Cell {
enum Op {
+ none,
plus,
minus,
mult,
@@ -18,6 +19,8 @@ class CellFormula : public Cell {
List<Pair<Cell*, Op>> formula;
String rawFormula;
+ double calculate(unsigned index = 0);
+
public:
CellFormula() = default;