diff options
author | Igor Gnatenko <i.gnatenko.brain@gmail.com> | 2016-01-24 23:47:42 +0100 |
---|---|---|
committer | Igor Gnatenko <i.gnatenko.brain@gmail.com> | 2016-01-25 00:12:14 +0100 |
commit | 703d0196ee37f04cdef1b74b6af4b97252c961b0 (patch) | |
tree | 56842fc8edbf971c717e0de9763a33cfc8f7d89e /libsmartcols | |
parent | bfc3d8b48ef9f2c10f3a4c8f932ed941e8f048be (diff) | |
download | util-linux-703d0196ee37f04cdef1b74b6af4b97252c961b0.tar.gz |
libsmartcols: add few methods to get information about title
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Diffstat (limited to 'libsmartcols')
-rw-r--r-- | libsmartcols/docs/libsmartcols-sections.txt | 3 | ||||
-rw-r--r-- | libsmartcols/src/libsmartcols.h.in | 3 | ||||
-rw-r--r-- | libsmartcols/src/libsmartcols.sym | 3 | ||||
-rw-r--r-- | libsmartcols/src/table.c | 39 |
4 files changed, 48 insertions, 0 deletions
diff --git a/libsmartcols/docs/libsmartcols-sections.txt b/libsmartcols/docs/libsmartcols-sections.txt index d0886513a..9334a7e99 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 </SECTION> diff --git a/libsmartcols/src/libsmartcols.h.in b/libsmartcols/src/libsmartcols.h.in index e5a0fccb3..573a6ddca 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 6d33899ff..8e298eb48 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 3a787fae3..933379f65 100644 --- a/libsmartcols/src/table.c +++ b/libsmartcols/src/table.c @@ -168,6 +168,45 @@ int scols_table_set_title(struct libscols_table *tb, const char *title, unsigned } /** + * 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 * @cl: a pointer to a struct libscols_column instance |