- /* Write name */
- if (ctx->details_comp->cfg.with_trace_class_name) {
- const char *name = bt_trace_class_get_name(tc);
-
- if (name) {
- g_string_append(ctx->str, " `");
- write_str_prop_value(ctx, name);
- g_string_append(ctx->str, "`");
- }
- }
-
- /* Write properties */
- incr_indent(ctx);
-
- if (ctx->details_comp->cfg.with_uuid) {
- bt_uuid uuid = bt_trace_class_get_uuid(tc);
-
- if (uuid) {
- if (!printed_prop) {
- g_string_append(ctx->str, ":\n");
- printed_prop = true;
- }
-
- write_uuid_prop_line(ctx, "UUID", uuid);
- }
- }
-
- /* Write environment */
- env_count = bt_trace_class_get_environment_entry_count(tc);
- if (env_count > 0) {
- if (!printed_prop) {
- g_string_append(ctx->str, ":\n");
- printed_prop = true;
- }
-
- write_indent(ctx);
- write_prop_name(ctx, "Environment");
- g_string_append(ctx->str, " (");
- write_uint_prop_value(ctx, env_count);
- g_string_append_printf(ctx->str, " entr%s):",
- env_count == 1 ? "y" : "ies");
- write_nl(ctx);
- incr_indent(ctx);
-
- for (i = 0; i < env_count; i++) {
- const char *name;
- const bt_value *value;
-
- bt_trace_class_borrow_environment_entry_by_index_const(
- tc, i, &name, &value);
- g_ptr_array_add(env_names, (gpointer) name);
- }
-
- g_ptr_array_sort(env_names, (GCompareFunc) compare_strings);
-
- for (i = 0; i < env_names->len; i++) {
- const char *name = env_names->pdata[i];
- const bt_value *value =
- bt_trace_class_borrow_environment_entry_value_by_name_const(
- tc, name);
-
- BT_ASSERT(value);
- write_compound_member_name(ctx, name);
- write_sp(ctx);
-
- if (bt_value_get_type(value) ==
- BT_VALUE_TYPE_SIGNED_INTEGER) {
- write_int_prop_value(ctx,
- bt_value_signed_integer_get(value));
- } else if (bt_value_get_type(value) ==
- BT_VALUE_TYPE_STRING) {
- write_str_prop_value(ctx,
- bt_value_string_get(value));
- } else {
- abort();
- }
-
- write_nl(ctx);
- }
-
- decr_indent(ctx);
- }
-