* 'getters' of https://github.com/ignatenkobrain/util-linux:
  libsmartcols: add scols_table_is_nolinesep()
  libsmartcols: add scols_table_is_nowrap()
  libsmartcols: add scols_table_get_name()
This commit is contained in:
Karel Zak 2016-09-23 14:25:37 +02:00
commit a3b91e82f2
3 changed files with 48 additions and 3 deletions

View File

@ -195,6 +195,7 @@ extern struct libscols_line *scols_copy_line(const struct libscols_line *ln);
/* table */
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 const char *scols_table_get_name(const struct libscols_table *tb);
extern struct libscols_cell *scols_table_get_title(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);
@ -203,6 +204,8 @@ 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_nowrap(const struct libscols_table *tb);
extern int scols_table_is_nolinesep(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);

View File

@ -147,4 +147,7 @@ global:
scols_table_set_default_symbols;
scols_table_set_termforce;
scols_table_set_termwidth;
scols_table_get_name;
scols_table_is_nowrap;
scols_table_is_nolinesep;
} SMARTCOLS_2.28;

View File

@ -129,6 +129,19 @@ int scols_table_set_name(struct libscols_table *tb, const char *str)
return strdup_to_struct_member(tb, name, str);
}
/**
* scols_table_get_name:
* @tb: a pointer to a struct libscols_table instance
*
* Returns: The current name setting of the table @tb
*
* Since: 2.29
*/
const char *scols_table_get_name(const struct libscols_table *tb)
{
return tb->name;
}
/**
* scols_table_get_title:
* @tb: a pointer to a struct libscols_table instance
@ -760,7 +773,7 @@ struct libscols_symbols *scols_table_get_symbols(const struct libscols_table *tb
}
/**
* scols_table_enable_nolinesep
* scols_table_enable_nolinesep:
* @tb: table
* @enable: 1 or 0
*
@ -776,10 +789,23 @@ int scols_table_enable_nolinesep(struct libscols_table *tb, int enable)
return -EINVAL;
DBG(TAB, ul_debugobj(tb, "nolinesep: %s", enable ? "ENABLE" : "DISABLE"));
tb->no_linesep = enable;
tb->no_linesep = enable ? 1 : 0;
return 0;
}
/**
* scols_table_is_nolinesep:
* @tb: a pointer to a struct libscols_table instance
*
* Returns: 1 if line separator printing is disabled.
*
* Since: 2.29
*/
int scols_table_is_nolinesep(const struct libscols_table *tb)
{
return tb->no_linesep;
}
/**
* scols_table_enable_colors:
* @tb: table
@ -952,6 +978,19 @@ int scols_table_enable_nowrap(struct libscols_table *tb, int enable)
return 0;
}
/**
* scols_table_is_nowrap:
* @tb: a pointer to a struct libscols_table instance
*
* Returns: 1 if nowrap is enabled.
*
* Since: 2.29
*/
int scols_table_is_nowrap(const struct libscols_table *tb)
{
return tb->no_wrap;
}
/**
* scols_table_colors_wanted:
* @tb: table
@ -967,7 +1006,7 @@ int scols_table_colors_wanted(const struct libscols_table *tb)
* scols_table_is_empty:
* @tb: table
*
* Returns: 1 if the table is empty.
* Returns: 1 if the table is empty.
*/
int scols_table_is_empty(const struct libscols_table *tb)
{