+2008-06-20 Johan Dahlin <jdahlin@async.com.br>
+
+ * giscanner/ast.py:
+ * giscanner/girwriter.py:
+ * giscanner/transformer.py:
+ * tests/parser/Foo-expected.gir:
+ * tests/parser/foo-object.h:
+ * tests/parser/foo.c (foo_object_allow_none):
+ Add support for gtk-doc annotations for allow-none.
+ Add test case.
+
2008-06-19 Johan Dahlin <jdahlin@async.com.br>
* giscanner/ast.py:
self.type = typenode
self.direction = PARAM_DIRECTION_IN
self.transfer = False
+ self.allow_none = False
def __repr__(self):
return 'Parameter(%r, %r)' % (self.name, self.type)
if parameter.transfer:
attrs.append(('transfer-ownership',
str(int(parameter.transfer))))
+ if parameter.allow_none:
+ attrs.append(('allow-none', '1'))
with self.tagcontext('parameter', attrs):
self._write_type(parameter.type)
param.direction = 'out'
elif option == 'callee-owns':
param.transfer = True
+ elif option == 'allow-none':
+ param.allow_none = True
else:
print 'Unhandled parameter annotation option: %s' % (
option,)
</parameter>
</parameters>
</method>
+ <method name="allow_none" c:identifier="foo_object_allow_none">
+ <return-value>
+ <type name="GLib.Object" c:type="GObject*"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object" c:type="FooObject*"/>
+ </parameter>
+ <parameter name="allow_none" allow-none="1">
+ <type name="string" c:type="gchar*"/>
+ </parameter>
+ </parameters>
+ </method>
<method name="inout" c:identifier="foo_object_inout">
<return-value>
<type name="int32" c:type="gint"/>
gint foo_object_out (FooObject *object,
int *outarg);
GObject* foo_object_create_object (FooObject *object);
+GObject* foo_object_allow_none (FooObject *object, gchar *allow_none);
gint foo_object_inout (FooObject *object, int *inoutarg);
gint foo_object_inout2 (FooObject *object, int *inoutarg);
gint foo_object_inout3 (FooObject *object, int *inoutarg);
*
* This is a 3th test for out arguments
*
- * @inoutarg: (in-out): This is an argument test
+ * @inoutarg: (in-out) (allow-none): This is an argument test
* Return value: an int
*/
gint
return g_object_ref (object);
}
+/**
+ * foo_object_allow_none:
+ * @object: a #GObject
+ * @allow_none: (allow-none):
+ **/
+GObject*
+foo_object_allow_none (FooObject *object, gchar *allow_none)
+{
+}
+
G_DEFINE_TYPE (FooSubobject, foo_subobject, FOO_TYPE_OBJECT);
static void