[everything] Add alternative boxed constructors
authorJohan Dahlin <johan@gnome.org>
Tue, 9 Mar 2010 15:28:22 +0000 (12:28 -0300)
committerJohan Dahlin <johan@gnome.org>
Tue, 9 Mar 2010 15:29:00 +0000 (12:29 -0300)
gir/Everything-1.0-expected.gir
gir/everything.c
gir/everything.h

index 6bf6c8b721baea60eda2eeeebb43d2bc6ef868b9..a284c44de5c54003f1f44eb42a513278fb75747c 100644 (file)
@@ -31,6 +31,42 @@ and/or use gtk-doc annotations.  -->
           <type name="TestBoxed" c:type="TestBoxed*"/>
         </return-value>
       </constructor>
+      <constructor name="new_alternative_constructor1"
+                   c:identifier="test_boxed_new_alternative_constructor1">
+        <return-value transfer-ownership="full">
+          <type name="TestBoxed" c:type="TestBoxed*"/>
+        </return-value>
+        <parameters>
+          <parameter name="i" transfer-ownership="none">
+            <type name="int" c:type="int"/>
+          </parameter>
+        </parameters>
+      </constructor>
+      <constructor name="new_alternative_constructor2"
+                   c:identifier="test_boxed_new_alternative_constructor2">
+        <return-value transfer-ownership="full">
+          <type name="TestBoxed" c:type="TestBoxed*"/>
+        </return-value>
+        <parameters>
+          <parameter name="i" transfer-ownership="none">
+            <type name="int" c:type="int"/>
+          </parameter>
+          <parameter name="j" transfer-ownership="none">
+            <type name="int" c:type="int"/>
+          </parameter>
+        </parameters>
+      </constructor>
+      <constructor name="new_alternative_constructor3"
+                   c:identifier="test_boxed_new_alternative_constructor3">
+        <return-value transfer-ownership="full">
+          <type name="TestBoxed" c:type="TestBoxed*"/>
+        </return-value>
+        <parameters>
+          <parameter name="s" transfer-ownership="full">
+            <type name="utf8" c:type="char*"/>
+          </parameter>
+        </parameters>
+      </constructor>
       <method name="copy" c:identifier="test_boxed_copy">
         <return-value transfer-ownership="full">
           <type name="TestBoxed" c:type="TestBoxed*"/>
index 67960889c35831e6ced055c1a6808abac846afa6..3957d06d83ba27667c5a4ed49c72113b495ca406 100644 (file)
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <stdlib.h>
 #include "everything.h"
 #include <gio/gio.h>
 
@@ -1256,6 +1257,39 @@ test_boxed_new (void)
   return boxed;
 }
 
+TestBoxed *
+test_boxed_new_alternative_constructor1 (int i)
+{
+  TestBoxed *boxed = g_slice_new0(TestBoxed);
+  boxed->priv = g_slice_new0(TestBoxedPrivate);
+  boxed->priv->magic = 0xdeadbeef;
+  boxed->some_int8 = i;
+
+  return boxed;
+}
+
+TestBoxed *
+test_boxed_new_alternative_constructor2 (int i, int j)
+{
+  TestBoxed *boxed = g_slice_new0(TestBoxed);
+  boxed->priv = g_slice_new0(TestBoxedPrivate);
+  boxed->priv->magic = 0xdeadbeef;
+  boxed->some_int8 = i + j;
+
+  return boxed;
+}
+
+TestBoxed *
+test_boxed_new_alternative_constructor3 (char *s)
+{
+  TestBoxed *boxed = g_slice_new0(TestBoxed);
+  boxed->priv = g_slice_new0(TestBoxedPrivate);
+  boxed->priv->magic = 0xdeadbeef;
+  boxed->some_int8 = atoi(s);
+
+  return boxed;
+}
+
 TestBoxed *
 test_boxed_copy (TestBoxed *boxed)
 {
index be4f6c6f39bd9150ba0f1ed43cafe8d3525683f2..04c27d707e110805585032bb5920d648564a9c69 100644 (file)
@@ -216,6 +216,10 @@ struct _TestBoxed
 
 GType      test_boxed_get_type (void);
 TestBoxed *test_boxed_new      (void);
+TestBoxed *test_boxed_new_alternative_constructor1  (int i);
+TestBoxed *test_boxed_new_alternative_constructor2  (int i, int j);
+TestBoxed *test_boxed_new_alternative_constructor3  (char *s);
+
 TestBoxed *test_boxed_copy     (TestBoxed *boxed);
 gboolean   test_boxed_equals   (TestBoxed *boxed,
                                TestBoxed *other);