summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/format_table.h
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2021-09-17 14:32:03 +0200
committerDamjan Marion <dmarion@me.com>2021-09-20 11:26:03 +0000
commit8430b8de1df1b0732beab9534a7a91fc8c7b3c7d (patch)
tree65d0d9b3c639f0b0f0c8a56215513d2ddbe7929c /src/vppinfra/format_table.h
parent41b23bc9554a134aee37b430ebf5553cc3260624 (diff)
vppinfra: format table improvements
This adds a way to define default fg, bg colors and alignement for cell tables. It also allows removing the table title by not setting it. It also removes the trailing newline, for usage inside a format("%U", format_table, ...) Type: improvement Change-Id: I27d7a04c4a919b34d0170b04e24a56831f581ea1 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/vppinfra/format_table.h')
-rw-r--r--src/vppinfra/format_table.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/vppinfra/format_table.h b/src/vppinfra/format_table.h
index f9b66a77c40..a6595333e0b 100644
--- a/src/vppinfra/format_table.h
+++ b/src/vppinfra/format_table.h
@@ -58,10 +58,17 @@ typedef enum
typedef struct
{
- table_text_attr_flags_t flags : 16;
- table_text_attr_color_t fg_color : 4;
- table_text_attr_color_t bg_color : 4;
- table_text_attr_align_t align : 4;
+ union
+ {
+ struct
+ {
+ table_text_attr_flags_t flags : 16;
+ table_text_attr_color_t fg_color : 4;
+ table_text_attr_color_t bg_color : 4;
+ table_text_attr_align_t align : 4;
+ };
+ u32 as_u32;
+ };
} table_text_attr_t;
typedef struct
@@ -79,6 +86,10 @@ typedef struct
int n_header_cols;
int n_header_rows;
int n_footer_cols;
+ table_text_attr_t default_title;
+ table_text_attr_t default_body;
+ table_text_attr_t default_header_col;
+ table_text_attr_t default_header_row;
} table_t;
__clib_export format_function_t format_table;