Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
Commit68f6b62e49916a59442f4ae69fc0554bf1d84f3a (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-28 18:29:27 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-28 18:29:27 +0300
Files81793fa66cb694f9312fd97f5496f600d3c8cfef /src/Models/Table.cpp
FMI-OOP-P2_Tables-68f6b62e49916a59442f4ae69fc0554bf1d84f3a.tar
FMI-OOP-P2_Tables-68f6b62e49916a59442f4ae69fc0554bf1d84f3a.tar.gz
FMI-OOP-P2_Tables-68f6b62e49916a59442f4ae69fc0554bf1d84f3a.zip
Parent9e7af3dd34b747c44aeb2b29fcef7531dc83b17b (diff)
Autocommit at 28.05.2022 @ 18:29
1 files changed, 8 insertions, 6 deletions
-rw-r--r--src/Models/Table.cpp14
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index bcaffb7..5d0c87f 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -19,12 +19,14 @@ bool containsNumber(const char*& str) {
}
void Table::putCell(unsigned row, unsigned col, const char* rawValue) {
- unsigned intParse = atoi(rawValue);
- unsigned doubleParse = atof(rawValue);
Cell* newCell;
- if (doubleParse - intParse > 0.00001 && doublePrase > 0.00001)
- newCell = new CellDouble(doubleParse);
- else if (intParse )
- newCell =
+ if (containsNumber(rawValue)) {
+ unsigned intParse = atoi(rawValue);
+ unsigned doubleParse = atof(rawValue);
+
+ newCell = (doubleParse - intParse > 0.00001 && doubleParse > 0.00001)
+ ? new CellDouble(doubleParse) : new CellInt(intParse);
+ }
+
}