summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/smartcolsP.h
diff options
context:
space:
mode:
authorKarel Zak2014-05-20 15:04:11 +0200
committerKarel Zak2014-05-20 15:04:11 +0200
commit57a86f9bff68f24b167df9c571a09c6b89712296 (patch)
treeb5872b3929c083b96c14fa0140157c59f8e78d2d /libsmartcols/src/smartcolsP.h
parentsetterm: fix 'bright' in usage, remove unnecessary error message (diff)
downloadkernel-qcow2-util-linux-57a86f9bff68f24b167df9c571a09c6b89712296.tar.gz
kernel-qcow2-util-linux-57a86f9bff68f24b167df9c571a09c6b89712296.tar.xz
kernel-qcow2-util-linux-57a86f9bff68f24b167df9c571a09c6b89712296.zip
libsmartcols: add scols_sort_table()
* add pointer to column cmp() function [scols_column_set_cmpfunc()] * allow to store per-cell application private data (to make it possible to sort tables on data independent on cell output data) [scols_cell_set_userdata() ...] * make it possible to access line cell by column [scols_line_get_column_cell()] Sort and cmp() stuff based on patches from Shakur Shams Mullick. Co-Author: Shakur Shams Mullick <shakursmullick@gmail.com> Signed-off-by: Shakur Shams Mullick <shakursmullick@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/smartcolsP.h')
-rw-r--r--libsmartcols/src/smartcolsP.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/libsmartcols/src/smartcolsP.h b/libsmartcols/src/smartcolsP.h
index ebdc9295f..613ddd587 100644
--- a/libsmartcols/src/smartcolsP.h
+++ b/libsmartcols/src/smartcolsP.h
@@ -63,6 +63,7 @@ struct libscols_symbols {
struct libscols_cell {
char *data;
char *color;
+ void *userdata;
};
@@ -83,6 +84,11 @@ struct libscols_column {
int is_extreme;
char *color; /* default column color */
+ int (*cmpfunc)(struct libscols_cell *,
+ struct libscols_cell *,
+ void *); /* cells comparison function */
+ void *cmpfunc_data;
+
struct libscols_cell header;
struct list_head cl_columns;
};