Ryujinx-GtkSharp/generator/Signature.cs
Dan Winship b7e4cc507e * generator/Parameters.cs (IsHidden): method to check if a
parameter should be hidden in the managed sig (eg, because it's
	user_data, or it's the length of the preceding array/string, etc).
	(VisibleCount): the number of parameters that will actually be
	exposed in the managed signature.
	(IsAccessor): test VisibleCount, not Count
	(AccessorReturnType, AccessorName): deal with the fact that the
	accessor parameter might not be the first one.

	* generator/CallbackGen.cs:
	* generator/Signature.cs: use Parameters.IsHidden.

	* generator/Method.cs (Initialize): set is_set based on
	VisibleCount, not Count.
	(Validate): call base.Validate() before Initialize() so that
	VisibleCount will be correct in Initialize.

	* generator/MethodBody.cs (GetCallString, CallArrayLength,
	Initialize): update to deal with accessors with multiple args.

	* gtk/Clipboard.custom (SetText): implement as an Obsolete variant
	of the Text property

	* gtk/IconTheme.custom (SearchPath, SetSearchPath): obsolete
	SetSearchPath, implement a setter on SearchPath instead.

	* gtk/ListStore.custom (SetColumnTypes):
	* gtk/TreeStore.custom (SetColumnTypes): implement as an Obsolete
	variant of the ColumnTypes property.

	* glade/XML.custom (CustomHandler): implement as a property
	(SetCustomHandler): Mark this obsolete

	* glade/Global.custom (SetCustomHandler): deprecate in favor of
	XML.CustomHandler.

	* gnomedb/Editor.custom (SetText): implement as an Obsolete
	variant of the Text property

svn path=/trunk/gtk-sharp/; revision=43898
2005-05-02 20:10:03 +00:00

124 lines
2.7 KiB
C#

// GtkSharp.Generation.Signature.cs - The Signature Generation Class.
//
// Author: Mike Kestner <mkestner@ximian.com>
//
// Copyright (c) 2003-2004 Novell, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public
// License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
namespace GtkSharp.Generation {
using System;
using System.Collections;
using System.Xml;
public class Signature {
private ArrayList parms = new ArrayList ();
public Signature (Parameters parms)
{
foreach (Parameter p in parms) {
if (!parms.IsHidden (p))
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);
}
}
public bool IsAccessor {
get {
int count = 0;
foreach (Parameter p in parms) {
if (p.PassAs == "out")
count++;
if (count > 1)
return false;
}
return count == 1;
}
}
public string AccessorType {
get {
foreach (Parameter p in parms)
if (p.PassAs == "out")
return p.CSType;
return null;
}
}
public string AccessorName {
get {
foreach (Parameter p in parms)
if (p.PassAs == "out")
return p.Name;
return null;
}
}
public string AsAccessor {
get {
string[] result = new string [parms.Count - 1];
int i = 0;
foreach (Parameter p in parms) {
if (p.PassAs == "out")
continue;
result [i] = p.PassAs != "" ? p.PassAs + " " : "";
result [i++] += p.CSType + " " + p.Name;
}
return String.Join (", ", result);
}
}
}
}