Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
Commit4ce512129759a4cf7e7c7b1cbc7a1eed42b98b51 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-30 19:17:58 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-30 19:17:58 +0300
Files0303ab616abaaaaa49420af4845ca84309058c3c /src/Models/Table.cpp
FMI-OOP-P2_Tables-4ce512129759a4cf7e7c7b1cbc7a1eed42b98b51.tar
FMI-OOP-P2_Tables-4ce512129759a4cf7e7c7b1cbc7a1eed42b98b51.tar.gz
FMI-OOP-P2_Tables-4ce512129759a4cf7e7c7b1cbc7a1eed42b98b51.zip
Parent70d5a33ffb0c29e20f4e57a332e5fa4ae847fdea (diff)
Autocommit at 30.05.2022 @ 19:17
1 files changed, 13 insertions, 1 deletions
-rw-r--r--src/Models/Table.cpp14
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index 6101136..c4fa332 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -39,7 +39,19 @@ Cell* Table::createCellByParsing(const char* rawValue) {
void Table::readFromFile(std::ifstream& inFile) {
unsigned commaCount = countOfCommas(inFile);
+ unsigned colInd = 0;
while (!inFile.eof()) {
+ while (inFile.peek() == ' ') inFile.get();
+
+ if (inFile.peek() == ',') {
+ colInd++;
+ }
+ else if (inFile.peek() == '\n') {
+ cells.add(List<Cell*>(commaCount));
+ colInd = 0;
+ inFile.get();
+ }
+ else if (inFile.peek() )
}
}
@@ -47,7 +59,7 @@ Table::Table(const char* filePath) {
std::ifstream inFile(filePath);
if (inFile.is_open())
throw std::logic_error("Could now open file!");
- cells = List<List<Cell*>>();
+ cells = List<List<Cell*>>(1);
readFromFile(inFile);
inFile.close();
}