Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
Commit00e2cff656eae2b7ce6f42132c413d2c324076eb (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-30 21:23:43 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-30 21:23:43 +0300
Files3fa5bb5539fcaa641928c708d97c57aa3d4c5a7e /src/Models/Table.cpp
FMI-OOP-P2_Tables-00e2cff656eae2b7ce6f42132c413d2c324076eb.tar
FMI-OOP-P2_Tables-00e2cff656eae2b7ce6f42132c413d2c324076eb.tar.gz
FMI-OOP-P2_Tables-00e2cff656eae2b7ce6f42132c413d2c324076eb.zip
Parenta0a893815d9fb9af7a3c0a6dfc8a6f980d32e62a (diff)
Autocommit at 30.05.2022 @ 21:23
1 files changed, 4 insertions, 1 deletions
-rw-r--r--src/Models/Table.cpp5
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index 2862c51..506204a 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -11,10 +11,12 @@
#define FLOATING_POINT_PRECISION 0.00001f
unsigned countOfCommas(std::ifstream& file) {
+ unsigned currPos = file.tellg();
unsigned commaCount = 0;
while (file.peek() != '\n') {
if (file.get() == ',') commaCount++;
}
+ file.seekg(currPos, std::ios::beg);
return commaCount;
}
@@ -27,12 +29,13 @@ bool containsNumber(const char*& str) {
return ((*str == '+' || *str == '-') && (*(str + 1) >= '0' && *(str + 1) <= '9')) ||
(*str >= '0' && *str <= '9'); // + or -, followed by digit, or it just a digit
}
-
+#include <iostream>
void Table::readFromFile(std::ifstream& inFile) {
unsigned commaCount = countOfCommas(inFile);
unsigned colInd = 0;
cells.add(List<Cell*>(commaCount));
while (inFile.peek() != EOF) {
+ std::cout << inFile.peek() << std::endl;
while (inFile.peek() == ' ') inFile.get();
// Entering a new cell on the current row