From a329c3c167b8d570a656b2eed5af23e6afe8096b Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 28 May 2022 16:19:02 +0300 Subject: Autocommit at 28.05.2022 @ 16:19 --- src/Models/CellFormula.cpp | 10 ++++++++-- src/Models/CellFormula.h | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/Models') 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 +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> formula; String rawFormula; + double calculate(unsigned index = 0); + public: CellFormula() = default; -- cgit v1.3.1-26-gb76a