--- parser3/src/main/pa_table.C 2001/08/10 07:04:44 1.35 +++ parser3/src/main/pa_table.C 2001/11/22 15:47:12 1.41 @@ -2,10 +2,10 @@ Parser: table class. Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexander Petrosyan (http://paf.design.ru) - Author: Alexander Petrosyan (http://design.ru/paf) + $Id: pa_table.C,v 1.41 2001/11/22 15:47:12 paf Exp $ */ -static const char *RCSId="$Id: pa_table.C,v 1.35 2001/08/10 07:04:44 parser Exp $"; #include @@ -35,17 +35,18 @@ int Table::column_name2index(const Strin if(fcolumns) {// named int result=name2number.get_int(column_name)-1; // -1 = column not found if(bark && result<0) - THROW(0, 0, + throw Exception(0, 0, &column_name, "column not found"); return result; } else { // nameless - char *error_pos=0; - int result=(int)strtol(column_name.cstr(), &error_pos, 0); - if(error_pos && *error_pos) { - result=-1; // calm, compiler + char *error_pos; + const char *cstr=column_name.cstr(); + int result=(int)strtol(cstr, &error_pos, 0); + if(*error_pos/*not EOS*/) { + result=-1; if(bark) - THROW(0, 0, + throw Exception(0, 0, &column_name, "invalid column number"); } @@ -78,7 +79,7 @@ bool Table::locate(const String& column, return locate(column_name2index(column, true), value); } -void Table::shift(int offset) { +void Table::offset(bool absolute, int offset) { if(size()) - fcurrent=(fcurrent+offset+size())%size(); + fcurrent=((absolute?0:fcurrent)+offset+size())%size(); }