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