--- parser3/src/main/pa_table.C 2001/03/25 09:10:30 1.18 +++ parser3/src/main/pa_table.C 2001/03/26 10:36:56 1.19 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_table.C,v 1.18 2001/03/25 09:10:30 paf Exp $ + $Id: pa_table.C,v 1.19 2001/03/26 10:36:56 paf Exp $ */ #include @@ -56,3 +56,44 @@ const String *Table::item(const String& return item(column_index); } + +void Table::save(bool nameless_save, const String& file_spec) { + String sdata(pool()); + if(!nameless_save) { // not nameless=named output + // write out names line + if(fcolumns) { // named table + for(int column=0; columnsize(); column++) { + if(column) + sdata.APPEND_CONST("\t"); + sdata.append(*static_cast(fcolumns->quick_get(column)), + String::UL_TABLE); + } + } else { // nameless table + int lsize=size()?static_cast(get(0))->size():0; + if(lsize) + for(int column=0; column(quick_get(index)); + for(int column=0; columnsize(); column++) { + if(column) + sdata.APPEND_CONST("\t"); + sdata.append(*static_cast(row->quick_get(column)), + String::UL_TABLE); + } + sdata.APPEND_CONST("\n"); + } + + // write + char *cdata=sdata.cstr(); + file_write(pool(), file_spec, cdata, strlen(cdata), true); +} \ No newline at end of file