- context->current_indentation_level = 1;
- g_string_assign(context->field_name, "");
- g_string_append_printf(context->string,
- "event {\n\tname = \"%s\";\n\tid = %u;\n\tstream_id = %" PRId64 ";\n",
- g_quark_to_string(event_class->name),
- event_class->id,
- stream_id);
+ for (i = 0; i < count; ++i) {
+ const char *attr_name = NULL;
+
+ attr_name = bt_ctf_event_class_get_attribute_name(
+ event_class, i);
+ attr_value = bt_ctf_event_class_get_attribute_value(
+ event_class, i);
+
+ if (!attr_name || !attr_value) {
+ ret = -1;
+ goto end;
+ }
+
+ switch (bt_value_get_type(attr_value)) {
+ case BT_VALUE_TYPE_INTEGER:
+ {
+ int64_t value;
+
+ ret = bt_value_integer_get(attr_value, &value);
+
+ if (ret) {
+ goto end;
+ }
+
+ g_string_append_printf(context->string,
+ "\t%s = %" PRId64 ";\n", attr_name, value);
+ break;
+ }
+
+ case BT_VALUE_TYPE_STRING:
+ {
+ const char *value;
+
+ ret = bt_value_string_get(attr_value, &value);
+
+ if (ret) {
+ goto end;
+ }
+
+ g_string_append_printf(context->string,
+ "\t%s = \"%s\";\n", attr_name, value);
+ break;
+ }
+
+ default:
+ /* should never happen */
+ assert(false);
+ break;
+ }
+
+ BT_PUT(attr_value);
+ }