*
* Returns: The width hint of column @cl, a negative value in case of an error.
*/
-double scols_column_get_whint(struct libscols_column *cl)
+double scols_column_get_whint(const struct libscols_column *cl)
{
return cl->width_hint;
}
*
* Returns: The flag mask of @cl, a negative value in case of an error.
*/
-int scols_column_get_flags(struct libscols_column *cl)
+int scols_column_get_flags(const struct libscols_column *cl)
{
return cl->flags;
}
*
* Returns: The current color setting of the column @cl.
*/
-const char *scols_column_get_color(struct libscols_column *cl)
+const char *scols_column_get_color(const struct libscols_column *cl)
{
return cl->color;
}
*
* Since: 2.27
*/
-int scols_column_is_hidden(struct libscols_column *cl)
+int scols_column_is_hidden(const struct libscols_column *cl)
{
return cl->flags & SCOLS_FL_HIDDEN ? 1 : 0;
}
*
* Returns: 0 or 1
*/
-int scols_column_is_trunc(struct libscols_column *cl)
+int scols_column_is_trunc(const struct libscols_column *cl)
{
return cl->flags & SCOLS_FL_TRUNC ? 1 : 0;
}
*
* Returns: 0 or 1
*/
-int scols_column_is_tree(struct libscols_column *cl)
+int scols_column_is_tree(const struct libscols_column *cl)
{
return cl->flags & SCOLS_FL_TREE ? 1 : 0;
}
*
* Returns: 0 or 1
*/
-int scols_column_is_right(struct libscols_column *cl)
+int scols_column_is_right(const struct libscols_column *cl)
{
return cl->flags & SCOLS_FL_RIGHT ? 1 : 0;
}
*
* Returns: 0 or 1
*/
-int scols_column_is_strict_width(struct libscols_column *cl)
+int scols_column_is_strict_width(const struct libscols_column *cl)
{
return cl->flags & SCOLS_FL_STRICTWIDTH ? 1 : 0;
}
*
* Returns: 0 or 1
*/
-int scols_column_is_noextremes(struct libscols_column *cl)
+int scols_column_is_noextremes(const struct libscols_column *cl)
{
return cl->flags & SCOLS_FL_NOEXTREMES ? 1 : 0;
}
*
* Since: 2.28
*/
-int scols_column_is_wrap(struct libscols_column *cl)
+int scols_column_is_wrap(const struct libscols_column *cl)
{
return cl->flags & SCOLS_FL_WRAP ? 1 : 0;
}
*
* Since: 2.29
*/
-int scols_column_is_wrapnl(struct libscols_column *cl)
+int scols_column_is_wrapnl(const struct libscols_column *cl)
{
return cl->flags & SCOLS_FL_WRAPNL ? 1 : 0;
}
extern struct libscols_iter *scols_new_iter(int direction);
extern void scols_free_iter(struct libscols_iter *itr);
extern void scols_reset_iter(struct libscols_iter *itr, int direction);
-extern int scols_iter_get_direction(struct libscols_iter *itr);
+extern int scols_iter_get_direction(const struct libscols_iter *itr);
/* init.c */
extern void scols_init_debug(int mask);
extern int scols_cmpstr_cells(struct libscols_cell *a,
struct libscols_cell *b, void *data);
/* column.c */
-extern int scols_column_is_tree(struct libscols_column *cl);
-extern int scols_column_is_trunc(struct libscols_column *cl);
-extern int scols_column_is_right(struct libscols_column *cl);
-extern int scols_column_is_strict_width(struct libscols_column *cl);
-extern int scols_column_is_hidden(struct libscols_column *cl);
-extern int scols_column_is_noextremes(struct libscols_column *cl);
-extern int scols_column_is_wrap(struct libscols_column *cl);
-extern int scols_column_is_wrapnl(struct libscols_column *cl);
+extern int scols_column_is_tree(const struct libscols_column *cl);
+extern int scols_column_is_trunc(const struct libscols_column *cl);
+extern int scols_column_is_right(const struct libscols_column *cl);
+extern int scols_column_is_strict_width(const struct libscols_column *cl);
+extern int scols_column_is_hidden(const struct libscols_column *cl);
+extern int scols_column_is_noextremes(const struct libscols_column *cl);
+extern int scols_column_is_wrap(const struct libscols_column *cl);
+extern int scols_column_is_wrapnl(const struct libscols_column *cl);
extern int scols_column_set_flags(struct libscols_column *cl, int flags);
-extern int scols_column_get_flags(struct libscols_column *cl);
+extern int scols_column_get_flags(const struct libscols_column *cl);
extern struct libscols_column *scols_new_column(void);
extern void scols_ref_column(struct libscols_column *cl);
extern void scols_unref_column(struct libscols_column *cl);
extern struct libscols_column *scols_copy_column(const struct libscols_column *cl);
extern int scols_column_set_whint(struct libscols_column *cl, double whint);
-extern double scols_column_get_whint(struct libscols_column *cl);
+extern double scols_column_get_whint(const struct libscols_column *cl);
extern struct libscols_cell *scols_column_get_header(struct libscols_column *cl);
extern int scols_column_set_color(struct libscols_column *cl, const char *color);
-extern const char *scols_column_get_color(struct libscols_column *cl);
+extern const char *scols_column_get_color(const struct libscols_column *cl);
extern int scols_column_set_cmpfunc(struct libscols_column *cl,
int (*cmp)(struct libscols_cell *a,
extern int scols_line_has_children(struct libscols_line *ln);
extern int scols_line_next_child(struct libscols_line *ln,
struct libscols_iter *itr, struct libscols_line **chld);
-extern struct libscols_line *scols_line_get_parent(struct libscols_line *ln);
+extern struct libscols_line *scols_line_get_parent(const struct libscols_line *ln);
extern int scols_line_set_color(struct libscols_line *ln, const char *color);
-extern const char *scols_line_get_color(struct libscols_line *ln);
-extern size_t scols_line_get_ncells(struct libscols_line *ln);
+extern const char *scols_line_get_color(const struct libscols_line *ln);
+extern size_t scols_line_get_ncells(const struct libscols_line *ln);
extern struct libscols_cell *scols_line_get_cell(struct libscols_line *ln, size_t n);
extern struct libscols_cell *scols_line_get_column_cell(
struct libscols_line *ln,
extern int scols_line_refer_data(struct libscols_line *ln, size_t n, char *data);
extern int scols_line_set_column_data(struct libscols_line *ln, struct libscols_column *cl, const char *data);
extern int scols_line_refer_column_data(struct libscols_line *ln, struct libscols_column *cl, char *data);
-extern struct libscols_line *scols_copy_line(struct libscols_line *ln);
+extern struct libscols_line *scols_copy_line(const struct libscols_line *ln);
/* table */
-extern int scols_table_colors_wanted(struct libscols_table *tb);
+extern int scols_table_colors_wanted(const struct libscols_table *tb);
extern int scols_table_set_name(struct libscols_table *tb, const char *name);
extern struct libscols_cell *scols_table_get_title(struct libscols_table *tb);
-extern int scols_table_is_raw(struct libscols_table *tb);
-extern int scols_table_is_ascii(struct libscols_table *tb);
-extern int scols_table_is_json(struct libscols_table *tb);
-extern int scols_table_is_noheadings(struct libscols_table *tb);
-extern int scols_table_is_empty(struct libscols_table *tb);
-extern int scols_table_is_export(struct libscols_table *tb);
-extern int scols_table_is_maxout(struct libscols_table *tb);
-extern int scols_table_is_tree(struct libscols_table *tb);
+extern int scols_table_is_raw(const struct libscols_table *tb);
+extern int scols_table_is_ascii(const struct libscols_table *tb);
+extern int scols_table_is_json(const struct libscols_table *tb);
+extern int scols_table_is_noheadings(const struct libscols_table *tb);
+extern int scols_table_is_empty(const struct libscols_table *tb);
+extern int scols_table_is_export(const struct libscols_table *tb);
+extern int scols_table_is_maxout(const struct libscols_table *tb);
+extern int scols_table_is_tree(const struct libscols_table *tb);
extern int scols_table_enable_colors(struct libscols_table *tb, int enable);
extern int scols_table_enable_raw(struct libscols_table *tb, int enable);
extern int scols_table_remove_columns(struct libscols_table *tb);
extern struct libscols_column *scols_table_new_column(struct libscols_table *tb, const char *name, double whint, int flags);
extern int scols_table_next_column(struct libscols_table *tb, struct libscols_iter *itr, struct libscols_column **cl);
-extern const char *scols_table_get_column_separator(struct libscols_table *tb);
-extern const char *scols_table_get_line_separator(struct libscols_table *tb);
-extern size_t scols_table_get_ncols(struct libscols_table *tb);
-extern size_t scols_table_get_nlines(struct libscols_table *tb);
+extern const char *scols_table_get_column_separator(const struct libscols_table *tb);
+extern const char *scols_table_get_line_separator(const struct libscols_table *tb);
+extern size_t scols_table_get_ncols(const struct libscols_table *tb);
+extern size_t scols_table_get_nlines(const struct libscols_table *tb);
extern struct libscols_column *scols_table_get_column(struct libscols_table *tb, size_t n);
extern int scols_table_add_line(struct libscols_table *tb, struct libscols_line *ln);
extern int scols_table_remove_line(struct libscols_table *tb, struct libscols_line *ln);
extern int scols_table_set_symbols(struct libscols_table *tb, struct libscols_symbols *sy);
extern int scols_table_set_stream(struct libscols_table *tb, FILE *stream);
-extern FILE *scols_table_get_stream(struct libscols_table *tb);
+extern FILE *scols_table_get_stream(const struct libscols_table *tb);
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);
SCOLS_TERMFORCE_ALWAYS
};
extern int scols_table_set_termforce(struct libscols_table *tb, int force);
-extern int scols_table_get_termforce(struct libscols_table *tb);
+extern int scols_table_get_termforce(const struct libscols_table *tb);
extern int scols_table_set_termwidth(struct libscols_table *tb, size_t width);
extern size_t scols_table_get_termwidth(struct libscols_table *tb);
}
}
-
/**
* scols_table_set_name:
* @tb: a pointer to a struct libscols_table instance
return 0;
}
-
/**
* scols_table_new_column:
* @tb: table
return rc;
}
-
/**
* scols_table_get_ncols:
* @tb: table
*
- * Returns: the ncols table member
+ * Returns: the ncols table member.
*/
-size_t scols_table_get_ncols(struct libscols_table *tb)
+size_t scols_table_get_ncols(const struct libscols_table *tb)
{
return tb->ncols;
}
* scols_table_get_nlines:
* @tb: table
*
- * Returns: the nlines table member, a negative number in case of an error.
+ * Returns: the nlines table member.
*/
-size_t scols_table_get_nlines(struct libscols_table *tb)
+size_t scols_table_get_nlines(const struct libscols_table *tb)
{
return tb->nlines;
}
*
* Returns: stream pointer, NULL in case of an error or an unset stream.
*/
-FILE *scols_table_get_stream(struct libscols_table *tb)
+FILE *scols_table_get_stream(const struct libscols_table *tb)
{
return tb->out;
}
*
* Returns: 1 if colors are enabled.
*/
-int scols_table_colors_wanted(struct libscols_table *tb)
+int scols_table_colors_wanted(const struct libscols_table *tb)
{
return tb->colors_wanted;
}
*
* Returns: 1 if the table is empty.
*/
-int scols_table_is_empty(struct libscols_table *tb)
+int scols_table_is_empty(const struct libscols_table *tb)
{
return !tb->nlines;
}
*
* Returns: 1 if ASCII tree is enabled.
*/
-int scols_table_is_ascii(struct libscols_table *tb)
+int scols_table_is_ascii(const struct libscols_table *tb)
{
return tb->ascii;
}
*
* Returns: 1 if header output is disabled.
*/
-int scols_table_is_noheadings(struct libscols_table *tb)
+int scols_table_is_noheadings(const struct libscols_table *tb)
{
return tb->no_headings;
}
*
* Returns: 1 if export output format is enabled.
*/
-int scols_table_is_export(struct libscols_table *tb)
+int scols_table_is_export(const struct libscols_table *tb)
{
return tb->format == SCOLS_FMT_EXPORT;
}
*
* Returns: 1 if raw output format is enabled.
*/
-int scols_table_is_raw(struct libscols_table *tb)
+int scols_table_is_raw(const struct libscols_table *tb)
{
return tb->format == SCOLS_FMT_RAW;
}
*
* Since: 2.27
*/
-int scols_table_is_json(struct libscols_table *tb)
+int scols_table_is_json(const struct libscols_table *tb)
{
return tb->format == SCOLS_FMT_JSON;
}
-
/**
* scols_table_is_maxout
* @tb: table
*
* Returns: 1 if output maximization is enabled or 0
*/
-int scols_table_is_maxout(struct libscols_table *tb)
+int scols_table_is_maxout(const struct libscols_table *tb)
{
return tb->maxout;
}
*
* Returns: returns 1 tree-like output is expected.
*/
-int scols_table_is_tree(struct libscols_table *tb)
+int scols_table_is_tree(const struct libscols_table *tb)
{
return tb->ntreecols > 0;
}
*
* Returns: @tb column separator, NULL in case of an error
*/
-const char *scols_table_get_column_separator(struct libscols_table *tb)
+const char *scols_table_get_column_separator(const struct libscols_table *tb)
{
return tb->colsep;
}
*
* Returns: @tb line separator, NULL in case of an error
*/
-const char *scols_table_get_line_separator(struct libscols_table *tb)
+const char *scols_table_get_line_separator(const struct libscols_table *tb)
{
return tb->linesep;
}
*
* Returns: SCOLS_TERMFORCE_{NEVER,ALWAYS,AUTO} or a negative value in case of an error.
*/
-int scols_table_get_termforce(struct libscols_table *tb)
+int scols_table_get_termforce(const struct libscols_table *tb)
{
return tb->termforce;
}