blob: bcaffb77a87339be251e8c2b98c24661f02cc465 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include "Table.h"
#include "CellDouble.h"
#include "CellInt.h"
#include "CellString.h"
#include "CellFormula.h"
#include <cstring>
Table::Table(unsigned rows, unsigned cols) {
cells = List<List<Cell*>>(rows);
for (unsigned i = 0; i < rows; i++)
cells[i] = List<Cell*>(cols);
}
bool containsNumber(const char*& str) {
while (*str == ' ') str++;
return ((*str == '+' || *str == '-') && (*(str + 1) >= '0' && *(str + 1) <= '9')) ||
(*str >= '0' && *str <= '9');
}
void Table::putCell(unsigned row, unsigned col, const char* rawValue) {
unsigned intParse = atoi(rawValue);
unsigned doubleParse = atof(rawValue);
Cell* newCell;
if (doubleParse - intParse > 0.00001 && doublePrase > 0.00001)
newCell = new CellDouble(doubleParse);
else if (intParse )
newCell =
}
|