blob: d47870d1d62d80f245c14175e61dee9e8f4eecb4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include "CellFormula.h"
#include "CellDouble.h"
#include <cstring>
double CellFormula::calculate(unsigned index) {
double lval = CellDouble(formula[index].left->getValue()).getValue();
switch(formula[index].right) {
plus: return lval + calculate(index++);
minus: return lval - calculate(index++);
mult: return lval * calculate(index++);
div: return lval / calculate(index++);
default: return lval;
}
}
String CellFormula::getValueForPrint() {
double result = calculate();
return "";
}
void CellFormula::parseAndSetValue(const char* str) {
}
void CellFormula::readFromFile(std::ifstream& file) {
file >> rawFormula;
}
void CellFormula::writeToFile(std::ofstream& file) {
file << rawFormula;
}
|