<FILE>cell</FILE>
libscols_cell
scols_cell_copy_content
+scols_cell_get_alignment
scols_cell_get_color
scols_cell_get_data
scols_cell_get_flags
return ce->flags;
}
+/**
+ * scols_cell_get_alignment:
+ * @ce: a pointer to a struct libscols_cell instance
+ *
+ * Returns: SCOLS_CELL_FL_{RIGHT,CELNTER,LEFT}
+ */
+int scols_cell_get_alignment(const struct libscols_cell *ce)
+{
+ if (ce->flags & SCOLS_CELL_FL_RIGHT)
+ return SCOLS_CELL_FL_RIGHT;
+ else if (ce->flags & SCOLS_CELL_FL_CENTER)
+ return SCOLS_CELL_FL_CENTER;
+
+ return SCOLS_CELL_FL_LEFT; /* default */
+}
+
/**
* scols_cell_copy_content:
* @dest: a pointer to a struct libscols_cell instance
* Cell flags, see scols_cell_set_flags() before use
*/
enum {
- SCOLS_CELL_FL_LEFT = 0,
- SCOLS_CELL_FL_CENTER,
- SCOLS_CELL_FL_RIGHT
+ /* alignment evaluated in order: right,center,left */
+ SCOLS_CELL_FL_LEFT = 0,
+ SCOLS_CELL_FL_CENTER = (1 << 0),
+ SCOLS_CELL_FL_RIGHT = (1 << 1)
};
extern struct libscols_iter *scols_new_iter(int direction);
extern int scols_cell_set_flags(struct libscols_cell *ce, int flags);
extern int scols_cell_get_flags(const struct libscols_cell *ce);
+extern int scols_cell_get_alignment(const struct libscols_cell *ce);
extern void *scols_cell_get_userdata(struct libscols_cell *ce);
extern int scols_cell_set_userdata(struct libscols_cell *ce, void *data);
scols_wrapnl_chunksize;
scols_wrapnl_nextchunk;
} SMARTCOLS_2.28;
+
+
+SMARTCOLS_2.30 {
+global:
+ scols_cell_get_alignment;
+} SMARTCOLS_2.29;
goto done;
}
- if (tb->title.flags & SCOLS_CELL_FL_LEFT)
- align = MBS_ALIGN_LEFT;
- else if (tb->title.flags & SCOLS_CELL_FL_RIGHT)
+ switch (scols_cell_get_alignment(&tb->title)) {
+ case SCOLS_CELL_FL_RIGHT:
align = MBS_ALIGN_RIGHT;
- else if (tb->title.flags & SCOLS_CELL_FL_CENTER)
+ break;
+ case SCOLS_CELL_FL_CENTER:
align = MBS_ALIGN_CENTER;
- else
- align = MBS_ALIGN_LEFT; /* default */
+ break;
+ case SCOLS_CELL_FL_LEFT:
+ default:
+ align = MBS_ALIGN_LEFT;
+ break;
+
+ }
/* copy from buf to title and align to width with title_padding */
rc = mbsalign_with_padding(buf, title, titlesz,