|
|
| version 1.3, 2001/01/29 20:46:22 | version 1.8, 2001/02/20 18:45:51 |
|---|---|
| Line 19 | Line 19 |
| class Table : public Array { | class Table : public Array { |
| public: | public: |
| // request I'm processed on | Table(Request& arequest, |
| Request& request; | |
| // the base origin of table data | |
| Origin origin; | |
| int current; | |
| // columns | |
| Array *columns; | |
| Table(Request& request, | |
| char *afile, uint aline, | char *afile, uint aline, |
| Array *acolumns, | Array *acolumns, |
| int initial_rows=CR_INITIAL_ROWS_DEFAULT); | int initial_rows=CR_INITIAL_ROWS_DEFAULT); |
| const char *item(int column_index); | // the base origin of table's data |
| const char *item(String column_name); | //const Origin& origin() { return forigin; } |
| const Array *columns() { return fcolumns; } | |
| void set_current(int acurrent) { fcurrent=acurrent; } | |
| int get_current() { return fcurrent; } | |
| void inc_current() { fcurrent++; } | |
| void read_item(String& result, const String& column_name) { | |
| result.APPEND(item(column_name), 0/*TODO:think about*/, forigin.file, forigin.line+fcurrent); | |
| } | |
| protected: | protected: |
| // the request I'm processed on. for error reporting | |
| Request& request; | |
| // the base origin of table's data | |
| Origin forigin; | |
| // column name->number lookup table | // column name->number lookup table |
| Hash name2number; | Hash name2number; |
| const Array *at(int index); | // current row |
| int fcurrent; | |
| // columns | |
| Array *fcolumns; | |
| const Array& at(int index); | |
| const char *item(int column_index); | |
| const char *item(const String& column_name); | |
| }; | }; |
| #endif | #endif |