Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models
diff options
context:
space:
mode:
Commitabb9700d4d45cf85d04759b76bd93a795e0f467e (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-30 18:07:38 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-30 18:07:38 +0300
Files42154311b6fea71bab2aa62f4dbad6a9312e8242 /src/Models
FMI-OOP-P2_Tables-abb9700d4d45cf85d04759b76bd93a795e0f467e.tar
FMI-OOP-P2_Tables-abb9700d4d45cf85d04759b76bd93a795e0f467e.tar.gz
FMI-OOP-P2_Tables-abb9700d4d45cf85d04759b76bd93a795e0f467e.zip
Parent09bf71b13d873767a400b4e3e17172ae1c2830f8 (diff)
Autocommit at 30.05.2022 @ 18:07
6 files changed, 16 insertions, 16 deletions
-rw-r--r--src/Models/CellDouble.cpp4
-rw-r--r--src/Models/CellFormula.cpp12
-rw-r--r--src/Models/CellInt.cpp4
-rw-r--r--src/Models/CellInt.h4
-rw-r--r--src/Models/CellString.cpp4
-rw-r--r--src/Models/CellString.h4
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;