GtkSharp/generator/ImportSignature.cs
Mike Kestner f61ac5c89c 2003-12-03 Mike Kestner <mkestner@speakeasy.net>
* generator/CallbackGen.cs : use new sig and isig classes.
	* generator/Ctor.cs : use new sig, isig, and body classes.
	* generator/ImportSignature.cs : isig code spun out from Parameters.
	* generator/Method.cs : use new sig, isig, and body classes.
	* generator/MethodBody.cs : spun Initialize, GetCallString,
	Finish, and Exception throwing methods from Parameters.
	* generator/Parameters.cs : Slayed the evilness that was CreateSignature.
	It is now essentially a container for Parameter classes instead of a
	tangled mess of code trying to do everything remotely related to
	parameter lists. Also completely killed the VAType/IsVarArgs stuff,
	as it can be done with the array and params attrs instead.
	* generator/Property.cs : use new sig class.
	* generator/Signature.cs : new method sig generator extracted from
	Parameters class. add "params" keyword support for tagged parameters.
	* gnome/Gnome.metadata : hide IconList.GetSearchPath (to be manual)
	* gnome/gnome-api.xml : regen
	* gtk/ListStore.custom : kill unneeded overload
	* gtk/TreeStore.custom : kill unneeded overload
	* gtk/Gtk.metadata : mark params/args on *store_newv
	* gtk/gtk-api.xml : regenerated

svn path=/trunk/gtk-sharp/; revision=20755
2003-12-03 23:08:14 +00:00

55 lines
1.5 KiB
C#

// GtkSharp.Generation.ImportSignature.cs - The ImportSignature Generation Class.
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001-2003 Mike Kestner, (c) 2003 Novell, Inc.
namespace GtkSharp.Generation {
using System;
using System.Collections;
public class ImportSignature {
Parameters parameters;
string impl_ns;
public ImportSignature (Parameters parms, string impl_ns)
{
parameters = parms;
this.impl_ns = impl_ns;
}
private bool UsesHandle (IGeneratable igen)
{
return igen is ManualGen || igen is ObjectGen || igen is InterfaceGen || igen is OpaqueGen;
}
public override string ToString ()
{
if (parameters == null)
return "";
string[] parms = new string [parameters.Count];
for (int i = 0; i < parameters.Count; i++) {
Parameter p = parameters [i];
string m_type = p.MarshalType;
if (p.Generatable is CallbackGen)
m_type = impl_ns + "Sharp" + p.MarshalType.Substring(p.MarshalType.IndexOf("."));
parms [i] = "";
if (p.CType == "GError**")
parms [i] += "out ";
else if (p.PassAs != "" && (!m_type.EndsWith ("IntPtr") || UsesHandle (p.Generatable)))
parms [i] += p.PassAs + " ";
parms [i] += m_type + " " + p.Name;
}
string import_sig = String.Join (", ", parms);
import_sig = import_sig.Replace ("out ref", "out");
import_sig = import_sig.Replace ("ref ref", "ref");
return import_sig;
}
}
}