libsmartcols: add scols_table_get_name()

Currently we have scols_table_set_name() but don't have getter for it.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
This commit is contained in:
Igor Gnatenko 2016-09-23 14:09:43 +02:00
parent e0140aa138
commit 9696071737
3 changed files with 15 additions and 0 deletions

View File

@ -195,6 +195,7 @@ extern struct libscols_line *scols_copy_line(const struct libscols_line *ln);
/* table */ /* table */
extern int scols_table_colors_wanted(const 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 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 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_raw(const struct libscols_table *tb);
extern int scols_table_is_ascii(const struct libscols_table *tb); extern int scols_table_is_ascii(const struct libscols_table *tb);

View File

@ -145,4 +145,5 @@ global:
scols_table_get_termwidth; scols_table_get_termwidth;
scols_table_set_termforce; scols_table_set_termforce;
scols_table_set_termwidth; scols_table_set_termwidth;
scols_table_get_name;
} SMARTCOLS_2.28; } 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); 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: * scols_table_get_title:
* @tb: a pointer to a struct libscols_table instance * @tb: a pointer to a struct libscols_table instance