Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
Commitc04304fc802eb7555ef2dc71b454b8c1fbaa1164 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-30 19:23:00 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-30 19:23:00 +0300
Filesbfc37796d5e4dd332776bbcf390d4a14205ba1d9 /src/Models/Table.cpp
FMI-OOP-P2_Tables-c04304fc802eb7555ef2dc71b454b8c1fbaa1164.tar
FMI-OOP-P2_Tables-c04304fc802eb7555ef2dc71b454b8c1fbaa1164.tar.gz
FMI-OOP-P2_Tables-c04304fc802eb7555ef2dc71b454b8c1fbaa1164.zip
Parent4ce512129759a4cf7e7c7b1cbc7a1eed42b98b51 (diff)
Autocommit at 30.05.2022 @ 19:23
1 files changed, 8 insertions, 1 deletions
-rw-r--r--src/Models/Table.cpp9
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index c4fa332..34719ed 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -17,6 +17,7 @@ unsigned countOfCommas(std::ifstream& file) {
}
#define abs(a) ((a < 0) ? -a : a)
+#define isNumeric(a) (a >= '0' && a <= '9')
bool containsNumber(const char*& str) {
while (*str == ' ') str++;
@@ -45,13 +46,19 @@ void Table::readFromFile(std::ifstream& inFile) {
if (inFile.peek() == ',') {
colInd++;
+ inFile.get();
}
else if (inFile.peek() == '\n') {
cells.add(List<Cell*>(commaCount));
colInd = 0;
inFile.get();
}
- else if (inFile.peek() )
+ else if (inFile.peek() == '-' || inFile.peek() == '+' || isNumeric(inFile.peek())) {
+ unsigned numberStart = inFile.tellg();
+ if (inFile.peek() == '-' || inFile.peek() == '+') inFile.get();
+ if (!isNumeric(inFile.peek()))
+ throw std::logic_error("");
+ }
}
}