libsmartcols Reference Manual | ||||
---|---|---|---|---|
Top | Description |
struct libscols_line; struct libscols_line * scols_copy_line (struct libscols_line *ln
); int scols_line_add_child (struct libscols_line *ln
,struct libscols_line *child
); int scols_line_alloc_cells (struct libscols_line *ln
,size_t n
); void scols_line_free_cells (struct libscols_line *ln
); struct libscols_cell * scols_line_get_cell (struct libscols_line *ln
,size_t n
); const char * scols_line_get_color (struct libscols_line *ln
); struct libscols_cell * scols_line_get_column_cell (struct libscols_line *ln
,struct libscols_column *cl
); size_t scols_line_get_ncells (struct libscols_line *ln
); struct libscols_line * scols_line_get_parent (struct libscols_line *ln
); void * scols_line_get_userdata (struct libscols_line *ln
); int scols_line_has_children (struct libscols_line *ln
); int scols_line_next_child (struct libscols_line *ln
,struct libscols_iter *itr
,struct libscols_line **chld
); int scols_line_refer_data (struct libscols_line *ln
,size_t n
,char *data
); int scols_line_remove_child (struct libscols_line *ln
,struct libscols_line *child
); int scols_line_set_color (struct libscols_line *ln
,const char *color
); int scols_line_set_data (struct libscols_line *ln
,size_t n
,const char *data
); int scols_line_set_userdata (struct libscols_line *ln
,void *data
); struct libscols_line * scols_new_line (void
); void scols_ref_line (struct libscols_line *ln
); void scols_unref_line (struct libscols_line *ln
);
struct libscols_line * scols_copy_line (struct libscols_line *ln
);
|
a pointer to a struct libscols_cell instance |
Returns : |
A newly allocated copy of ln , NULL in case of an error. |
int scols_line_add_child (struct libscols_line *ln
,struct libscols_line *child
);
Sets child
as a child of ln
.
|
a pointer to a struct libscols_line instance |
|
a pointer to a struct libscols_line instance |
Returns : |
0, a negative value in case of an error. |
int scols_line_alloc_cells (struct libscols_line *ln
,size_t n
);
Allocates space for n
cells. This function is optional,
and libsmartcols automatically allocates necessary cells
according to number of columns in the table when you add
the line to the table. See scols_table_add_line()
.
|
a pointer to a struct libscols_line instance |
|
the number of elements |
Returns : |
0, a negative value in case of an error. |
void scols_line_free_cells (struct libscols_line *ln
);
Frees the allocated cells referenced to by ln
.
|
a pointer to a struct libscols_line instance |
struct libscols_cell * scols_line_get_cell (struct libscols_line *ln
,size_t n
);
|
a pointer to a struct libscols_line instance |
|
cell number to retrieve |
Returns : |
the n -th cell in ln , NULL in case of an error. |
const char * scols_line_get_color (struct libscols_line *ln
);
|
a pointer to a struct libscols_line instance |
Returns : |
ln 's color string, NULL in case of an error. |
struct libscols_cell * scols_line_get_column_cell (struct libscols_line *ln
,struct libscols_column *cl
);
Like scols_line_get_cell()
by cell is referenced by column.
|
a pointer to a struct libscols_line instance |
|
pointer to cell |
Returns : |
the n -th cell in ln , NULL in case of an error. |
size_t scols_line_get_ncells (struct libscols_line *ln
);
|
a pointer to a struct libscols_line instance |
Returns : |
ln 's number of cells |
struct libscols_line * scols_line_get_parent (struct libscols_line *ln
);
|
a pointer to a struct libscols_line instance |
Returns : |
a pointer to ln 's parent, NULL in case it has no parent or if there was an error. |
void * scols_line_get_userdata (struct libscols_line *ln
);
|
a pointer to a struct libscols_line instance |
Returns : |
0, a negative value in case of an error. |
int scols_line_has_children (struct libscols_line *ln
);
|
a pointer to a struct libscols_line instance |
Returns : |
1 if ln has any children, otherwise 0. |
int scols_line_next_child (struct libscols_line *ln
,struct libscols_iter *itr
,struct libscols_line **chld
);
Finds the next child and returns a pointer to it via chld
.
|
a pointer to a struct libscols_line instance |
|
a pointer to a struct libscols_iter instance |
|
a pointer to a pointer to a struct libscols_line instance |
Returns : |
0, a negative value in case of an error. |
int scols_line_refer_data (struct libscols_line *ln
,size_t n
,char *data
);
|
a pointer to a struct libscols_cell instance |
|
number of the cell which will refer to data
|
|
actual data to refer to |
Returns : |
0, a negative value in case of an error. |
int scols_line_remove_child (struct libscols_line *ln
,struct libscols_line *child
);
Removes child
as a child of ln
.
|
a pointer to a struct libscols_line instance |
|
a pointer to a struct libscols_line instance |
Returns : |
0, a negative value in case of an error. |
int scols_line_set_color (struct libscols_line *ln
,const char *color
);
|
a pointer to a struct libscols_line instance |
|
color name or ESC sequence |
Returns : |
0, a negative value in case of an error. |
int scols_line_set_data (struct libscols_line *ln
,size_t n
,const char *data
);
|
a pointer to a struct libscols_cell instance |
|
number of the cell, whose data is to be set |
|
actual data to set |
Returns : |
0, a negative value in case of an error. |
int scols_line_set_userdata (struct libscols_line *ln
,void *data
);
Binds data
to ln
.
|
a pointer to a struct libscols_line instance |
|
user data |
Returns : |
0, a negative value in case of an error. |
struct libscols_line * scols_new_line (void
);
Note that the line is allocated without cells, the cells will be allocated
later when you add the line to the table. If you want to use the line
without table then you have to explicitly allocate the cells by
scols_line_alloc_cells()
.
Returns : |
a pointer to a new struct libscols_line instance. |
void scols_ref_line (struct libscols_line *ln
);
Increases the refcount of ln
.
|
a pointer to a struct libscols_line instance |