summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/cell.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsmartcols/src/cell.c')
-rw-r--r--libsmartcols/src/cell.c67
1 files changed, 65 insertions, 2 deletions
diff --git a/libsmartcols/src/cell.c b/libsmartcols/src/cell.c
index fb523f013..f85642550 100644
--- a/libsmartcols/src/cell.c
+++ b/libsmartcols/src/cell.c
@@ -8,6 +8,14 @@
* GNU Lesser General Public License.
*/
+/**
+ * SECTION: cell
+ * @title: Cell
+ * @short_description: cell API
+ *
+ * An API to access and modify per-cell data and information.
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -20,6 +28,15 @@
* The cell has no ref-counting, free() and new() functions. All is
* handled by libscols_line.
*/
+
+/**
+ * scols_reset_cell:
+ * @ce: pointer to a struct libscols_cell instance
+ *
+ * Frees the cell's internal data and resets its status.
+ *
+ * Returns: 0, a negative value in case of an error.
+ */
int scols_reset_cell(struct libscols_cell *ce)
{
assert(ce);
@@ -34,7 +51,15 @@ int scols_reset_cell(struct libscols_cell *ce)
return 0;
}
-/* stores copy of the @str to cell */
+/**
+ * scols_cell_set_data:
+ * @ce: a pointer to a struct libscols_cell instance
+ * @str: user data
+ *
+ * Stores a copy of the @str in @ce.
+ *
+ * Returns: 0, a negative value in case of an error.
+ */
int scols_cell_set_data(struct libscols_cell *ce, const char *str)
{
char *p = NULL;
@@ -55,7 +80,15 @@ int scols_cell_set_data(struct libscols_cell *ce, const char *str)
return 0;
}
-/* add reference to @str to cell */
+/**
+ * scols_cell_refer_data:
+ * @ce: a pointer to a struct libscols_cell instance
+ * @str: user data
+ *
+ * Adds a reference to @str to @ce.
+ *
+ * Returns: 0, a negative value in case of an error.
+ */
int scols_cell_refer_data(struct libscols_cell *ce, char *str)
{
char *p = NULL;
@@ -71,12 +104,27 @@ int scols_cell_refer_data(struct libscols_cell *ce, char *str)
return 0;
}
+/**
+ * scols_cell_get_data:
+ * @ce: a pointer to a struct libscols_cell instance
+ *
+ * Returns: data in @ce or NULL.
+ */
const char *scols_cell_get_data(const struct libscols_cell *ce)
{
assert(ce);
return ce ? ce->data : NULL;
}
+/**
+ * scols_cell_set_color:
+ * @ce: a pointer to a struct libscols_cell instance
+ * @color: a color string
+ *
+ * Set the color of @ce to @color.
+ *
+ * Returns: 0, a negative value in case of an error.
+ */
int scols_cell_set_color(struct libscols_cell *ce, const char *color)
{
char *p = NULL;
@@ -101,12 +149,27 @@ int scols_cell_set_color(struct libscols_cell *ce, const char *color)
return 0;
}
+/**
+ * scols_cell_get_data:
+ * @ce: a pointer to a struct libscols_cell instance
+ *
+ * Returns: the current color of @ce.
+ */
const char *scols_cell_get_color(const struct libscols_cell *ce)
{
assert(ce);
return ce ? ce->color : NULL;
}
+/**
+ * scols_cell_copy_content:
+ * @dest: a pointer to a struct libscols_cell instance
+ * @src: a pointer to an immutable struct libscols_cell instance
+ *
+ * Copy the contents of @src into @dest.
+ *
+ * Returns: 0, a negative value in case of an error.
+ */
int scols_cell_copy_content(struct libscols_cell *dest,
const struct libscols_cell *src)
{