diff options
author | David Zeuthen <davidz@redhat.com> | 2010-06-15 11:01:37 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2010-06-24 11:53:18 -0400 |
commit | 11cfe386c37ced44a8e3efb5556bde3a43a11171 (patch) | |
tree | a01903a4e4596ca80c79abbc8d35c33dc665e526 /girepository/girwriter.c | |
parent | 751ffa016e410a031028282e63f98a94cc444b7b (diff) | |
download | gobject-introspection-11cfe386c37ced44a8e3efb5556bde3a43a11171.tar.gz |
Allow attributes on parameters and return values
Any annotation where the key has a dot in the name will go into the
attribute list. For example
* @arg: (foo.bar baz): some arg
the parameter @arg will get the attribute with key foo.bar and value
baz. This also works for.
* Returns: (foo.bar2 baz2): the return value
Also add tests for this new feature.
See https://bugzilla.gnome.org/show_bug.cgi?id=571548
Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'girepository/girwriter.c')
-rw-r--r-- | girepository/girwriter.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/girepository/girwriter.c b/girepository/girwriter.c index b123a134..19862b0d 100644 --- a/girepository/girwriter.c +++ b/girepository/girwriter.c @@ -358,7 +358,7 @@ write_type_info (const gchar *namespace, static void write_attributes (Xml *file, - GIBaseInfo *info) + GIBaseInfo *info) { GIAttributeIter iter = { 0, }; char *name, *value; @@ -372,6 +372,21 @@ write_attributes (Xml *file, } static void +write_return_value_attributes (Xml *file, + GICallableInfo *info) +{ + GIAttributeIter iter = { 0, }; + char *name, *value; + + while (g_callable_info_iterate_return_attributes (info, &iter, &name, &value)) + { + xml_start_element (file, "attribute"); + xml_printf (file, " name=\"%s\" value=\"%s\"", name, value); + xml_end_element (file, "attribute"); + } +} + +static void write_constant_value (const gchar *namespace, GITypeInfo *info, GArgument *argument, @@ -467,6 +482,8 @@ write_callable_info (const gchar *namespace, if (g_callable_info_may_return_null (info)) xml_printf (file, " allow-none=\"1\""); + write_return_value_attributes (file, info); + write_type_info (namespace, type, file); xml_end_element (file, "return-value"); @@ -528,6 +545,8 @@ write_callable_info (const gchar *namespace, if (g_arg_info_get_destroy (arg) >= 0) xml_printf (file, " destroy=\"%d\"", g_arg_info_get_destroy (arg)); + write_attributes (file, (GIBaseInfo*) arg); + type = g_arg_info_get_type (arg); write_type_info (namespace, type, file); |