summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-02-27 19:02:48 -0500
committerColin Walters <walters@verbum.org>2009-03-05 15:52:12 -0500
commitfdbe3cc3e1cfaa546648a76b1dca72beead0b65b (patch)
tree01156e22ec59d29c642d59ce7ad75f383d77466a /tools
parentb8e3172424ba956a0d18eae8deb305310b2cab74 (diff)
downloadgobject-introspection-fdbe3cc3e1cfaa546648a76b1dca72beead0b65b.tar.gz
Bug 557383 - Virtual method support
Broadly speaking, this change adds the concept of <vfunc> to the .gir. The typelib already had most of the infrastructure for virtual functions, though there is one API addition. The scanner assumes that any class callback slot that doesn't match a signal name is a virtual. In the .gir, we write out *both* the <method> wrapper and a <vfunc>. If we can determine an association between them (based on the names matching, or a new Virtual: annotation), then we notate that in the .gir. The typelib gains an association from the vfunc to the function, if it exists. This will be useful for bindings since they already know how to consume FunctionInfo.
Diffstat (limited to 'tools')
-rw-r--r--tools/generate.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/generate.c b/tools/generate.c
index c4d72912..48d7dfb6 100644
--- a/tools/generate.c
+++ b/tools/generate.c
@@ -869,6 +869,7 @@ write_vfunc_info (const gchar *namespace,
{
GIVFuncInfoFlags flags;
const gchar *name;
+ GIFunctionInfo *invoker;
gboolean deprecated;
gint offset;
@@ -876,8 +877,9 @@ write_vfunc_info (const gchar *namespace,
flags = g_vfunc_info_get_flags (info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
offset = g_vfunc_info_get_offset (info);
+ invoker = g_vfunc_info_get_invoker (info);
- xml_start_element (file, "vfunc");
+ xml_start_element (file, "virtual-method");
xml_printf (file, " name=\"%s\"", name);
if (deprecated)
@@ -893,9 +895,12 @@ write_vfunc_info (const gchar *namespace,
xml_printf (file, " offset=\"%d\"", offset);
+ if (invoker)
+ xml_printf (file, " invoker=\"%s\"", g_base_info_get_name ((GIBaseInfo*)invoker));
+
write_callable_info (namespace, (GICallableInfo*)info, file);
- xml_end_element (file, "vfunc");
+ xml_end_element (file, "virtual-method");
}
static void