summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/column.c
diff options
context:
space:
mode:
authorOndrej Oprala2014-03-21 12:37:52 +0100
committerKarel Zak2014-04-03 12:29:17 +0200
commit8a38a8d31edc23db15eb031193df14da66dcdaff (patch)
treef724e219f7e0d94ef8c832d8f27d68012c4de385 /libsmartcols/src/column.c
parentlibsmartcols: add missing copyright notifications (diff)
downloadkernel-qcow2-util-linux-8a38a8d31edc23db15eb031193df14da66dcdaff.tar.gz
kernel-qcow2-util-linux-8a38a8d31edc23db15eb031193df14da66dcdaff.tar.xz
kernel-qcow2-util-linux-8a38a8d31edc23db15eb031193df14da66dcdaff.zip
libsmartcols: separate flags, add getters/setters
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Diffstat (limited to 'libsmartcols/src/column.c')
-rw-r--r--libsmartcols/src/column.c184
1 files changed, 165 insertions, 19 deletions
diff --git a/libsmartcols/src/column.c b/libsmartcols/src/column.c
index 6e6ec1759..5fad5319f 100644
--- a/libsmartcols/src/column.c
+++ b/libsmartcols/src/column.c
@@ -65,8 +65,12 @@ struct libscols_column *scols_copy_column(const struct libscols_column *cl)
ret->width_max = cl->width_max;
ret->width_avg = cl->width_avg;
ret->width_hint = cl->width_hint;
- ret->flags = cl->flags;
ret->is_extreme = cl->is_extreme;
+ ret->trunc = cl->trunc;
+ ret->tree = cl->tree;
+ ret->right = cl->right;
+ ret->strict_width = cl->strict_width;
+ ret->no_extremes = cl->no_extremes;
return ret;
err:
@@ -91,23 +95,6 @@ double scols_column_get_whint(struct libscols_column *cl)
return cl ? cl->width_hint : -EINVAL;
}
-int scols_column_set_flags(struct libscols_column *cl, int flags)
-{
- assert(cl);
-
- if (!cl)
- return -EINVAL;
-
- cl->flags = flags;
- return 0;
-}
-
-int scols_column_get_flags(struct libscols_column *cl)
-{
- assert(cl);
- return cl ? cl->flags : -EINVAL;
-}
-
struct libscols_cell *scols_column_get_header(struct libscols_column *cl)
{
assert(cl);
@@ -147,5 +134,164 @@ const char *scols_column_get_color(struct libscols_column *cl)
return cl ? cl->color : NULL;
}
+/**
+ * scols_column_is_trunc:
+ * @cl: column
+ *
+ * Get the value of trunc
+ *
+ * Returns: trunc flag value, negative value in case of an error.
+ */
+int scols_column_is_trunc(struct libscols_column *cl)
+{
+ assert(cl);
+ if (!cl)
+ return -EINVAL;
+ return cl->trunc;
+}
+/**
+ * scols_column_is_tree:
+ * @cl: column
+ *
+ * Get the value of tree
+ *
+ * Returns: tree flag value, negative value in case of an error.
+ */
+int scols_column_is_tree(struct libscols_column *cl)
+{
+ assert(cl);
+ if (!cl)
+ return -EINVAL;
+ return cl->tree;
+}
+/**
+ * scols_column_is_right:
+ * @cl: column
+ *
+ * Get the value of right
+ *
+ * Returns: right flag value, negative value in case of an error.
+ */
+int scols_column_is_right(struct libscols_column *cl)
+{
+ assert(cl);
+ if (!cl)
+ return -EINVAL;
+ return cl->right;
+}
+/**
+ * scols_column_is_strict_width:
+ * @cl: column
+ *
+ * Get the value of strict_width
+ *
+ * Returns: strict_width flag value, negative value in case of an error.
+ */
+int scols_column_is_strict_width(struct libscols_column *cl)
+{
+ assert(cl);
+ if (!cl)
+ return -EINVAL;
+ return cl->strict_width;
+}
+/**
+ * scols_column_is_no_extremes:
+ * @cl: column
+ *
+ * Get the value of no_extremes
+ *
+ * Returns: no_extremes flag value, negative value in case of an error.
+ */
+int scols_column_is_no_extremes(struct libscols_column *cl)
+{
+ assert(cl);
+ if (!cl)
+ return -EINVAL;
+ return cl->no_extremes;
+}
-
+/**
+ * scols_column_set_trunc:
+ * @cl: column
+ * @enable: 1 or 0
+ *
+ * Enable/disable trunc
+ *
+ * Returns: 0 on success, negative number in case of an error.
+ */
+int scols_column_set_trunc(struct libscols_column *cl, int enable)
+{
+ assert(cl);
+ if (!cl)
+ return -EINVAL;
+ cl->trunc = enable;
+ return 0;
+}
+/**
+ * scols_column_set_tree:
+ * @cl: column
+ * @enable: 1 or 0
+ *
+ * Enable/disable tree
+ *
+ * Returns: 0 on success, negative number in case of an error.
+ */
+int scols_column_set_tree(struct libscols_column *cl, int enable)
+{
+ assert(cl);
+ if (!cl)
+ return -EINVAL;
+ cl->tree = enable;
+ return 0;
+}
+/**
+ * scols_column_set_right:
+ * @cl: column
+ * @enable: 1 or 0
+ *
+ * Enable/disable right
+ *
+ * Returns: 0 on success, negative number in case of an error.
+ */
+int scols_column_set_right(struct libscols_column *cl, int enable)
+{
+ assert(cl);
+ if (!cl)
+ return -EINVAL;
+ cl->right = enable;
+ return 0;
+}
+/**
+ * scols_column_set_strict_width:
+ * @cl: column
+ * @enable: 1 or 0
+ *
+ * Enable/disable strict_width
+ *
+ * Returns: 0 on success, negative number in case of an error.
+ */
+int scols_column_set_strict_width(struct libscols_column *cl, int enable)
+{
+ assert(cl);
+ if (!cl)
+ return -EINVAL;
+ cl->strict_width = enable;
+ return 0;
+}
+/**
+ * scols_column_set_no_extremes:
+ * @cl: column
+ * @enable: 1 or 0
+ *
+ * Enable/disable no_extremes
+ *
+ * Returns: 0 on success, negative number in case of an error.
+ */
+int scols_column_set_no_extremes(struct libscols_column *cl, int enable)
+{
+ assert(cl);
+ if (!cl)
+ return -EINVAL;
+ cl->no_extremes = enable;
+ return 0;
+}