2004-01-27 Mike Kestner <mkestner@ximian.com>

* generator/BoxedGen.cs : gen a Value to Boxed explicit cast op.
	* generator/Property.cs : use new cast in Boxed getters.
	[Fixes #53414]

svn path=/trunk/gtk-sharp/; revision=22553
This commit is contained in:
Mike Kestner 2004-01-27 22:06:24 +00:00
parent 359458917c
commit 1742a837c1
3 changed files with 17 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2004-01-27 Mike Kestner <mkestner@ximian.com>
* generator/BoxedGen.cs : gen a Value to Boxed explicit cast op.
* generator/Property.cs : use new cast in Boxed getters.
[Fixes #53414]
2004-01-27 Mike Kestner <mkestner@ximian.com>
* gtk/Gtk.Metadata : revert opaquing of TextIter.

View file

@ -28,6 +28,9 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t\tstatic extern IntPtr gtksharp_value_create (GLib.GType gtype);");
sw.WriteLine ();
sw.WriteLine ("\t\t[DllImport(\"libgobject-2.0-0.dll\")]");
sw.WriteLine ("\t\tstatic extern IntPtr g_value_get_boxed (IntPtr handle);");
sw.WriteLine ();
sw.WriteLine ("\t\t[DllImport(\"libgobject-2.0-0.dll\")]");
sw.WriteLine ("\t\tstatic extern void g_value_set_boxed (IntPtr handle, ref " + QualifiedName + " boxed);");
sw.WriteLine ();
sw.WriteLine ("\t\tpublic static explicit operator GLib.Value (" + QualifiedName + " boxed)");
@ -37,6 +40,13 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t\t\tg_value_set_boxed (handle, ref boxed);");
sw.WriteLine ("\t\t\treturn new GLib.Value (handle, IntPtr.Zero);");
sw.WriteLine ("\t\t}");
sw.WriteLine ();
sw.WriteLine ("\t\tpublic static explicit operator " + QualifiedName + " (GLib.Value val)");
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tIntPtr boxed_ptr = g_value_get_boxed (val.Handle);");
sw.WriteLine ("\t\t\treturn New (boxed_ptr);");
sw.WriteLine ("\t\t}");
sw.WriteLine ("#endregion");
AppendCustom(sw, gen_info.CustomDir);

View file

@ -125,8 +125,7 @@ namespace GtkSharp.Generation {
if (!table.IsBoxed (c_type) && !table.IsObject (c_type))
sw.WriteLine("\t\t\t\tif (ret == null) ret = new " + cs_type + "(raw_ret);");
} else if (table.IsOpaque (c_type) || table.IsBoxed (c_type)) {
sw.WriteLine("\t\t\t\tSystem.IntPtr raw_ret = val.Handle;");
sw.WriteLine("\t\t\t\t" + cs_type + " ret = " + table.FromNativeReturn(c_type, "raw_ret") + ";");
sw.WriteLine("\t\t\t\t" + cs_type + " ret = (" + cs_type + ") val;");
} else {
sw.Write("\t\t\t\t" + cs_type + " ret = ");
sw.Write ("(" + cs_type + ") ");