summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/libsmartcols.h.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:32 +0000
commit8bb05ac73a5b448b339ce0bc8d396c82c459b47f (patch)
tree1fdda006866bca20d41cb206767ea5241e36852f /libsmartcols/src/libsmartcols.h.in
parentAdding debian version 2.39.3-11. (diff)
downloadutil-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.tar.xz
util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.zip
Merging upstream version 2.40.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libsmartcols/src/libsmartcols.h.in')
-rw-r--r--libsmartcols/src/libsmartcols.h.in95
1 files changed, 95 insertions, 0 deletions
diff --git a/libsmartcols/src/libsmartcols.h.in b/libsmartcols/src/libsmartcols.h.in
index f5820e9..c97651f 100644
--- a/libsmartcols/src/libsmartcols.h.in
+++ b/libsmartcols/src/libsmartcols.h.in
@@ -67,6 +67,29 @@ struct libscols_table;
*/
struct libscols_column;
+/**
+ * libscols_filter:
+ *
+ * A filter - defines the filtering
+ */
+struct libscols_filter;
+
+/**
+ * libscols_counter:
+ *
+ * A filter counter
+ */
+struct libscols_counter;
+
+enum {
+ SCOLS_COUNTER_COUNT = 0,
+ SCOLS_COUNTER_MAX,
+ SCOLS_COUNTER_MIN,
+ SCOLS_COUNTER_SUM,
+
+ __SCOLS_NCOUNTES
+};
+
/* iter.c */
enum {
@@ -97,6 +120,18 @@ enum {
SCOLS_JSON_ARRAY_STRING = 3, /* e.g. for multi-line (SCOLS_FL_WRAP) cells */
SCOLS_JSON_ARRAY_NUMBER = 4,
SCOLS_JSON_BOOLEAN_OPTIONAL = 5,
+ SCOLS_JSON_FLOAT = 6
+};
+
+/*
+ * Types used by filters and counters
+ */
+enum {
+ SCOLS_DATA_NONE = 0, /* default */
+ SCOLS_DATA_U64, /* uint64_t */
+ SCOLS_DATA_BOOLEAN, /* 0 or 1 */
+ SCOLS_DATA_FLOAT, /* long double */
+ SCOLS_DATA_STRING
};
/*
@@ -146,7 +181,11 @@ extern int scols_cell_copy_content(struct libscols_cell *dest,
const struct libscols_cell *src);
extern int scols_cell_set_data(struct libscols_cell *ce, const char *data);
extern int scols_cell_refer_data(struct libscols_cell *ce, char *data);
+extern int scols_cell_refer_memory(struct libscols_cell *ce, char *data, size_t datasiz);
+
extern const char *scols_cell_get_data(const struct libscols_cell *ce);
+extern size_t scols_cell_get_datasiz(struct libscols_cell *ce);
+
extern int scols_cell_set_color(struct libscols_cell *ce, const char *color);
extern const char *scols_cell_get_color(const struct libscols_cell *ce);
@@ -159,6 +198,7 @@ extern int scols_cell_set_userdata(struct libscols_cell *ce, void *data);
extern int scols_cmpstr_cells(struct libscols_cell *a,
struct libscols_cell *b, void *data);
+
/* column.c */
extern int scols_column_is_tree(const struct libscols_column *cl);
extern int scols_column_is_trunc(const struct libscols_column *cl);
@@ -177,6 +217,9 @@ extern const char *scols_column_get_safechars(const struct libscols_column *cl);
extern int scols_column_set_json_type(struct libscols_column *cl, int type);
extern int scols_column_get_json_type(const struct libscols_column *cl);
+extern int scols_column_set_data_type(struct libscols_column *cl, int type);
+extern int scols_column_get_data_type(const struct libscols_column *cl);
+
extern int scols_column_set_flags(struct libscols_column *cl, int flags);
extern int scols_column_get_flags(const struct libscols_column *cl);
extern struct libscols_column *scols_new_column(void);
@@ -193,6 +236,7 @@ extern struct libscols_table *scols_column_get_table(const struct libscols_colum
extern int scols_column_set_name(struct libscols_column *cl, const char *name);
extern const char *scols_column_get_name(struct libscols_column *cl);
extern const char *scols_column_get_name_as_shellvar(struct libscols_column *cl);
+extern int scols_shellvar_name(const char *name, char **buf, size_t *bufsz);
extern int scols_column_set_properties(struct libscols_column *cl, const char *opts);
@@ -208,9 +252,21 @@ extern int scols_column_set_wrapfunc(struct libscols_column *cl,
char *, void *),
void *userdata);
+extern int scols_column_set_data_func(struct libscols_column *cl,
+ void *(*datafunc)(const struct libscols_column *,
+ struct libscols_cell *,
+ void *),
+ void *userdata);
+extern int scols_column_has_data_func(struct libscols_column *cl);
+
extern char *scols_wrapnl_nextchunk(const struct libscols_column *cl, char *data, void *userdata);
extern size_t scols_wrapnl_chunksize(const struct libscols_column *cl, const char *data, void *userdata);
+extern char *scols_wrapzero_nextchunk(const struct libscols_column *cl, char *data, void *userdata);
+
+extern int scols_column_get_wrap_data(const struct libscols_column *cl,
+ char **data, size_t *datasiz, char **cur, char **next);
+
/* line.c */
extern struct libscols_line *scols_new_line(void);
extern void scols_ref_line(struct libscols_line *ln);
@@ -235,6 +291,7 @@ extern struct libscols_cell *scols_line_get_column_cell(
struct libscols_column *cl);
extern int scols_line_set_data(struct libscols_line *ln, size_t n, const char *data);
extern int scols_line_refer_data(struct libscols_line *ln, size_t n, char *data);
+extern int scols_line_is_filled(struct libscols_line *ln, size_t n);
extern int scols_line_set_column_data(struct libscols_line *ln, struct libscols_column *cl, const char *data);
extern const char *scols_line_get_column_data(struct libscols_line *ln, struct libscols_column *cl);
extern int scols_line_refer_column_data(struct libscols_line *ln, struct libscols_column *cl, char *data);
@@ -310,6 +367,12 @@ extern int scols_table_reduce_termwidth(struct libscols_table *tb, size_t reduce
extern int scols_sort_table(struct libscols_table *tb, struct libscols_column *cl);
extern int scols_sort_table_by_tree(struct libscols_table *tb);
+
+extern int scols_table_get_cursor(struct libscols_table *tb,
+ struct libscols_line **ln,
+ struct libscols_column **cl,
+ struct libscols_cell **ce);
+
/*
*
*/
@@ -342,6 +405,38 @@ extern int scols_table_print_range_to_string( struct libscols_table *tb,
int scols_line_link_group(struct libscols_line *ln, struct libscols_line *member, int id);
int scols_table_group_lines(struct libscols_table *tb, struct libscols_line *ln,
struct libscols_line *member, int id);
+
+/* filter.c */
+extern int scols_filter_parse_string(struct libscols_filter *fltr, const char *str);
+extern struct libscols_filter *scols_new_filter(const char *str);
+extern void scols_ref_filter(struct libscols_filter *fltr);
+extern void scols_unref_filter(struct libscols_filter *fltr);
+extern int scols_dump_filter(struct libscols_filter *fltr, FILE *out);
+extern const char *scols_filter_get_errmsg(struct libscols_filter *fltr);
+
+extern int scols_line_apply_filter(struct libscols_line *ln,
+ struct libscols_filter *fltr, int *status);
+
+extern int scols_filter_next_holder(struct libscols_filter *fltr,
+ struct libscols_iter *itr, const char **name, int type);
+extern int scols_filter_assign_column(struct libscols_filter *fltr,
+ struct libscols_iter *itr,
+ const char *name, struct libscols_column *col);
+extern int scols_filter_set_filler_cb(struct libscols_filter *fltr,
+ int (*cb)(struct libscols_filter *,
+ struct libscols_line *, size_t, void *),
+ void *userdata);
+
+extern struct libscols_counter *scols_filter_new_counter(struct libscols_filter *fltr);
+extern int scols_counter_set_name(struct libscols_counter *ct, const char *name);
+extern int scols_counter_set_param(struct libscols_counter *ct, const char *name);
+extern int scols_counter_set_func(struct libscols_counter *ct, int func);
+
+extern unsigned long long scols_counter_get_result(struct libscols_counter *ct);
+extern const char *scols_counter_get_name(struct libscols_counter *ct);
+extern int scols_filter_next_counter(struct libscols_filter *fltr,
+ struct libscols_iter *itr, struct libscols_counter **ct);
+
#ifdef __cplusplus
}
#endif