Ryujinx-GtkSharp/generator/InterfaceGen.cs
Mike Kestner 9877690874 2003-10-06 Mike Kestner <mkestner@ximian.com>
* generator/InterfaceGen.cs (Generate): gen the EventHandlers for sigs
	* generator/Signal.cs (GetHandlerName): kill this and split it into
	EventHandlerName and EventHandlerArgsName props instead of the ugly
	out param hack.
	(GenEventHandler): make public void and add gen_info param. open
	stream with gen_info. use new *Name props.
	(Generate): only gen the EventHandler if we're genning the container,
	not for implementors.

svn path=/trunk/gtk-sharp/; revision=18684
2003-10-06 20:12:09 +00:00

62 lines
1.4 KiB
C#

// GtkSharp.Generation.InterfaceGen.cs - The Interface Generatable.
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001-2002 Mike Kestner
namespace GtkSharp.Generation {
using System;
using System.IO;
using System.Xml;
public class InterfaceGen : ClassBase, IGeneratable {
public InterfaceGen (XmlElement ns, XmlElement elem) : base (ns, elem) {}
public void Generate ()
{
GenerationInfo gen_info = new GenerationInfo (NSElem);
Generate (gen_info);
}
public void Generate (GenerationInfo gen_info)
{
StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
sw.WriteLine ("namespace " + NS + " {");
sw.WriteLine ();
sw.WriteLine ("\tusing System;");
sw.WriteLine ();
sw.WriteLine ("#region Autogenerated code");
sw.WriteLine ("\tpublic interface " + Name + " : GLib.IWrapper {");
sw.WriteLine ();
foreach (Signal sig in sigs.Values) {
if (sig.Validate ()) {
sig.GenerateDecl (sw);
sig.GenEventHandler (gen_info);
}
}
foreach (Method method in methods.Values) {
if (IgnoreMethod (method))
continue;
if (method.Validate ())
method.GenerateDecl (sw);
}
AppendCustom (sw, gen_info.CustomDir);
sw.WriteLine ("\t}");
sw.WriteLine ("#endregion");
sw.WriteLine ("}");
sw.Close ();
gen_info.Writer = null;
Statistics.IFaceCount++;
}
}
}