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>
21 #define COL_TYPE_SIZE &xt_size
22 #define COL_TYPE_TIMESTAMP &xt_timestamp
24 #define TIMESTAMP_EPOCH XTYPE_FMT_RAW
25 #define TIMESTAMP_DATETIME XTYPE_FMT_PRETTY
27 #define SIZE_UNITS_FIXED 0x40000000
29 extern const struct xtype xt_size;
30 extern const struct xtype xt_timestamp;
32 bool table_set_col_opt_size(struct table *tbl, uint col_inst_idx, const char *col_arg, char **err);
33 bool table_set_col_opt_timestamp(struct table *tbl, uint col_inst_idx, const char *col_arg, char **err);
35 #define TBL_COL_SIZE(_name, _width) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = COL_TYPE_SIZE, .set_col_instance_option = table_set_col_opt_size }
36 #define TBL_COL_TIMESTAMP(_name, _width) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = COL_TYPE_TIMESTAMP, .set_col_instance_option = table_set_col_opt_timestamp }
38 #define TBL_COL_SIZE_FMT(_name, _width, _units) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = COL_TYPE_SIZE, .set_col_instance_option = table_set_col_opt_size }
39 #define TBL_COL_TIMESTAMP_FMT(_name, _width, _fmt) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = COL_TYPE_TIMESTAMP, .set_col_instance_option = table_set_col_opt_timestamp }
41 void table_col_size_name(struct table *tbl, const char *col_name, u64 val);
42 void table_col_timestamp_name(struct table *tbl, const char * col_name, u64 val);
44 void table_col_size(struct table *tbl, int col, u64 val);
45 void table_col_timestamp(struct table *tbl, int col, u64 val);