summaryrefslogtreecommitdiff
path: root/gir
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@litl.com>2009-06-12 10:57:38 -0400
committerC. Scott Ananian <cscott@litl.com>2009-06-12 11:24:47 -0400
commitc5dedb9cf43110990ef788e468cf23aef0cf83fb (patch)
tree9cd8e5bccb734f8466d052d2f04a46bde076d6d4 /gir
parentdb214ed923cfe9fc75432d5338e8a3b0d9c83d25 (diff)
downloadgobject-introspection-c5dedb9cf43110990ef788e468cf23aef0cf83fb.tar.gz
Bug 581685: Parse parameterized types (using <>) in annotations.
You can now specify a nested parameterized type in annotations as (for example): @param: (type GLib.HashTable<utf8,GLib.HashTable<utf,utf>>) or @param: (element-type utf8 GLib.HashTable<utf,utf>) New test functions for the Everything typelib show how it works.
Diffstat (limited to 'gir')
-rw-r--r--gir/Everything-1.0-expected.gir26
-rw-r--r--gir/everything.c31
-rw-r--r--gir/everything.h2
3 files changed, 59 insertions, 0 deletions
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index 2a96e2bb..669bef1e 100644
--- a/gir/Everything-1.0-expected.gir
+++ b/gir/Everything-1.0-expected.gir
@@ -705,6 +705,32 @@ call and can be released on return.">
</parameter>
</parameters>
</function>
+ <function name="test_ghash_nested_everything_return"
+ c:identifier="test_ghash_nested_everything_return"
+ doc="Specify nested parameterized types directly with the (type ) annotation.">
+ <return-value transfer-ownership="full">
+ <type name="GLib.HashTable" c:type="GHashTable*">
+ <type name="utf8"/>
+ <type name="GLib.HashTable">
+ <type name="utf8"/>
+ <type name="utf8"/>
+ </type>
+ </type>
+ </return-value>
+ </function>
+ <function name="test_ghash_nested_everything_return2"
+ c:identifier="test_ghash_nested_everything_return2"
+ doc="element-type annotation.">
+ <return-value transfer-ownership="full">
+ <type name="GLib.HashTable" c:type="GHashTable*">
+ <type name="utf8"/>
+ <type name="GLib.HashTable">
+ <type name="utf8"/>
+ <type name="utf8"/>
+ </type>
+ </type>
+ </return-value>
+ </function>
<function name="test_ghash_nothing_in"
c:identifier="test_ghash_nothing_in">
<return-value transfer-ownership="none">
diff --git a/gir/everything.c b/gir/everything.c
index e01a3a93..02a174c2 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -905,6 +905,37 @@ void test_ghash_everything_in (GHashTable *in)
g_hash_table_destroy (in);
}
+/* Nested collection types */
+
+/**
+ * test_ghash_nested_everything_return:
+ * Specify nested parameterized types directly with the (type ) annotation.
+ *
+ * Return value: (type GLib.HashTable<utf8,GLib.HashTable<utf8,utf8>>) (transfer full):
+ */
+GHashTable *
+test_ghash_nested_everything_return (void)
+{
+ GHashTable *hash;
+ hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
+ (void (*) (gpointer)) g_hash_table_destroy);
+ g_hash_table_insert(hash, g_strdup("wibble"), test_table_ghash_new_full());
+ return hash;
+}
+
+/**
+ * test_ghash_nested_everything_return2:
+ * Another way of specifying nested parameterized types: using the
+ * element-type annotation.
+ *
+ * Return value: (element-type utf8 GLib.HashTable<utf8,utf8>) (transfer full):
+ */
+GHashTable *
+test_ghash_nested_everything_return2 (void)
+{
+ return test_ghash_nested_everything_return();
+}
+
/************************************************************************/
/* error? */
diff --git a/gir/everything.h b/gir/everything.h
index 59a7a106..2af75aca 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -90,6 +90,8 @@ void test_ghash_nothing_in2 (GHashTable *in);
void test_ghash_container_in (GHashTable *in);
void test_ghash_everything_in (GHashTable *in);
void test_ghash_free (GHashTable *in);
+GHashTable *test_ghash_nested_everything_return (void);
+GHashTable *test_ghash_nested_everything_return2 (void);
/* error? */