mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-23 15:15:34 +00:00
2003-12-08 Mike Kestner <mkestner@ximian.com>
* generator/VMSignature.cs : new class to generate virtual method signatures for default signal handlers. svn path=/trunk/gtk-sharp/; revision=20888
This commit is contained in:
parent
9c3f47e5d3
commit
968230bd25
|
@ -1,3 +1,8 @@
|
|||
2003-12-08 Mike Kestner <mkestner@ximian.com>
|
||||
|
||||
* generator/VMSignature.cs : new class to generate virtual method
|
||||
signatures for default signal handlers.
|
||||
|
||||
2003-12-08 Mike Kestner <mkestner@ximian.com>
|
||||
|
||||
* generator/ObjectGen.cs : stupid little whitespace change
|
||||
|
|
62
generator/VMSignature.cs
Normal file
62
generator/VMSignature.cs
Normal file
|
@ -0,0 +1,62 @@
|
|||
// GtkSharp.Generation.VMSignature.cs - The Virtual Method 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 VMSignature {
|
||||
|
||||
private ArrayList parms = new ArrayList ();
|
||||
|
||||
public VMSignature (Parameters parms)
|
||||
{
|
||||
if (parms == null)
|
||||
return;
|
||||
|
||||
bool has_cb = parms.HideData;
|
||||
for (int i = 1; i < parms.Count; i++) {
|
||||
Parameter p = parms [i];
|
||||
|
||||
if (i > 1 && p.IsLength && parms [i - 1].IsString)
|
||||
continue;
|
||||
|
||||
if (p.IsCount && ((i > 1 && 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 + " " : "";
|
||||
if (p.Generatable is StructGen)
|
||||
result [i] += "ref ";
|
||||
result [i++] += p.CSType + " " + p.Name;
|
||||
}
|
||||
|
||||
return String.Join (", ", result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue