]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: add few methods to get information about title
authorIgor Gnatenko <i.gnatenko.brain@gmail.com>
Sun, 24 Jan 2016 22:47:42 +0000 (23:47 +0100)
committerIgor Gnatenko <i.gnatenko.brain@gmail.com>
Sun, 24 Jan 2016 23:12:14 +0000 (00:12 +0100)
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
libsmartcols/docs/libsmartcols-sections.txt
libsmartcols/src/libsmartcols.h.in
libsmartcols/src/libsmartcols.sym
libsmartcols/src/table.c

index d0886513a9b8fab64156a1de9d0ca9299e06243b..9334a7e99c641dc84a8722d6ab3a70a71e23d701 100644 (file)
@@ -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>
index e5a0fccb36e5818f5e677b2af58fda1f903f3e36..573a6ddca02781f07b1227760b50fd57b7be380f 100644 (file)
@@ -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);
index 6d33899ff5f2b27cf200e56c06459c78ea8da7ad..8e298eb484de5caa284ebc2762f3e6fd4e1ca672 100644 (file)
@@ -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;
index 3a787fae3ddb2b5f7df24fa84fca1d1c0e2a088d..933379f652281f5e571e9e17ead00113a1e855d2 100644 (file)
@@ -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