diff options
| Commit | 0157e5f0ba9b3c62f060322abb34b319104255ad (patch) | |
|---|---|---|
| Author | 2022-05-30 21:48:52 +0300 | |
| Committer | 2022-05-30 21:48:52 +0300 | |
| Files | 716fcfa7d538de4f41b5b4a80b929f796468afe4 /src | |
| FMI-OOP-P2_Tables-0157e5f0ba9b3c62f060322abb34b319104255ad.tar FMI-OOP-P2_Tables-0157e5f0ba9b3c62f060322abb34b319104255ad.tar.gz FMI-OOP-P2_Tables-0157e5f0ba9b3c62f060322abb34b319104255ad.zip | ||
| Parent | 9d3cc59256daa844e3b3d65a9010738bc046b588 (diff) | |
Autocommit at 30.05.2022 @ 21:48
1 files changed, 4 insertions, 2 deletions
| -rw-r--r-- | src/Models/Table.cpp | 6 |
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index 60da314..54c34bd 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -37,10 +37,9 @@ void Table::readFromFile(std::ifstream& inFile) { unsigned colInd = 0; cells.add(List<Cell*>(commaCount)); - while (!inFile.eof()) { + while (inFile.peek() != EOF) { while (inFile.peek() == ' ') inFile.get(); - std::cout << (char)inFile.peek() << std::endl; // Entering a new cell on the current row if (inFile.peek() == ',') { colInd++; @@ -91,11 +90,14 @@ void Table::readFromFile(std::ifstream& inFile) { String res; inFile.get(); while (inFile.peek() != '"') { + if (inFile.peek() == '\n') + throw std::logic_error(fileLocationExceptionMsg("Error: Could not find a matching end quote for string at row ", cells.get_count(), inFile.tellg() % commaCount + 1)); if (inFile.peek() == '\\') { inFile.get(); } res += inFile.get(); } + inFile.get(); if (*res.get_cstr() == '=') cells[cells.get_count() - 1][colInd++] = new CellFormula(res.get_cstr(), &cells); |
