libsmartcols Reference Manual | ||||
---|---|---|---|---|
Top | Description |
struct libscols_cell; int scols_cell_copy_content (struct libscols_cell *dest
,const struct libscols_cell *src
); const char * scols_cell_get_color (const struct libscols_cell *ce
); const char * scols_cell_get_data (const struct libscols_cell *ce
); void * scols_cell_get_userdata (struct libscols_cell *ce
); int scols_cell_refer_data (struct libscols_cell *ce
,char *str
); int scols_cell_set_color (struct libscols_cell *ce
,const char *color
); int scols_cell_set_data (struct libscols_cell *ce
,const char *str
); int scols_cell_set_userdata (struct libscols_cell *ce
,void *data
); int scols_cmpstr_cells (struct libscols_cell *a
,struct libscols_cell *b
,void *data
); int scols_reset_cell (struct libscols_cell *ce
);
An API to access and modify per-cell data and information. Note that cell is always part of the line. If you destroy (un-reference) a line than it destroys all line cells too.
int scols_cell_copy_content (struct libscols_cell *dest
,const struct libscols_cell *src
);
Copy the contents of src
into dest
.
|
a pointer to a struct libscols_cell instance |
|
a pointer to an immutable struct libscols_cell instance |
Returns : |
0, a negative value in case of an error. |
const char * scols_cell_get_color (const struct libscols_cell *ce
);
|
a pointer to a struct libscols_cell instance |
Returns : |
the current color of ce . |
const char * scols_cell_get_data (const struct libscols_cell *ce
);
|
a pointer to a struct libscols_cell instance |
Returns : |
data in ce or NULL. |
void * scols_cell_get_userdata (struct libscols_cell *ce
);
|
a pointer to a struct libscols_cell instance |
Returns : |
user data |
int scols_cell_refer_data (struct libscols_cell *ce
,char *str
);
Adds a reference to str
to ce
. The pointer is deallocated by
scols_reset_cell()
or scols_unref_line()
. This function is mostly designed
for situations when the data for the cell are already composed in allocated
memory (e.g. asprintf()
) to avoid extra unnecessary strdup()
.
|
a pointer to a struct libscols_cell instance |
|
data (used for scols_printtable() ) |
Returns : |
0, a negative value in case of an error. |
int scols_cell_set_color (struct libscols_cell *ce
,const char *color
);
Set the color of ce
to color
.
|
a pointer to a struct libscols_cell instance |
|
color name or ESC sequence |
Returns : |
0, a negative value in case of an error. |
int scols_cell_set_data (struct libscols_cell *ce
,const char *str
);
Stores a copy of the str
in ce
.
|
a pointer to a struct libscols_cell instance |
|
data (used for scols_printtable() ) |
Returns : |
0, a negative value in case of an error. |
int scols_cell_set_userdata (struct libscols_cell *ce
,void *data
);
|
a pointer to a struct libscols_cell instance |
|
private user data |
Returns : |
0, a negative value in case of an error. |
int scols_cmpstr_cells (struct libscols_cell *a
,struct libscols_cell *b
,void *data
);
Compares cells data by strcmp()
. The function is designed for
scols_column_set_cmpfunc()
and scols_sort_table()
.
|
pointer to cell |
|
pointer to cell |
|
unused pointer to private data (defined by API) |
Returns : |
follows strcmp() return values. |