void table_column_range(Table tab, int *xmin, int *xmax) { Vector rows = tab->rows; int low=0, high=0; int y, ymin, ymax; int first = TRUE; table_row_range(tab, &ymin, &ymax); for(y=ymin; y<=ymax; y++) { TableRow row = getElementVector(rows, toInt(y)); if ( row && notNil(row) ) { int l = valInt(getLowIndexVector((Vector)row)); int h = valInt(getHighIndexVector((Vector)row)); if ( first ) { low = l; high = h; first = FALSE; } else { low = min(low, l); high = max(high, h); } } } *xmin = low; *xmax = high; }
static TableCell getCellTable(Table tab, Any x, Any y) { TableRow row = getRowTable(tab, y, OFF); if ( row && notNil(row) ) { TableCell cell = NULL; if ( isInteger(x) ) { cell = getElementVector((Vector)row, x); } else { TableColumn col = getColumnTable(tab, x, OFF); if ( col ) cell = getElementVector((Vector)row, col->index); } if ( cell && notNil(cell) ) answer(cell); } fail; }
TableRow getRowTable(Table tab, Any y, BoolObj create) { if ( isInteger(y) ) { TableRow row = getElementVector(tab->rows, y); if ( isNil(row) ) row = FAIL; if ( !row && create == ON ) { elementVector(tab->rows, y, (row=newObject(ClassTableRow, EAV))); assign(row, table, tab); assign(row, index, y); } return row; } answer(findNamedSlice(tab->rows, y)); }
TableColumn getColumnTable(Table tab, Any x, BoolObj create) { if ( isInteger(x) ) { TableColumn col = getElementVector(tab->columns, x); if ( isNil(col) ) col = FAIL; if ( !col && create == ON ) { elementVector(tab->columns, x, (col=newObject(ClassTableColumn, EAV))); assign(col, table, tab); assign(col, index, x); } return col; } answer(findNamedSlice(tab->columns, x)); }
vector<string> Configurable::getElementVector(Configurator&c, const char * key, const xmlNode * node) { return getElementVector(c.doc, key,node); }