format-table: add new table_get_current_column() helper
This commit is contained in:
committed by
Luca Boccassi
parent
f4ae435bec
commit
07f314575b
@@ -2577,6 +2577,14 @@ size_t table_get_columns(Table *t) {
|
||||
return t->n_columns;
|
||||
}
|
||||
|
||||
size_t table_get_current_column(Table *t) {
|
||||
if (!t)
|
||||
return 0;
|
||||
|
||||
assert(t->n_columns > 0);
|
||||
return t->n_cells % t->n_columns;
|
||||
}
|
||||
|
||||
int table_set_reverse(Table *t, size_t column, bool b) {
|
||||
assert(t);
|
||||
assert(column < t->n_columns);
|
||||
|
||||
@@ -141,6 +141,8 @@ static inline TableCell* TABLE_HEADER_CELL(size_t i) {
|
||||
size_t table_get_rows(Table *t);
|
||||
size_t table_get_columns(Table *t);
|
||||
|
||||
size_t table_get_current_column(Table *t);
|
||||
|
||||
TableCell *table_get_cell(Table *t, size_t row, size_t column);
|
||||
|
||||
const void *table_get(Table *t, TableCell *cell);
|
||||
|
||||
Reference in New Issue
Block a user