Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / CellFormula.cpp
diff options
context:
space:
mode:
Commitc24eb091ef16ff87e5363e3b364b59bb92c113a8 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-29 10:04:24 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-29 10:04:24 +0300
Files6b8889184ea458d1283ed3debefab0eeef443013 /src/Models/CellFormula.cpp
FMI-OOP-P2_Tables-c24eb091ef16ff87e5363e3b364b59bb92c113a8.tar
FMI-OOP-P2_Tables-c24eb091ef16ff87e5363e3b364b59bb92c113a8.tar.gz
FMI-OOP-P2_Tables-c24eb091ef16ff87e5363e3b364b59bb92c113a8.zip
Parent0040102741289c225065a61263b266f640ddf6c7 (diff)
Autocommit at 29.05.2022 @ 10:04
1 files changed, 3 insertions, 4 deletions
-rw-r--r--src/Models/CellFormula.cpp7
diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp
index 388af73..ecea06d 100644
--- a/src/Models/CellFormula.cpp
+++ b/src/Models/CellFormula.cpp
@@ -35,7 +35,7 @@ double CellFormula::calculate(unsigned index) {
CellFormula::CellFormula(const char* str, const List<List<Cell*>>* tableCells) : localCells(), formula(), rawFormula() {
this->tableCells = tableCells;
- parseAndSetValue(str);
+ CellFormula::parseAndSetValue(str);
}
#include <iostream>
@@ -45,6 +45,7 @@ double CellFormula::getNumeralValue() {
}
String CellFormula::getValueForPrint() {
+ std::cout << formula.get_count() << std::endl;
return String() += calculate();
}
@@ -61,7 +62,7 @@ void CellFormula::parseAndSetValue(const char* str) {
unsigned row = atoi(++str);
while (*str != 'C') str++;
unsigned col = atoi(++str);
- while (*str != ' ') str++;
+ while (*str != ' ' && *str != '\0') str++;
while (*str == ' ') str++;
cellToAdd = (*tableCells)[row][col];
@@ -82,8 +83,6 @@ void CellFormula::parseAndSetValue(const char* str) {
if (prev.right == '*' || prev.right == '/') prev.right *= -1;
}
- std::cout << formula.get_count() << std::endl;
- std::cout << cellToAdd << " " << currOp << std::endl;
formula.add({cellToAdd, currOp});
}
}