From: Igor Gnatenko Date: Sun, 24 Jan 2016 22:47:42 +0000 (+0100) Subject: libsmartcols: add few methods to get information about title X-Git-Tag: v2.28-rc1~167 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=703d0196ee37f04cdef1b74b6af4b97252c961b0;p=thirdparty%2Futil-linux.git libsmartcols: add few methods to get information about title Signed-off-by: Igor Gnatenko --- diff --git a/libsmartcols/docs/libsmartcols-sections.txt b/libsmartcols/docs/libsmartcols-sections.txt index d0886513a9..9334a7e99c 100644 --- a/libsmartcols/docs/libsmartcols-sections.txt +++ b/libsmartcols/docs/libsmartcols-sections.txt @@ -132,6 +132,9 @@ scols_table_set_name scols_table_set_stream scols_table_set_symbols scols_table_set_title +scols_table_get_title +scols_table_get_title_position +scols_table_get_title_color scols_sort_table scols_unref_table diff --git a/libsmartcols/src/libsmartcols.h.in b/libsmartcols/src/libsmartcols.h.in index e5a0fccb36..573a6ddca0 100644 --- a/libsmartcols/src/libsmartcols.h.in +++ b/libsmartcols/src/libsmartcols.h.in @@ -188,6 +188,9 @@ extern struct libscols_line *scols_copy_line(struct libscols_line *ln); extern int scols_table_colors_wanted(struct libscols_table *tb); extern int scols_table_set_name(struct libscols_table *tb, const char *name); extern int scols_table_set_title(struct libscols_table *tb, const char *title, unsigned int position, const char *color); +extern const char *scols_table_get_title(struct libscols_table *tb); +extern unsigned int scols_table_get_title_position(struct libscols_table *tb); +extern const char *scols_table_get_title_color(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); diff --git a/libsmartcols/src/libsmartcols.sym b/libsmartcols/src/libsmartcols.sym index 6d33899ff5..8e298eb484 100644 --- a/libsmartcols/src/libsmartcols.sym +++ b/libsmartcols/src/libsmartcols.sym @@ -129,4 +129,7 @@ global: scols_symbols_set_title_padding; scols_table_enable_nowrap; scols_table_set_title; + scols_table_get_title; + scols_table_get_title_position; + scols_table_get_title_color; } SMARTCOLS_2.27; diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c index 3a787fae3d..933379f652 100644 --- a/libsmartcols/src/table.c +++ b/libsmartcols/src/table.c @@ -167,6 +167,45 @@ int scols_table_set_title(struct libscols_table *tb, const char *title, unsigned return 0; } +/** + * scols_table_get_title: + * @tb: a pointer to a struct libscols_table instance + * + * Returns: Title of the table, or %NULL in case of blank title. + * + * Since: 2.28 + */ +const char *scols_table_get_title(struct libscols_table *tb) +{ + return tb->title; +} + +/** + * scols_table_get_title_position: + * @tb: a pointer to a struct libscols_table instance + * + * Returns: Title's position of the table. + * + * Since: 2.28 + */ +unsigned int scols_table_get_title_position(struct libscols_table *tb) +{ + return tb->title_pos; +} + +/** + * scols_table_get_title_color: + * @tb: a pointer to a struct libscols_table instance + * + * Returns: Title's color of the table, or %NULL in case of not set color. + * + * Since: 2.28 + */ +const char *scols_table_get_title_color(struct libscols_table *tb) +{ + return tb->title_color; +} + /** * scols_table_add_column: * @tb: a pointer to a struct libscols_table instance