Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
Commitd9deee99607e6f39042cd05eaa56f46ae305487c (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-30 22:14:01 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-30 22:14:01 +0300
Filesd162628e415bfd3f6a62021576ae912d65f1bda2 /src/Models/Table.cpp
FMI-OOP-P2_Tables-d9deee99607e6f39042cd05eaa56f46ae305487c.tar
FMI-OOP-P2_Tables-d9deee99607e6f39042cd05eaa56f46ae305487c.tar.gz
FMI-OOP-P2_Tables-d9deee99607e6f39042cd05eaa56f46ae305487c.zip
Parent9693e2b25d7935a06b3695137106038cf436caea (diff)
Autocommit at 30.05.2022 @ 22:14
1 files changed, 6 insertions, 6 deletions
-rw-r--r--src/Models/Table.cpp12
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index 637514a..4692a9e 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -83,9 +83,9 @@ void Table::readFromFile(std::ifstream& inFile) {
throw std::logic_error(fileLocationExceptionMsg("Error: Expected space, comma or newline but got something else at row ", cells.get_count(), inFile.tellg() % cols + 1));
if (exponent == 1)
- cells[cells.get_count() - 1][colInd++] = (Cell*)new CellInt(whole);
+ cells[cells.get_count() - 1][colInd] = (Cell*)new CellInt(whole);
else
- cells[cells.get_count() - 1][colInd++] = (Cell*)new CellDouble((double)whole / exponent);
+ cells[cells.get_count() - 1][colInd] = (Cell*)new CellDouble((double)whole / exponent);
}
// Parsing string or formula
else if (inFile.peek() == '"') {
@@ -102,9 +102,9 @@ void Table::readFromFile(std::ifstream& inFile) {
inFile.get();
if (*res.get_cstr() == '=')
- cells[cells.get_count() - 1][colInd++] = (Cell*)new CellFormula(res.get_cstr(), &cells);
+ cells[cells.get_count() - 1][colInd] = (Cell*)new CellFormula(res.get_cstr(), &cells);
else
- cells[cells.get_count() - 1][colInd++] = (Cell*)new CellString(res.get_cstr());
+ cells[cells.get_count() - 1][colInd] = (Cell*)new CellString(res.get_cstr());
}
else
throw std::logic_error(fileLocationExceptionMsg("Error: Could not determine type of value at row ", cells.get_count(), inFile.tellg() % cols + 1));
@@ -129,7 +129,7 @@ Table::~Table() {
}
unsigned Table::get_rows() const {
- return cells.get_length();
+ return cells.get_count();
}
unsigned Table::get_cols() const {
@@ -162,7 +162,7 @@ void Table::putCell(unsigned row, unsigned col, const char* rawValue) {
List<String> Table::getAllCells() const {
List<String> toRet;
- for (unsigned i = 0; i < cells.get_length(); i++) {
+ for (unsigned i = 0; i < cells.get_count(); i++) {
for (unsigned j = 0; j < cells[i].get_length(); j++) {
std::cout << i << ' ' << j << std::endl;
if (cells[i][j] == nullptr) toRet.add("");