[gobject-introspection] Add a TestObj subclass in Everything
- From: Simon van der Linden <svdlinden src gnome org>
- To: svn-commits-list gnome org
- Subject: [gobject-introspection] Add a TestObj subclass in Everything
- Date: Sun, 5 Jul 2009 13:09:16 +0000 (UTC)
commit 11af62358ce600cecceb7af858074281901d5067
Author: Simon van der Linden <svdlinden src gnome org>
Date: Sun Jun 28 16:05:46 2009 +0200
Add a TestObj subclass in Everything
Add an instance method to TestObj.
Add a TestObj subclass in Everything, with another constructor, an
additional instance method and an overridden instance method.
gir/Everything-1.0-expected.gir | 38 ++++++++++++++++++++++++++++++++++++++
gir/everything.c | 37 +++++++++++++++++++++++++++++++++++++
gir/everything.h | 25 +++++++++++++++++++++++++
3 files changed, 100 insertions(+), 0 deletions(-)
---
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index d762bb5..35aa770 100644
--- a/gir/Everything-1.0-expected.gir
+++ b/gir/Everything-1.0-expected.gir
@@ -159,6 +159,11 @@ and/or use gtk-doc annotations. -->
</parameter>
</parameters>
</method>
+ <method name="instance_method" c:identifier="test_obj_instance_method">
+ <return-value transfer-ownership="none">
+ <type name="int" c:type="int"/>
+ </return-value>
+ </method>
<method name="do_matrix"
c:identifier="test_obj_do_matrix"
doc="This method is virtual. Notably its name differs from the virtual
@@ -332,6 +337,39 @@ case.">
<type name="GObject.Object" c:type="GObject*"/>
</field>
</record>
+ <class name="TestSubObj"
+ c:type="TestSubObj"
+ parent="TestObj"
+ glib:type-name="TestSubObj"
+ glib:get-type="test_sub_obj_get_type"
+ glib:type-struct="TestSubObjClass">
+ <constructor name="new" c:identifier="test_sub_obj_new">
+ <return-value transfer-ownership="full">
+ <type name="TestSubObj" c:type="TestSubObj*"/>
+ </return-value>
+ </constructor>
+ <method name="unset_bare" c:identifier="test_sub_obj_unset_bare">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ </method>
+ <method name="instance_method"
+ c:identifier="test_sub_obj_instance_method">
+ <return-value transfer-ownership="none">
+ <type name="int" c:type="int"/>
+ </return-value>
+ </method>
+ <field name="parent_instance">
+ <type name="TestObj" c:type="TestObj"/>
+ </field>
+ </class>
+ <record name="TestSubObjClass"
+ c:type="TestSubObjClass"
+ glib:is-gtype-struct-for="TestSubObj">
+ <field name="parent_class">
+ <type name="TestObjClass" c:type="TestObjClass"/>
+ </field>
+ </record>
<class name="TestWi8021x"
c:type="TestWi8021x"
parent="GObject.Object"
diff --git a/gir/everything.c b/gir/everything.c
index 62a8010..2eedeef 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -1423,6 +1423,12 @@ test_obj_set_bare (TestObj *obj, GObject *bare)
g_object_ref (obj->bare);
}
+int
+test_obj_instance_method (TestObj *obj)
+{
+ return -1;
+}
+
double
test_obj_static_method (int x)
{
@@ -1456,6 +1462,37 @@ struct _CallbackInfo
};
+G_DEFINE_TYPE(TestSubObj, test_sub_obj, TEST_TYPE_OBJ);
+
+static void
+test_sub_obj_class_init (TestSubObjClass *klass)
+{
+}
+
+static void
+test_sub_obj_init (TestSubObj *obj)
+{
+}
+
+TestSubObj*
+test_sub_obj_new ()
+{
+ return g_object_new (TEST_TYPE_SUB_OBJ, NULL);
+}
+
+int
+test_sub_obj_instance_method (TestSubObj *obj)
+{
+ return 0;
+}
+
+void
+test_sub_obj_unset_bare (TestSubObj *obj)
+{
+ test_obj_set_bare(TEST_OBJECT(obj), NULL);
+}
+
+
/**
* test_callback:
* @callback: (scope call):
diff --git a/gir/everything.h b/gir/everything.h
index 8ce29c5..d566f5f 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -249,11 +249,36 @@ struct _TestObjClass
GType test_obj_get_type (void);
TestObj* test_obj_new_from_file (const char *x, GError **error);
void test_obj_set_bare (TestObj *obj, GObject *bare);
+int test_obj_instance_method (TestObj *obj);
double test_obj_static_method (int x);
/* virtual */
int test_obj_do_matrix (TestObj *obj, const char *somestr);
+/* inheritance */
+#define TEST_TYPE_SUB_OBJ (test_sub_obj_get_type ())
+#define TEST_SUB_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_SUB_OBJ, TestSubObj))
+#define TEST_IS_SUB_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_SUB_OBJ))
+#define TEST_SUB_OBJ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_SUB_OBJ, TestSubObjClass))
+
+typedef struct _TestSubObj TestSubObj;
+typedef struct _TestSubObjClass TestSubObjClass;
+
+struct _TestSubObj
+{
+ TestObj parent_instance;
+};
+
+struct _TestSubObjClass
+{
+ TestObjClass parent_class;
+};
+
+GType test_sub_obj_get_type (void);
+TestSubObj* test_sub_obj_new (void);
+void test_sub_obj_unset_bare (TestSubObj *obj);
+int test_sub_obj_instance_method (TestSubObj *obj);
+
/* callback */
typedef int (*TestCallback) ();
typedef int (*TestCallbackUserData) (gpointer user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]