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);
+
/*
*
*/
scols_table_enable_shellvar;
} SMARTCOLS_2.35;
-
SMARTCOLS_2.39 {
scols_column_set_properties;
scols_table_get_column_by_name;
} SMARTCOLS_2.38;
+
+SMARTCOLS_2.40 {
+ scols_table_get_cursor;
+} SMARTCOLS_2.39;
const char *cur_color; /* current active color when printing */
+ struct libscols_cell *cur_cell; /* currently used cell */
+ struct libscols_line *cur_line; /* currently used line */
+ struct libscols_column *cur_column; /* currently used column */
+
/* flags */
unsigned int ascii :1, /* don't use unicode */
colors_wanted :1, /* enable colors */
int scols_table_next_group(struct libscols_table *tb,
struct libscols_iter *itr,
struct libscols_group **gr);
+int scols_table_set_cursor(struct libscols_table *tb,
+ struct libscols_line *ln,
+ struct libscols_column *cl,
+ struct libscols_cell *ce);
+
/*
* grouping.c
return tb->nlines;
}
+
+int scols_table_set_cursor(struct libscols_table *tb,
+ struct libscols_line *ln,
+ struct libscols_column *cl,
+ struct libscols_cell *ce)
+{
+ if (!tb)
+ return -EINVAL;
+
+ tb->cur_line = ln;
+ tb->cur_column = cl;
+ tb->cur_cell = ce;
+
+ return 0;
+}
+
+/**
+ * scols_table_get_cursor:
+ * @tb: table
+ * @ln: returns current line (optional)
+ * @cl: returns current column (optional)
+ * @ce: returns current cell (optional)
+ *
+ * Returns: 0 on success, negative number in case of error.
+ *
+ * Since: 2.40
+ */
+int scols_table_get_cursor(struct libscols_table *tb,
+ struct libscols_line **ln,
+ struct libscols_column **cl,
+ struct libscols_cell **ce)
+{
+ if (!tb)
+ return -EINVAL;
+
+ if (ln)
+ *ln = tb->cur_line;
+ if (cl)
+ *cl = tb->cur_column;
+ if (ce)
+ *ce = tb->cur_cell;
+ return 0;
+}
+
/**
* scols_table_set_stream:
* @tb: table