sink.text.details: print boolean field classes and fields
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sun, 11 Aug 2019 15:50:05 +0000 (11:50 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 4 Sep 2019 15:58:21 +0000 (11:58 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I4f533f5682928d667fb26553bf9ca659135df0d3
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1894
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
src/plugins/text/details/write.c

index 01d2de91ff2244b7a3b226235b72870f4e9bec83..f6d0eea813c22c6df1410208528af1ec9e1e000c 100644 (file)
@@ -302,14 +302,11 @@ void write_int_str_prop_value(struct details_write_ctx *ctx, const char *value)
 }
 
 static inline
-void write_bool_prop_line(struct details_write_ctx *ctx, const char *prop_name,
-               bt_bool prop_value)
+void write_bool_prop_value(struct details_write_ctx *ctx, bt_bool prop_value)
 {
        const char *str;
 
-       write_indent(ctx);
-       write_prop_name(ctx, prop_name);
-       g_string_append_printf(ctx->str, ": %s", color_bold(ctx));
+       g_string_append(ctx->str, color_bold(ctx));
 
        if (prop_value) {
                g_string_append(ctx->str, color_fg_green(ctx));
@@ -319,7 +316,18 @@ void write_bool_prop_line(struct details_write_ctx *ctx, const char *prop_name,
                str = "No";
        }
 
-       g_string_append_printf(ctx->str, "%s%s\n", str, color_reset(ctx));
+       g_string_append_printf(ctx->str, "%s%s", str, color_reset(ctx));
+}
+
+static inline
+void write_bool_prop_line(struct details_write_ctx *ctx, const char *prop_name,
+               bt_bool prop_value)
+{
+       write_indent(ctx);
+       write_prop_name(ctx, prop_name);
+       g_string_append(ctx->str, ": ");
+       write_bool_prop_value(ctx, prop_value);
+       write_nl(ctx);
 }
 
 static inline
@@ -761,6 +769,9 @@ void write_field_class(struct details_write_ctx *ctx, const bt_field_class *fc)
 
        /* Write field class's type */
        switch (fc_type) {
+       case BT_FIELD_CLASS_TYPE_BOOL:
+               type = "Boolean";
+               break;
        case BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER:
                type = "Unsigned integer";
                break;
@@ -1473,6 +1484,10 @@ void write_field(struct details_write_ctx *ctx, const bt_field *field,
 
        /* Write field's value */
        switch (fc_type) {
+       case BT_FIELD_CLASS_TYPE_BOOL:
+               write_sp(ctx);
+               write_bool_prop_value(ctx, bt_field_bool_get_value(field));
+               break;
        case BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER:
        case BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION:
        case BT_FIELD_CLASS_TYPE_SIGNED_INTEGER:
This page took 0.028549 seconds and 4 git commands to generate.