Ryujinx-GtkSharp/generator/Signature.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

76 lines
1.5 KiB
C#

// GtkSharp.Generation.Signature.cs - The Signature Generation Class.
//
// Author: Mike Kestner <mkestner@ximian.com>
//
// (c) 2003 Novell, Inc.
namespace GtkSharp.Generation {
using System;
using System.Collections;
using System.Xml;
public class Signature {
private ArrayList parms = new ArrayList ();
public Signature (Parameters parms)
{
if (parms == null)
return;
bool has_cb = parms.HideData;
for (int i = 0; i < parms.Count; i++) {
Parameter p = parms [i];
if (i > 0 && p.IsLength && parms [i - 1].IsString)
continue;
if (p.IsCount && ((i > 0 && parms [i - 1].IsArray) || (i < parms.Count - 1 && parms [i + 1].IsArray)))
continue;
has_cb = has_cb || p.Generatable is CallbackGen;
if (p.IsUserData && has_cb && (i == parms.Count - 1))
continue;
if (p.CType == "GError**")
continue;
this.parms.Add (p);
}
}
public override string ToString ()
{
if (parms.Count == 0)
return "";
string[] result = new string [parms.Count];
int i = 0;
foreach (Parameter p in parms) {
result [i] = p.PassAs != "" ? p.PassAs + " " : "";
result [i++] += p.CSType + " " + p.Name;
}
return String.Join (", ", result);
}
public string Types {
get {
if (parms.Count == 0)
return "";
string[] result = new string [parms.Count];
int i = 0;
foreach (Parameter p in parms)
result [i++] = p.CSType;
return String.Join (":", result);
}
}
}
}