--- parser3/src/main/pa_table.C 2015/07/28 14:42:44 1.65 +++ parser3/src/main/pa_table.C 2020/12/15 17:10:37 1.71 @@ -1,13 +1,13 @@ /** @file Parser: table class. - Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2020 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ #include "pa_table.h" -volatile const char * IDENT_PA_TABLE_C="$Id: pa_table.C,v 1.65 2015/07/28 14:42:44 moko Exp $" IDENT_PA_TABLE_H; +volatile const char * IDENT_PA_TABLE_C="$Id: pa_table.C,v 1.71 2020/12/15 17:10:37 moko Exp $" IDENT_PA_TABLE_H; #include "pa_exception.h" @@ -44,6 +44,16 @@ Table::Table(const Table& src, Action_op ((Table &)src).table_for_each(append_row, this, options); } +size_t Table::max_cells() const { + size_t result=0; + for(size_t i=0; icount()>result) + result=row->count(); + } + return result; +} + int Table::column_name2index(const String& column_name, bool bark) const { if(fcolumns) {// named int result=name2number->get(column_name)-1; // -1 = column not found @@ -76,6 +86,16 @@ void Table::put_item(size_t column, cons row->put(column, value); } +void Table::remove_current(){ + if(!valid(fcurrent)) { + throw Exception(PARSER_RUNTIME, 0, "invalid current row"); + } + remove(fcurrent); + if(fcurrent==count() && count()>0){ + fcurrent--; + } +} + #ifndef DOXYGEN struct Locate_int_string_info { int column;