2 * UCW Library -- Table printer
4 * (c) 2014 Robert Kessl <robert.kessl@economia.cz>
7 #ifndef _UCW_TABLE_TYPES_H
8 #define _UCW_TABLE_TYPES_H
10 #include <ucw/table.h>
12 #ifdef CONFIG_UCW_CLEAN_ABI
13 #define table_col_size ucw_table_col_size
14 #define table_col_timestamp ucw_table_col_timestamp
15 #define xt_size ucw_xt_size
16 #define xt_timestamp ucw_xt_timestamp
19 /* Size, possibly with a unit. Internally represented as u64. */
21 extern const struct xtype xt_size;
25 XT_SIZE_UNIT_KILOBYTE,
26 XT_SIZE_UNIT_MEGABYTE,
27 XT_SIZE_UNIT_GIGABYTE,
28 XT_SIZE_UNIT_TERABYTE,
32 #define XT_SIZE_FMT_UNIT(_unit) (_unit | XT_SIZE_FMT_FIXED_UNIT)
33 #define XT_SIZE_FMT_FIXED_UNIT XTYPE_FMT_CUSTOM
35 #define TBL_COL_SIZE(_name, _width) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = &xt_size }
36 #define TBL_COL_SIZE_FMT(_name, _width, _fmt) { .name = _name, .width = _width, .fmt = _fmt, .type_def = &xt_size }
38 TABLE_COL_PROTO(size, u64)
40 /* Timestamp. Internally represented as time_t. */
42 #define XT_TIMESTAMP_FMT_EPOCH XTYPE_FMT_RAW
43 #define XT_TIMESTAMP_FMT_DATETIME XTYPE_FMT_PRETTY
45 extern const struct xtype xt_timestamp;
47 #define TBL_COL_TIMESTAMP(_name, _width) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = &xt_timestamp }
48 #define TBL_COL_TIMESTAMP_FMT(_name, _width, _fmt) { .name = _name, .width = _width, .fmt = _fmt, .type_def = &xt_timestamp }
50 TABLE_COL_PROTO(timestamp, u64)