mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-25 17:55:35 +00:00
fb1256d2f3
* parser/Gnome.metadata, Gtk.metadata: More conflict fixes. * parser/build.pl: Fully qualify all lib names. (Gtk+ packages are now LFS-compliant in Debian...) * parser/gapi2xml.pl: Fix for whitespace in fields, defines, and docs. * generator/BoxedGen.cs: Remove extraneous CallByName definition, add "override" keyword to FromNative. (Generate): Generate methods after fields. * generator/ClassBase.cs: Change CallByName, FromNative to virtual. (.ctor): Ignore "hidden" nodes. Set container on signal. (GenSignals, GenMethods): Add "implementor" argument for interface use. (Get(Method|Signal|Property)Recursively): Rework to correctly recurse interfaces. (Implements): Added. * generator/Ctor.cs (Initialize): Move clash initialization completely out of Generate, so we can check for collisions. * generator/Method.cs (GenerateDeclCommon): Check for duplicates, for "new" keyword. (Generate): Add "implementor" argument. * generator/ObjectGen.cs (Generate): Initialize ctor clashes on this and all parents, before generating. (Ctors, InitializeCtors): Added. * generator/Signal.cs: Store the container_type, check for collisions. * generator/StructGen.cs: Add "override" keyword to overriden methods. * gtk/FileSelection.custom (ActionArea): Add "new" keyword. svn path=/trunk/gtk-sharp/; revision=5782
84 lines
2 KiB
C#
84 lines
2 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 override 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) {
|
|
if (!(node is XmlElement)) continue;
|
|
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":
|
|
//Console.WriteLine ("HIYA {0}", ((Method) member).Name);
|
|
break;
|
|
|
|
default:
|
|
Console.WriteLine ("Unexpected node");
|
|
break;
|
|
}
|
|
}
|
|
|
|
GenMethods (sw, null, null, false);
|
|
AppendCustom(sw);
|
|
sw.WriteLine ("\t}");
|
|
CloseWriter (sw);
|
|
Statistics.BoxedCount++;
|
|
}
|
|
}
|
|
}
|
|
|