Ryujinx-GtkSharp/generator/BoxedGen.cs
Rachel Hestilow fb1256d2f3 2002-07-13 Rachel Hestilow <hestilow@ximian.com>
* 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
2002-07-13 20:31:23 +00:00

84 lines
2.0 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++;
}
}
}