]> mj.ucw.cz Git - libucw.git/blob - ucw/table-types.h
xtypes: bool now supports yes/no strings
[libucw.git] / ucw / table-types.h
1 /*
2  *      UCW Library -- Table printer
3  *
4  *      (c) 2014 Robert Kessl <robert.kessl@economia.cz>
5  */
6
7 #ifndef _UCW_TABLE_TYPES_H
8 #define _UCW_TABLE_TYPES_H
9
10 #include <ucw/table.h>
11
12 enum size_units {
13   SIZE_UNIT_BYTE,
14   SIZE_UNIT_KILOBYTE,
15   SIZE_UNIT_MEGABYTE,
16   SIZE_UNIT_GIGABYTE,
17   SIZE_UNIT_TERABYTE,
18   SIZE_UNIT_AUTO
19 };
20
21 #define TIMESTAMP_EPOCH     XTYPE_FMT_RAW
22 #define TIMESTAMP_DATETIME  XTYPE_FMT_PRETTY
23
24 #define SIZE_UNITS_FIXED    0x40000000
25
26 extern const struct xtype xt_size;
27 extern const struct xtype xt_timestamp;
28
29 #define TBL_COL_SIZE(_name, _width)       { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = &xt_size, .set_col_opt = table_set_col_opt }
30 #define TBL_COL_TIMESTAMP(_name, _width)  { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = &xt_timestamp, .set_col_opt = table_set_col_opt }
31
32 #define TBL_COL_SIZE_FMT(_name, _width, _units)    { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = &xt_size, .set_col_opt = table_set_col_opt }
33 #define TBL_COL_TIMESTAMP_FMT(_name, _width, _fmt) { .name = _name, .width = _width, .fmt = XTYPE_FMT_DEFAULT, .type_def = &xt_timestamp, .set_col_opt = table_set_col_opt}
34
35 TABLE_COL_PROTO(size, u64)
36 TABLE_COL_PROTO(timestamp, u64)
37
38 #endif