diff options
| Commit | c04304fc802eb7555ef2dc71b454b8c1fbaa1164 (patch) | |
|---|---|---|
| Author | 2022-05-30 19:23:00 +0300 | |
| Committer | 2022-05-30 19:23:00 +0300 | |
| Files | bfc37796d5e4dd332776bbcf390d4a14205ba1d9 /src | |
| FMI-OOP-P2_Tables-c04304fc802eb7555ef2dc71b454b8c1fbaa1164.tar FMI-OOP-P2_Tables-c04304fc802eb7555ef2dc71b454b8c1fbaa1164.tar.gz FMI-OOP-P2_Tables-c04304fc802eb7555ef2dc71b454b8c1fbaa1164.zip | ||
| Parent | 4ce512129759a4cf7e7c7b1cbc7a1eed42b98b51 (diff) | |
Autocommit at 30.05.2022 @ 19:23
1 files changed, 8 insertions, 1 deletions
| -rw-r--r-- | src/Models/Table.cpp | 9 |
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(""); + } } } |
