Top |
const char * | scols_counter_get_name () |
unsigned long long | scols_counter_get_result () |
int | scols_counter_set_func () |
int | scols_counter_set_name () |
int | scols_counter_set_param () |
int | scols_dump_filter () |
int | scols_filter_assign_column () |
const char * | scols_filter_get_errmsg () |
struct libscols_counter * | scols_filter_new_counter () |
int | scols_filter_next_counter () |
int | scols_filter_next_holder () |
int | scols_filter_parse_string () |
int | scols_filter_set_filler_cb () |
int | scols_line_apply_filter () |
int | scols_line_is_filled () |
struct libscols_filter * | scols_new_filter () |
void | scols_ref_filter () |
void | scols_unref_filter () |
const char *
scols_counter_get_name (struct libscols_counter *ct
);
Since: 2.40
unsigned long long
scols_counter_get_result (struct libscols_counter *ct
);
Since: 2.40
int scols_counter_set_func (struct libscols_counter *ct
,int func
);
Defines function to calculate data.
Since: 2.40
int scols_counter_set_name (struct libscols_counter *ct
,const char *name
);
The name is not use by library, it's just description usable for application when prints results from countes.
Since: 2.40
int scols_counter_set_param (struct libscols_counter *ct
,const char *name
);
Assigns a counter to the column. The name is used in the same way as names in the filter expression. This is usable for counter that calcuate with data from table cells (e.g. max, sum, etc.)
Since: 2.40
int scols_dump_filter (struct libscols_filter *fltr
,FILE *out
);
Dumps internal filter nodes in JSON format. This function is mostly designed for debugging purpose. The fileds in the output are subject to change.
Since: 2.40
int scols_filter_assign_column (struct libscols_filter *fltr
,struct libscols_iter *itr
,const char *name
,struct libscols_column *col
);
Assign col
to filter parametr. The parametr is addressed by itr
or by
name
. See scols_filter_next_holder()
.
Since: 2.40
const char *
scols_filter_get_errmsg (struct libscols_filter *fltr
);
Since: 2.40
struct libscols_counter *
scols_filter_new_counter (struct libscols_filter *fltr
);
Alocates a new counter instance into the filter.
Since: 2.40
int scols_filter_next_counter (struct libscols_filter *fltr
,struct libscols_iter *itr
,struct libscols_counter **ct
);
Finds the next counter and returns a pointer to it via ct
.
fltr |
filter instance |
|
itr |
a pointer to a struct libscols_iter instance |
|
ct |
returns the next counter |
Since: 2.40
int scols_filter_next_holder (struct libscols_filter *fltr
,struct libscols_iter *itr
,const char **name
,int type
);
Finds the next holder used in the expression and and returns a name via
name
. The currently supported holder type is only column name.
fltr |
filter instance |
|
itr |
a pointer to a struct libscols_iter instance |
|
name |
returns the next column name |
|
type |
0 (not implemented yet) |
Since: 2.40
int scols_filter_parse_string (struct libscols_filter *fltr
,const char *str
);
Parses filter, see scols_filter_get_errmsg()
for errors.
Since: 2.40
int scols_filter_set_filler_cb (struct libscols_filter *fltr
,int (*cb) (struct libscols_filter *, struct libscols_line *, size_t, void *)
,void *userdata
);
The application can apply filter for empty lines to avoid filling the table with unnecessary data (for example if the line will be later removed from the table due to filter).
This callback is used by filter to ask application to fill to the line data which are necessary to evaluate the filter expression. The callback arguments are filter, column number and userdata.
1 2 3 4 5 6 7 8 9 10 11 12 |
ln = scols_table_new_line(tab, NULL); scols_filter_set_filler_cb(filter, my_filler, NULL); scols_line_apply_filter(line, filter, &status); if (status == 0) scols_table_remove_line(tab, line); else for (i = 0; i < ncolumns; i++) { if (scols_line_is_filled(line, i)) continue; my_filler(NULL, ln, i, NULL); } |
fltr |
filter instance |
|
cb |
application defined callback |
|
userdata |
pointer to private callback data |
Since: 2.40
int scols_line_apply_filter (struct libscols_line *ln
,struct libscols_filter *fltr
,int *status
);
Applies filter (and also counters assisiated with the filter).
ln |
apply filter to the line |
|
fltr |
filter instance |
|
status |
return 1 or 0 as result of the expression |
Since: 2.40
struct libscols_filter *
scols_new_filter (const char *str
);
Allocated and optionally parses a new filter.
Since: 2.40
void
scols_ref_filter (struct libscols_filter *fltr
);
Increment filter reference counter.
Since: 2.40
void
scols_unref_filter (struct libscols_filter *fltr
);
Deincrements reference counter, unallocates the filter for the last reference.
Since: 2.40