tbl->cols_to_output = cols_to_output;
}
+
+int table_col_is_printed(struct table *tbl, uint col_idx)
+{
+ for(uint i = 0; i < tbl->cols_to_output; i++) {
+ if(tbl->column_order[i] == col_idx) return 1;
+ }
+
+ return 0;
+}
+
/**
* TODO: This function deliberately leaks memory. When it is called multiple times,
* previous column orders still remain allocated in the table's memory pool.
**/
void table_set_col_order(struct table *tbl, int *col_order, int col_order_size);
+/**
+ * Returns 1 if col_idx will be printed, 0 otherwise.
+ **/
+int table_col_is_printed(struct table *tbl, uint col_idx);
+
/**
* Sets the order in which the columns are printed. The specification is a string with comma-separated column
* names. Returns NULL for success and an error message otherwise. The string is not referenced after
*
* A formatter is described by a structure, which contains pointers to several
* call-back functions, which are called by the table printer at specific occasions.
-
+ *
* The formatter can keep its internal state in the `data` field of `struct table`
* and allocate temporary data from the table's memory pool. Memory allocated in
* the `row_output` call-back is freed before the next row begins. Memory allocated