mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-24 17:15:29 +00:00
1f4ff5bb86
* glib/EnumWrapper.cs: New class which holds an enum int. * glib/Value.cs: Add support for glib enum types. We needed to use EnumWrapper for this because otherwise the int operator wouldn't know which glib function to use. * generator/BoxedGen.cs, ClassBase.cs, Ctor.cs, EnumGen.cs, InterfaceGen.cs, Method.cs, ObjectGen.cs, Signal.cs, StructGen.cs: Create more doc stubs. * generator/Property.cs: Generate enum values correctly. * generator/Ctor.cs: Refactor generation to honor metadata-specified collision preference. * parser/Gtk.metadata: Added constructor collision preferences to all known clashes. * parse/Gdk.metadata: Added (for Pixbuf clashes). svn path=/trunk/gtk-sharp/; revision=5437
90 lines
2.1 KiB
C#
90 lines
2.1 KiB
C#
// GtkSharp.Generation.BoxedGen.cs - The Boxed Type Generatable.
|
|
//
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
//
|
|
// (c) 2001-2002 Mike Kestner
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using System.Xml;
|
|
|
|
public class BoxedGen : StructBase, IGeneratable {
|
|
|
|
public BoxedGen (XmlElement ns, XmlElement elem) : base (ns, elem) {}
|
|
|
|
public String CallByName (String var_name)
|
|
{
|
|
return var_name + ".Handle";
|
|
}
|
|
|
|
public String FromNative(String var)
|
|
{
|
|
return "(" + QualifiedName + ") GLib.Boxed.FromNative(" + var + ")";
|
|
}
|
|
|
|
public void Generate ()
|
|
{
|
|
StreamWriter sw = CreateWriter ();
|
|
|
|
sw.WriteLine ("\tusing System;");
|
|
sw.WriteLine ("\tusing System.Collections;");
|
|
sw.WriteLine ("\tusing System.Runtime.InteropServices;");
|
|
sw.WriteLine ();
|
|
|
|
sw.WriteLine("\t\t/// <summary> " + Name + " Boxed Struct</summary>");
|
|
sw.WriteLine("\t\t/// <remarks>");
|
|
sw.WriteLine("\t\t/// </remarks>");
|
|
|
|
sw.WriteLine ("\t[StructLayout(LayoutKind.Sequential)]");
|
|
sw.WriteLine ("\tpublic class " + Name + " : GLib.Boxed {");
|
|
sw.WriteLine ();
|
|
|
|
sw.WriteLine("\t\tpublic " + Name + "(IntPtr raw) : base(raw) {}");
|
|
sw.WriteLine();
|
|
|
|
Hashtable clash_map = new Hashtable();
|
|
|
|
foreach (XmlNode node in Elem.ChildNodes) {
|
|
|
|
XmlElement member = (XmlElement) node;
|
|
|
|
switch (node.Name) {
|
|
case "field":
|
|
Statistics.IgnoreCount++;
|
|
// GenField(member, sw);
|
|
break;
|
|
|
|
case "callback":
|
|
Statistics.IgnoreCount++;
|
|
break;
|
|
|
|
case "constructor":
|
|
if (!GenCtor(member, sw, clash_map)) {
|
|
Console.WriteLine(" in boxed " + CName);
|
|
}
|
|
break;
|
|
|
|
case "method":
|
|
if (!GenMethod(member, sw)) {
|
|
Console.WriteLine(" in boxed " + CName);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
Console.WriteLine ("Unexpected node");
|
|
break;
|
|
}
|
|
}
|
|
|
|
AppendCustom(sw);
|
|
sw.WriteLine ("\t}");
|
|
CloseWriter (sw);
|
|
Statistics.BoxedCount++;
|
|
}
|
|
}
|
|
}
|
|
|