[gobject-introspection] [g-ir-generate] Write out array type
- From: Johan Dahlin <johan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] [g-ir-generate] Write out array type
- Date: Thu, 27 May 2010 13:12:58 +0000 (UTC)
commit 15cfa49be6976c0d8a5574164feca6b0212a7f4a
Author: Johan Dahlin <johan gnome org>
Date: Thu May 27 00:17:56 2010 -0300
[g-ir-generate] Write out array type
For GLib arrays, write out the array type to the tgir
tests/scanner/annotation-1.0-expected.tgir | 2 +-
tests/scanner/foo-1.0-expected.tgir | 2 +-
tools/generate.c | 20 ++++++++++++++++++++
3 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/tests/scanner/annotation-1.0-expected.tgir b/tests/scanner/annotation-1.0-expected.tgir
index aafd070..94e8e85 100644
--- a/tests/scanner/annotation-1.0-expected.tgir
+++ b/tests/scanner/annotation-1.0-expected.tgir
@@ -446,7 +446,7 @@
</return-value>
<parameters>
<parameter name="array" transfer-ownership="none">
- <array>
+ <array name="GLib.PtrArray">
<type name="GLib.Value"/>
</array>
</parameter>
diff --git a/tests/scanner/foo-1.0-expected.tgir b/tests/scanner/foo-1.0-expected.tgir
index c0bedbe..d46a318 100644
--- a/tests/scanner/foo-1.0-expected.tgir
+++ b/tests/scanner/foo-1.0-expected.tgir
@@ -652,7 +652,7 @@
</function>
<function name="test_array" c:identifier="foo_test_array">
<return-value transfer-ownership="container">
- <array>
+ <array name="GLib.Array">
<type name="utf8"/>
</array>
</return-value>
diff --git a/tools/generate.c b/tools/generate.c
index 42772da..3923596 100644
--- a/tools/generate.c
+++ b/tools/generate.c
@@ -221,9 +221,29 @@ write_type_info (const gchar *namespace,
else if (tag == GI_TYPE_TAG_ARRAY)
{
gint length, size;
+ char *name = NULL;
xml_start_element (file, "array");
+ switch (g_type_info_get_array_type (info)) {
+ case GI_ARRAY_TYPE_C:
+ break;
+ case GI_ARRAY_TYPE_ARRAY:
+ name = "GLib.Array";
+ break;
+ case GI_ARRAY_TYPE_PTR_ARRAY:
+ name = "GLib.PtrArray";
+ break;
+ case GI_ARRAY_TYPE_BYTE_ARRAY:
+ name = "GLib.ByteArray";
+ break;
+ default:
+ break;
+ }
+
+ if (name)
+ xml_printf (file, " name=\"%s\"", name);
+
type = g_type_info_get_param_type (info, 0);
length = g_type_info_get_array_length (info);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]