Annotation of parser3/src/include/pa_table.h, revision 1.8
1.1 paf 1: /*
1.8 ! paf 2: $Id: pa_table.h,v 1.7 2001/01/30 13:43:43 paf Exp $
1.1 paf 3: */
4:
1.2 paf 5: /*
6: hence most of tables are "named", no need to uptimize unnamed onces
7: */
8:
9:
1.1 paf 10: #ifndef PA_TABLE_H
11: #define PA_TABLE_H
12:
13: #include "pa_types.h"
14: #include "pa_array.h"
15: #include "pa_hash.h"
1.2 paf 16: #include "pa_string.h"
17: #include "pa_request.h"
1.1 paf 18:
19: class Table : public Array {
20: public:
21:
1.6 paf 22: Table(Request& arequest,
1.2 paf 23: char *afile, uint aline,
24: Array *acolumns,
25: int initial_rows=CR_INITIAL_ROWS_DEFAULT);
26:
1.5 paf 27: // the base origin of table's data
28: //const Origin& origin() { return forigin; }
29:
30: const Array *columns() { return fcolumns; }
31:
32: void set_current(int acurrent) { fcurrent=acurrent; }
33: int get_current() { return fcurrent; }
34: void inc_current() { fcurrent++; }
35:
36: void read_item(String& result, const String& column_name) {
1.8 ! paf 37: result.APPEND(item(column_name), 0/*TODO:think about*/, forigin.file, forigin.line+fcurrent);
1.5 paf 38: }
1.2 paf 39:
40: protected:
1.1 paf 41:
1.6 paf 42: // the request I'm processed on. for error reporting
1.5 paf 43: Request& request;
44:
45: // the base origin of table's data
46: Origin forigin;
47:
1.1 paf 48: // column name->number lookup table
49: Hash name2number;
50:
1.5 paf 51: // current row
52: int fcurrent;
53:
54: // columns
55: Array *fcolumns;
56:
1.7 paf 57: const Array& at(int index);
1.2 paf 58:
1.5 paf 59: const char *item(int column_index);
60: const char *item(const String& column_name);
1.1 paf 61: };
62:
63: #endif
E-mail: