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

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.11    ! paf         6:        $Id: pa_table.h,v 1.10 2001/03/11 08:16:33 paf Exp $
1.1       paf         7: */
                      8: 
1.2       paf         9: /*
1.11    ! paf        10:        hence most of tables are "named", no need to uptimize nameless onces
1.2       paf        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.11    ! paf        26:        Table(Pool& apool,
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: 
1.11    ! paf        40:        const String *item(const String& column_name);
1.2       paf        41: 
                     42: protected:
1.1       paf        43: 
1.5       paf        44:        // the base origin of table's data
                     45:        Origin forigin;
                     46: 
1.1       paf        47:        // column name->number lookup table
                     48:        Hash name2number;
                     49: 
1.5       paf        50:        // current row
                     51:        int fcurrent;
                     52: 
                     53:        // columns
                     54:        Array *fcolumns;
                     55: 
1.7       paf        56:        const Array& at(int index);
1.2       paf        57: 
1.11    ! paf        58:        const String *item(int column_index) {
        !            59:                return at(fcurrent).get_string(column_index);
        !            60:        }
1.1       paf        61: };
                     62: 
                     63: #endif

E-mail: