Diff for /parser3/src/include/pa_table.h between versions 1.6 and 1.22

version 1.6, 2001/01/30 13:07:31 version 1.22, 2001/03/26 09:53:42
Line 1 Line 1
 /*  /** @file
   $Id$          Parser: table class decl.
 */  
   
 /*          Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
         hence most of tables are "named", no need to uptimize unnamed onces  
 */  
   
           Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
   
           $Id$
   */
   
 #ifndef PA_TABLE_H  #ifndef PA_TABLE_H
 #define PA_TABLE_H  #define PA_TABLE_H
Line 16 Line 17
 #include "pa_string.h"  #include "pa_string.h"
 #include "pa_request.h"  #include "pa_request.h"
   
   /** 
           VTable backend.
   
           holds:
           - column names[if any]
           - data rows
           - current row pointer
   
           uses String for column names and data items
   
           hence most of tables are "named", no need to uptimize nameless onces
   */
 class Table : public Array {  class Table : public Array {
 public:  public:
   
         Table(Request& arequest,          Table(Pool& apool,
                 char *afile, uint aline,                  const String *aorigin,
                 Array *acolumns,                  Array *acolumns,
                 int initial_rows=CR_INITIAL_ROWS_DEFAULT);                  int initial_rows=CR_INITIAL_ROWS_DEFAULT);
   
         // the base origin of table's data          /// where this table came from, may be NULL
         //const Origin& origin() { return forigin; }          const String *origin_string() { return forigin_string; }
   
           /// column names
         const Array *columns() { return fcolumns; }          const Array *columns() { return fcolumns; }
   
           /// moves @a current pointer
         void set_current(int acurrent) { fcurrent=acurrent; }          void set_current(int acurrent) { fcurrent=acurrent; }
           /// @return current pointer
         int get_current() { return fcurrent; }          int get_current() { return fcurrent; }
         void inc_current() { fcurrent++; }  
   
         void read_item(String& result, const String& column_name) {  
                 result.APPEND(item(column_name), forigin.file, forigin.line+fcurrent);  
         }  
   
 protected:          /// @return item from @a column_name
           const String *item(const String& column_name);
   
         // the request I'm processed on. for error reporting  private:
         Request& request;          
           // where this table came from, may be NULL
         // the base origin of table's data          const String *forigin_string;
         Origin forigin;  
   
         // column name->number lookup table          // column name->number lookup table
         Hash name2number;          Hash name2number;
Line 54  protected: Line 65  protected:
         // columns          // columns
         Array *fcolumns;          Array *fcolumns;
   
         const Array *at(int index);          bool valid(int index) { return index>=0 && index<size(); }
   
           const Array& at(int index);
   
         const char *item(int column_index);          const String *item(int column_index) {
         const char *item(const String& column_name);                  return valid(fcurrent)?at(fcurrent).get_string(column_index):0;
           }
 };  };
   
 #endif  #endif

Removed from v.1.6  
changed lines
  Added in v.1.22


E-mail: