diff options
author | Colin Walters <walters@verbum.org> | 2009-02-27 19:02:48 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2009-03-05 15:52:12 -0500 |
commit | fdbe3cc3e1cfaa546648a76b1dca72beead0b65b (patch) | |
tree | 01156e22ec59d29c642d59ce7ad75f383d77466a /tests/scanner/foo-1.0-expected.gir | |
parent | b8e3172424ba956a0d18eae8deb305310b2cab74 (diff) | |
download | gobject-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 'tests/scanner/foo-1.0-expected.gir')
-rw-r--r-- | tests/scanner/foo-1.0-expected.gir | 111 |
1 files changed, 99 insertions, 12 deletions
diff --git a/tests/scanner/foo-1.0-expected.gir b/tests/scanner/foo-1.0-expected.gir index 0f6b1f1f..086170e5 100644 --- a/tests/scanner/foo-1.0-expected.gir +++ b/tests/scanner/foo-1.0-expected.gir @@ -232,16 +232,26 @@ and/or use gtk-doc annotations. --> glib:type-name="FooInterface" glib:get-type="foo_interface_get_type" glib:type-struct="InterfaceIface"> - <callback name="do_foo" c:type="do_foo"> + <virtual-method name="do_foo" invoker="do_foo"> <return-value transfer-ownership="none"> <type name="none" c:type="void"/> </return-value> <parameters> - <parameter name="self" transfer-ownership="none"> - <type name="Interface" c:type="FooInterface*"/> + <parameter name="x" transfer-ownership="none"> + <type name="int" c:type="int"/> </parameter> </parameters> - </callback> + </virtual-method> + <method name="do_foo" c:identifier="foo_interface_do_foo"> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + <parameters> + <parameter name="x" transfer-ownership="none"> + <type name="int" c:type="int"/> + </parameter> + </parameters> + </method> </interface> <record name="InterfaceIface" c:type="FooInterfaceIface" @@ -257,6 +267,9 @@ and/or use gtk-doc annotations. --> <parameter name="self" transfer-ownership="none"> <type name="Interface" c:type="FooInterface*"/> </parameter> + <parameter name="x" transfer-ownership="none"> + <type name="int" c:type="int"/> + </parameter> </parameters> </callback> </record> @@ -277,6 +290,29 @@ and/or use gtk-doc annotations. --> <type name="int" c:type="int"/> </return-value> </function> + <virtual-method name="virtual_method" invoker="virtual_method"> + <return-value transfer-ownership="none"> + <type name="boolean" c:type="gboolean"/> + </return-value> + <parameters> + <parameter name="first_param" transfer-ownership="none"> + <type name="int" c:type="int"/> + </parameter> + </parameters> + </virtual-method> + <virtual-method name="read_fn" invoker="read"> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + <parameters> + <parameter name="offset" transfer-ownership="none"> + <type name="int" c:type="int"/> + </parameter> + <parameter name="length" transfer-ownership="none"> + <type name="int" c:type="int"/> + </parameter> + </parameters> + </virtual-method> <method name="external_type" c:identifier="foo_object_external_type"> <return-value transfer-ownership="full"> <type name="utility.Object" c:type="UtilityObject*"/> @@ -359,6 +395,31 @@ and/or use gtk-doc annotations. --> </parameter> </parameters> </method> + <method name="virtual_method" c:identifier="foo_object_virtual_method"> + <return-value transfer-ownership="none"> + <type name="boolean" c:type="gboolean"/> + </return-value> + <parameters> + <parameter name="first_param" transfer-ownership="none"> + <type name="int" c:type="int"/> + </parameter> + </parameters> + </method> + <method name="read" + c:identifier="foo_object_read" + doc="Read some stuff."> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + <parameters> + <parameter name="offset" transfer-ownership="none"> + <type name="int" c:type="int"/> + </parameter> + <parameter name="length" transfer-ownership="none"> + <type name="int" c:type="int"/> + </parameter> + </parameters> + </method> <property name="string" writable="1" construct="1"> <type name="utf8" c:type="gchararray"/> </property> @@ -401,6 +462,22 @@ and/or use gtk-doc annotations. --> </parameter> </parameters> </callback> + <callback name="read_fn" c:type="read_fn"> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + <parameters> + <parameter name="object" transfer-ownership="none"> + <type name="Object" c:type="FooObject*"/> + </parameter> + <parameter name="offset" transfer-ownership="none"> + <type name="int" c:type="int"/> + </parameter> + <parameter name="length" transfer-ownership="none"> + <type name="int" c:type="int"/> + </parameter> + </parameters> + </callback> </record> <constant name="PIE_IS_TASTY" value="3.14159"> <type name="double"/> @@ -467,21 +544,21 @@ and/or use gtk-doc annotations. --> glib:get-type="foo_sub_interface_get_type" glib:type-struct="SubInterfaceIface"> <prerequisite name="Interface"/> + <virtual-method name="do_bar" invoker="do_bar"> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + </virtual-method> <method name="do_bar" c:identifier="foo_sub_interface_do_bar"> <return-value transfer-ownership="none"> <type name="none" c:type="void"/> </return-value> </method> - <callback name="do_bar" c:type="do_bar"> - <return-value transfer-ownership="none"> + <glib:signal name="destroy-event"> + <return-value transfer-ownership="full"> <type name="none" c:type="void"/> </return-value> - <parameters> - <parameter name="self" transfer-ownership="none"> - <type name="SubInterface" c:type="FooSubInterface*"/> - </parameter> - </parameters> - </callback> + </glib:signal> </interface> <record name="SubInterfaceIface" c:type="FooSubInterfaceIface" @@ -489,6 +566,16 @@ and/or use gtk-doc annotations. --> <field name="parent_iface"> <type name="GObject.TypeInterface" c:type="GTypeInterface"/> </field> + <callback name="destroy_event" c:type="destroy_event"> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + <parameters> + <parameter name="self" transfer-ownership="none"> + <type name="SubInterface" c:type="FooSubInterface*"/> + </parameter> + </parameters> + </callback> <callback name="do_bar" c:type="do_bar"> <return-value transfer-ownership="none"> <type name="none" c:type="void"/> |