Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / CellFormula.cpp
diff options
context:
space:
mode:
Commit5a4dccf0f9a95cc14717d5337fd2b72cba22d9b6 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-06-14 14:59:41 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-06-14 14:59:41 +0300
Files89f2a9366ce1bf0cde362ea093c7385e4e03502e /src/Models/CellFormula.cpp
FMI-OOP-P2_Tables-5a4dccf0f9a95cc14717d5337fd2b72cba22d9b6.tar
FMI-OOP-P2_Tables-5a4dccf0f9a95cc14717d5337fd2b72cba22d9b6.tar.gz
FMI-OOP-P2_Tables-5a4dccf0f9a95cc14717d5337fd2b72cba22d9b6.zip
Parent202a4e89a9d235d6760b4c9cf30aa5a717f0424c (diff)
Autocommit at 14.06.2022 @ 14:59
1 files changed, 12 insertions, 1 deletions
-rw-r--r--src/Models/CellFormula.cpp13
diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp
index 9609238..fead01d 100644
--- a/src/Models/CellFormula.cpp
+++ b/src/Models/CellFormula.cpp
@@ -101,6 +101,17 @@ void O(const char*& str, char& buffer) {
else buffer = -2;
}
+/*!
+ * Each math operation is represented with a Pair that holds indecies of cell reference
+ * and a character for the operation.
+ *
+ * Negatve value for the operation character means it's with priority and the result get's calculated
+ * immediately (rather than recursively, taking into account other values).
+ *
+ * \exception std::logic_error("Error: Invalid column character!") Thrown when there is something between Rx and C in cell references
+ * \exception std::logic_error("Error: Invalid value!") Thrown when met value isn't a cell reference or number
+ * \exception throw std::logic_error("Error: Could not find operand!") Thrown when there isn't an operator character between two values
+ */
void CellFormula::parseAndSetValue(const char* str) {
rawFormula = String(str);
@@ -116,7 +127,7 @@ void CellFormula::parseAndSetValue(const char* str) {
if (*str == 'R') {
D(++str, buffer);
loc.left = atoi(buffer.raw_data()) - 1;
- if (*str != 'C') throw std::logic_error("Error: Invalid character!");
+ if (*str != 'C') throw std::logic_error("Error: Invalid column character!");
str++;
buffer.clear();
D(str, buffer);