[gobject-introspection/wip/gobj-kitchen-sink: 4/5] tests: Add another simple boxed type with a complex constructor



commit e089f7413ba3b191776037a89d3fc8f72582811b
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jan 4 21:38:03 2012 -0500

    tests: Add another simple boxed type with a complex constructor

 tests/scanner/Regress-1.0-expected.gir |   30 ++++++++++++++++++++++++++++++
 tests/scanner/regress.c                |   29 +++++++++++++++++++++++++++++
 tests/scanner/regress.h                |   12 ++++++++++++
 3 files changed, 71 insertions(+), 0 deletions(-)
---
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index ebdacf5..fd798ff 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -141,6 +141,36 @@ use it should be.</doc>
         </parameters>
       </method>
     </record>
+    <record name="TestBoxedB"
+            c:type="RegressTestBoxedB"
+            glib:type-name="RegressTestBoxedB"
+            glib:get-type="regress_test_boxed_b_get_type"
+            c:symbol-prefix="test_boxed_b">
+      <field name="some_int8" writable="1">
+        <type name="gint8" c:type="gint8"/>
+      </field>
+      <field name="some_long" writable="1">
+        <type name="glong" c:type="glong"/>
+      </field>
+      <constructor name="new" c:identifier="regress_test_boxed_b_new">
+        <return-value transfer-ownership="full">
+          <type name="TestBoxedB" c:type="RegressTestBoxedB*"/>
+        </return-value>
+        <parameters>
+          <parameter name="some_int8" transfer-ownership="none">
+            <type name="gint8" c:type="gint8"/>
+          </parameter>
+          <parameter name="some_long" transfer-ownership="none">
+            <type name="glong" c:type="glong"/>
+          </parameter>
+        </parameters>
+      </constructor>
+      <method name="copy" c:identifier="regress_test_boxed_b_copy">
+        <return-value transfer-ownership="full">
+          <type name="TestBoxedB" c:type="RegressTestBoxedB*"/>
+        </return-value>
+      </method>
+    </record>
     <record name="TestBoxedPrivate"
             c:type="RegressTestBoxedPrivate"
             disguised="1">
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 0f00ec8..e90dbba 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -1656,6 +1656,35 @@ regress_test_boxed_get_type (void)
   return our_type;
 }
 
+RegressTestBoxedB *
+regress_test_boxed_b_new (gint8 some_int8, glong some_long)
+{
+  RegressTestBoxedB *boxed;
+
+  boxed = g_slice_new (RegressTestBoxedB);
+  boxed->some_int8 = some_int8;
+  boxed->some_long = some_long;
+
+  return boxed;
+}
+
+RegressTestBoxedB *
+regress_test_boxed_b_copy (RegressTestBoxedB *boxed)
+{
+  return regress_test_boxed_b_new (boxed->some_int8, boxed->some_long);
+}
+
+static void
+regress_test_boxed_b_free (RegressTestBoxedB *boxed)
+{
+  g_slice_free (RegressTestBoxedB, boxed);
+}
+
+G_DEFINE_BOXED_TYPE(RegressTestBoxedB,
+                    regress_test_boxed_b,
+                    regress_test_boxed_b_copy,
+                    regress_test_boxed_b_free);
+
 G_DEFINE_TYPE(RegressTestObj, regress_test_obj, G_TYPE_OBJECT);
 
 enum
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 8fe44e2..9cefb05 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -313,6 +313,18 @@ RegressTestBoxed *regress_test_boxed_copy     (RegressTestBoxed *boxed);
 gboolean   regress_test_boxed_equals   (RegressTestBoxed *boxed,
 					RegressTestBoxed *other);
 
+typedef struct _RegressTestBoxedB RegressTestBoxedB;
+
+struct _RegressTestBoxedB
+{
+  gint8 some_int8;
+  glong some_long;
+};
+
+GType regress_test_boxed_b_get_type (void);
+RegressTestBoxedB *regress_test_boxed_b_new (gint8 some_int8, glong some_long);
+RegressTestBoxedB *regress_test_boxed_b_copy (RegressTestBoxedB *boxed);
+
 /* gobject */
 #define REGRESS_TEST_TYPE_OBJ              (regress_test_obj_get_type ())
 #define REGRESS_TEST_OBJECT(object)        (G_TYPE_CHECK_INSTANCE_CAST ((object), REGRESS_TEST_TYPE_OBJ, RegressTestObj))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]