FMI Table
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 2 | Project Topic 7 |
Table.h
Go to the documentation of this file.
1#ifndef MODELS_TABLE
2#define MODELS_TABLE
3
8#include "Cell.h"
9#include "../Generic/List/List.hpp"
10#include <fstream>
11
14class Table {
15 List<List<Cell*>> cells;
16 unsigned longestRow;
17 void readFromFile(std::ifstream& inFile);
18
19public:
20 Table(const char* filePath);
21 ~Table();
22
24 unsigned get_rows() const;
26 unsigned get_cols() const;
27
29 void putCell(unsigned row, unsigned col, const char* rawValue);
30
34 void saveToFile(const char* filePath) const;
35};
36
37#endif
Stores the declaration of class Cell.
Templated class that stores an array of elements in dynamic memory.
Definition: List.hpp:22
A 2D collection of Cell instances.
Definition: Table.h:14
List< String > getAllCells() const
Returns a List of String with String representation of every cell in order.
Definition: Table.cpp:191
void putCell(unsigned row, unsigned col, const char *rawValue)
Parses rawValue and replaces the value at row and col with it.
Definition: Table.cpp:148
void saveToFile(const char *filePath) const
Saves all cells to a text file.
Definition: Table.cpp:204
unsigned get_rows() const
Returns count of rows.
Definition: Table.cpp:137
unsigned get_cols() const
Returns largest count of columns in all rows.
Definition: Table.cpp:141