diff options
Autocommit at 30.05.2022 @ 18:07
6 files changed, 16 insertions, 16 deletions
| -rw-r--r-- | src/Models/CellDouble.cpp | 4 | ||||
| -rw-r--r-- | src/Models/CellFormula.cpp | 12 | ||||
| -rw-r--r-- | src/Models/CellInt.cpp | 4 | ||||
| -rw-r--r-- | src/Models/CellInt.h | 4 | ||||
| -rw-r--r-- | src/Models/CellString.cpp | 4 | ||||
| -rw-r--r-- | src/Models/CellString.h | 4 |
diff --git a/src/Models/CellDouble.cpp b/src/Models/CellDouble.cpp index 4f4f769..40aafd5 100644 --- a/src/Models/CellDouble.cpp +++ b/src/Models/CellDouble.cpp @@ -5,11 +5,11 @@ CellDouble::CellDouble(double value) { this->value = value; } -double CellDouble::getNumeralValue() { +double CellDouble::getNumeralValue() const { return value; } -String CellDouble::getValueForPrint() { +String CellDouble::getValueForPrint() const { return String() += value; } diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp index 5cc3ae5..4742ad1 100644 --- a/src/Models/CellFormula.cpp +++ b/src/Models/CellFormula.cpp @@ -72,7 +72,7 @@ String CellFormula::getValueForPrint() const { void CellFormula::parseAndSetValue(const char* str) { rawFormula = String(str); - CellLoc cellToAdd; + Pair<int, int> loc; char currOp; while (*str != '\0') { @@ -86,7 +86,7 @@ void CellFormula::parseAndSetValue(const char* str) { while (*str == ' ') str++; currOp = *str; - cellToAdd = {row, col}; + loc = {row, col}; } else { double val = atof(str); @@ -94,7 +94,7 @@ void CellFormula::parseAndSetValue(const char* str) { currOp = *str; localCells.add(CellDouble(val)); - cellToAdd = {-1, (int)(localCells.get_count() - 1)}; + loc = {-1, localCells.get_count() - 1}; } if (currOp == '^') currOp *= -1; @@ -104,11 +104,11 @@ void CellFormula::parseAndSetValue(const char* str) { } if (currOp == '-') { - formula.add({cellToAdd, '+'}); + formula.add({loc, '+'}); localCells.add(CellDouble(-1.0)); - formula.add({{-1, (int)(localCells.get_count() - 1)}, '*' * -1}); + formula.add({{-1, localCells.get_count() - 1}, '*' * -1}); } - else formula.add({cellToAdd, currOp}); + else formula.add({loc, currOp}); } } diff --git a/src/Models/CellInt.cpp b/src/Models/CellInt.cpp index c6239e0..942b5e0 100644 --- a/src/Models/CellInt.cpp +++ b/src/Models/CellInt.cpp @@ -5,11 +5,11 @@ CellInt::CellInt(int value) { this->value = value; } -double CellInt::getNumeralValue() { +double CellInt::getNumeralValue() const { return value; } -String CellInt::getValueForPrint() { +String CellInt::getValueForPrint() const { return String() += value; } diff --git a/src/Models/CellInt.h b/src/Models/CellInt.h index 137dc65..8ebec24 100644 --- a/src/Models/CellInt.h +++ b/src/Models/CellInt.h @@ -10,8 +10,8 @@ public: CellInt() = default; CellInt(int value); - double getNumeralValue() override; - String getValueForPrint() override; + double getNumeralValue() const override; + String getValueForPrint() const override; void parseAndSetValue(const char* str) override; void readFromFile(std::ifstream& file) override; void writeToFile(std::ofstream& file) override; diff --git a/src/Models/CellString.cpp b/src/Models/CellString.cpp index 20eacf4..a383c25 100644 --- a/src/Models/CellString.cpp +++ b/src/Models/CellString.cpp @@ -5,11 +5,11 @@ CellString::CellString(const char* str) { value = String(str); } -double CellString::getNumeralValue() { +double CellString::getNumeralValue() const { return atof(value.get_cstr()); } -String CellString::getValueForPrint() { +String CellString::getValueForPrint() const { return value; } diff --git a/src/Models/CellString.h b/src/Models/CellString.h index f15e904..74df9d7 100644 --- a/src/Models/CellString.h +++ b/src/Models/CellString.h @@ -10,8 +10,8 @@ public: CellString() = default; CellString(const char* str); - double getNumeralValue() override; - String getValueForPrint() override; + double getNumeralValue() const override; + String getValueForPrint() const override; void parseAndSetValue(const char* str) override; void readFromFile(std::ifstream& file) override; void writeToFile(std::ofstream& file) override; |
