[Gtk-sharp-list] serialization support

Lee Mallabone gnome@fonicmonkey.net
12 Apr 2003 20:16:09 +0100

Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Sat, 2003-04-12 at 16:44, Gonzalo Paniagua Javier wrote:
> Well, first someone should modify the generator to handle <implements>
> so we can tell it to implement ISerializable.

After glancing at the code, it seems the generator already handles
<implements> for C types, so I suspect it just needs a tweak to allow C#
type names in the <implements> child nodes?

However, it looks like the metadata handler will also need altering,
right? At the moment, there don't appear to be any manual uses of
<implements> in the *.metadata files...

> Take a look at gtk+/gdk-pixbuf/gdk-pixdata.c. It contains C functions to
> serialize and deserialize a pixbuf.

Unfortunately the C# wrapped versions are broken as it stands. I've
attached a patch that corrects the signatures for those methods...

Mike, okay to commit?

> Then implement GetObjectData and a protected .ctor the creates the
> pixbuf from the data stored in GetObjectData.

Looking at this now... I suspect it's going to be a real pain to test.
Thanks for the tips.



Content-Disposition: attachment; filename=pixdata-metadata.diff
Content-Type: text/x-patch; name=pixdata-metadata.diff; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: 7bit

Index: api/gdk-api.xml
RCS file: /cvs/public/gtk-sharp/api/gdk-api.xml,v
retrieving revision 1.16
diff -u -r1.16 gdk-api.xml
--- api/gdk-api.xml	4 Apr 2003 07:24:02 -0000	1.16
+++ api/gdk-api.xml	12 Apr 2003 17:10:11 -0000
@@ -2903,7 +2903,7 @@
         <return-type type="gboolean"/>
           <parameter type="guint" name="stream_length"/>
-          <parameter type="const-guint8*" name="stream"/>
+          <parameter type="const-guint8*" name="stream" array="true"/>
           <parameter type="GError**" name="error"/>
@@ -2914,7 +2914,7 @@
           <parameter type="gboolean" name="use_rle"/>
-      <method name="Serialize" cname="gdk_pixdata_serialize">
+      <method name="Serialize" cname="gdk_pixdata_serialize" hidden="1">
         <return-type type="guint8*"/>
           <parameter type="guint*" name="stream_length_p"/>
Index: sources/Gdk.metadata
RCS file: /cvs/public/gtk-sharp/sources/Gdk.metadata,v
retrieving revision 1.14
diff -u -r1.14 Gdk.metadata
--- sources/Gdk.metadata	4 Apr 2003 07:24:02 -0000	1.14
+++ sources/Gdk.metadata	12 Apr 2003 17:10:11 -0000
@@ -118,6 +118,31 @@
+  <class name="GdkPixdata">
+    <method>Serialize</method>
+  </class>
+  <data>
+    <attribute target="method">
+      <name>hidden</name>
+      <value>1</value>
+    </attribute>
+  </data>
+  <class name="GdkPixdata">
+    <method>Deserialize</method>
+  </class>
+  <data>
+    <attribute target="param">
+      <filter level="name">stream</filter>
+      <name>array</name>
+      <value>true</value>
+    </attribute>
+  </data>
 <!-- ref parameters -->
   <class name="GdkColor">

Content-Disposition: attachment; filename=Pixdata.custom
Content-Type: text/plain; name=Pixdata.custom; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: 7bit

		static extern byte[] gdk_pixdata_serialize(ref Gdk.Pixdata raw, out uint stream_length_p);

		/// <summary> Serialize Method </summary>
		/// <remarks> To be completed </remarks>
		public byte[] Serialize(out uint stream_length_p) {
				return gdk_pixdata_serialize(ref this, out stream_length_p);