Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commita329c3c167b8d570a656b2eed5af23e6afe8096b (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-28 16:19:02 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-28 16:19:02 +0300
Filesea745f700ae7eb06696b76e20790b285642a3691 /src
FMI-OOP-P2_Tables-a329c3c167b8d570a656b2eed5af23e6afe8096b.tar
FMI-OOP-P2_Tables-a329c3c167b8d570a656b2eed5af23e6afe8096b.tar.gz
FMI-OOP-P2_Tables-a329c3c167b8d570a656b2eed5af23e6afe8096b.zip
Parent5d13f960965d8dce18cc32ef71d73df76f5c8395 (diff)
Autocommit at 28.05.2022 @ 16:19
3 files changed, 12 insertions, 17 deletions
-rw-r--r--src/Generic/Pair/Pair.hpp16
-rw-r--r--src/Models/CellFormula.cpp10
-rw-r--r--src/Models/CellFormula.h3
diff --git a/src/Generic/Pair/Pair.hpp b/src/Generic/Pair/Pair.hpp
index e21ea51..0238130 100644
--- a/src/Generic/Pair/Pair.hpp
+++ b/src/Generic/Pair/Pair.hpp
@@ -2,16 +2,12 @@
#define PAIR
template <typename T, typename U>
-class Pair {
+struct Pair {
T left;
U right;
-public:
Pair();
Pair(const T& left, const U& right);
-
- const T& l();
- const U& r();
};
template <typename T, typename U>
@@ -21,14 +17,4 @@ Pair<T, U>::Pair() : left(), right() {}
template <typename T, typename U>
Pair<T, U>::Pair(const T& left, const U& right) : left(left), right(right) {}
-template <typename T, typename U>
-const T& Pair<T, U>::l() {
- return left;
-}
-
-template <typename T, typename U>
-const U& Pair<T, U>::r() {
- return right;
-}
-
#endif
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;