Annotation of parser3/src/include/pa_table.h, revision 1.5

1.1       paf         1: /*
1.5     ! paf         2:   $Id: pa_table.h,v 1.4 2001/01/29 21:51:52 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.2       paf        22:        Table(Request& request,
                     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) {
        !            37:                result.APPEND(item(column_name), forigin.file, forigin.line+fcurrent);
        !            38:        }
1.2       paf        39: 
                     40: protected:
1.1       paf        41: 
1.5     ! paf        42:        // request I'm processed on
        !            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.3       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: