mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-01-14 10:15:31 +00:00
2007-11-29 Mike Kestner <mkestner@novell.com>
* generator/MethodBase.cs: move Name stuff from subclasses. Check for (G|S)et<UpperCaseLetter> in new Has props. * generator/Method.cs: * generator/VirtualMethod.cs: refactor out Name stuff. Use new Has(G|S)etterName props. * pango/Pango.metadata: workaround Has/Hash collision with the old broken getter check. [Fixes #344954] svn path=/trunk/gtk-sharp/; revision=90458
This commit is contained in:
parent
3839abb463
commit
75d2981d82
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2007-11-29 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* generator/MethodBase.cs: move Name stuff from subclasses.
|
||||
Check for (G|S)et<UpperCaseLetter> in new Has props.
|
||||
* generator/Method.cs:
|
||||
* generator/VirtualMethod.cs: refactor out Name stuff. Use
|
||||
new Has(G|S)etterName props.
|
||||
* pango/Pango.metadata: workaround Has/Hash collision with
|
||||
the old broken getter check. [Fixes #344954]
|
||||
|
||||
2007-11-29 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* glib/Signal.cs: ignore GCHandles with null targets since
|
||||
|
|
|
@ -32,7 +32,6 @@ namespace GtkSharp.Generation {
|
|||
private ReturnValue retval;
|
||||
|
||||
private string call;
|
||||
private string name;
|
||||
private string protection = "public";
|
||||
private bool is_get, is_set;
|
||||
private bool deprecated = false;
|
||||
|
@ -42,9 +41,8 @@ namespace GtkSharp.Generation {
|
|||
this.retval = new ReturnValue (elem["return-type"]);
|
||||
if (!container_type.IsDeprecated && elem.HasAttribute ("deprecated"))
|
||||
deprecated = elem.GetAttribute ("deprecated") == "1";
|
||||
this.name = elem.GetAttribute("name");
|
||||
if (name == "GetType")
|
||||
name = "GetGType";
|
||||
if (Name == "GetType")
|
||||
Name = "GetGType";
|
||||
}
|
||||
|
||||
public bool IsDeprecated {
|
||||
|
@ -65,15 +63,6 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get {
|
||||
return name;
|
||||
}
|
||||
set {
|
||||
name = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Protection {
|
||||
get {
|
||||
return protection;
|
||||
|
@ -89,16 +78,6 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
string BaseName {
|
||||
get {
|
||||
string name = Name;
|
||||
int idx = Name.LastIndexOf (".");
|
||||
if (idx > 0)
|
||||
name = Name.Substring (idx + 1);
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Validate ()
|
||||
{
|
||||
if (!retval.Validate () || !base.Validate ()) {
|
||||
|
@ -106,10 +85,9 @@ namespace GtkSharp.Generation {
|
|||
return false;
|
||||
}
|
||||
|
||||
string name = BaseName;
|
||||
Parameters parms = Parameters;
|
||||
is_get = ((((parms.IsAccessor && retval.IsVoid) || (parms.Count == 0 && !retval.IsVoid)) || (parms.Count == 0 && !retval.IsVoid)) && name.Length > 3 && (name.StartsWith ("Get") || name.StartsWith ("Is") || name.StartsWith ("Has")));
|
||||
is_set = ((parms.IsAccessor || (parms.VisibleCount == 1 && retval.IsVoid)) && (name.Length > 3 && name.Substring(0, 3) == "Set"));
|
||||
is_get = ((((parms.IsAccessor && retval.IsVoid) || (parms.Count == 0 && !retval.IsVoid)) || (parms.Count == 0 && !retval.IsVoid)) && HasGetterName);
|
||||
is_set = ((parms.IsAccessor || (parms.VisibleCount == 1 && retval.IsVoid)) && HasSetterName);
|
||||
|
||||
call = "(" + (IsStatic ? "" : container_type.CallByName () + (parms.Count > 0 ? ", " : "")) + Body.GetCallString (is_set) + ")";
|
||||
|
||||
|
|
|
@ -32,17 +32,29 @@ namespace GtkSharp.Generation {
|
|||
Parameters parms;
|
||||
bool is_static = false;
|
||||
string mods = String.Empty;
|
||||
string name;
|
||||
|
||||
protected MethodBase (XmlElement elem, ClassBase container_type)
|
||||
{
|
||||
this.elem = elem;
|
||||
this.container_type = container_type;
|
||||
this.name = elem.GetAttribute ("name");
|
||||
parms = new Parameters (elem ["parameters"]);
|
||||
IsStatic = elem.GetAttribute ("shared") == "true";
|
||||
if (elem.HasAttribute ("new_flag"))
|
||||
mods = "new ";
|
||||
}
|
||||
|
||||
protected string BaseName {
|
||||
get {
|
||||
string name = Name;
|
||||
int idx = Name.LastIndexOf (".");
|
||||
if (idx > 0)
|
||||
name = Name.Substring (idx + 1);
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
MethodBody body;
|
||||
public MethodBody Body {
|
||||
get {
|
||||
|
@ -58,6 +70,30 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
protected bool HasGetterName {
|
||||
get {
|
||||
string name = BaseName;
|
||||
if (name.Length <= 3)
|
||||
return false;
|
||||
if (name.StartsWith ("Get") || name.StartsWith ("Has"))
|
||||
return Char.IsUpper (name [3]);
|
||||
else if (name.StartsWith ("Is"))
|
||||
return Char.IsUpper (name [2]);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected bool HasSetterName {
|
||||
get {
|
||||
string name = BaseName;
|
||||
if (name.Length <= 3)
|
||||
return false;
|
||||
|
||||
return name.StartsWith ("Set") && Char.IsUpper (name [3]);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsStatic {
|
||||
get {
|
||||
return is_static;
|
||||
|
@ -85,6 +121,15 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get {
|
||||
return name;
|
||||
}
|
||||
set {
|
||||
name = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Parameters Parameters {
|
||||
get {
|
||||
return parms;
|
||||
|
|
|
@ -42,13 +42,13 @@ namespace GtkSharp.Generation {
|
|||
|
||||
public bool IsGetter {
|
||||
get {
|
||||
return (Name.StartsWith ("Get") || Name.StartsWith ("Has")) && ((!retval.IsVoid && parms.Count == 1) || (retval.IsVoid && parms.Count == 2 && parms [1].PassAs == "out"));
|
||||
return HasGetterName && ((!retval.IsVoid && parms.Count == 1) || (retval.IsVoid && parms.Count == 2 && parms [1].PassAs == "out"));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSetter {
|
||||
get {
|
||||
if (!Name.StartsWith ("Set") || !retval.IsVoid)
|
||||
if (!HasSetterName || !retval.IsVoid)
|
||||
return false;
|
||||
|
||||
if (parms.Count == 2 || (parms.Count == 4 && parms [1].Scope == "notified"))
|
||||
|
@ -64,12 +64,6 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get {
|
||||
return elem.GetAttribute("name");
|
||||
}
|
||||
}
|
||||
|
||||
public void GenerateCallback (StreamWriter sw)
|
||||
{
|
||||
if (!Validate ())
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<attr path="/api/namespace/boxed[@cname='PangoFontDescription']/method[@name='CopyStatic']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='PangoFontDescription']/method[@name='Free']" name="deprecated">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='PangoFontDescription']/method[@name='FromString']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='PangoFontDescription']/method[@name='Hash']" name="name">GetHash</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='PangoFontMetrics']/method[@name='Ref']" name="deprecated">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='PangoFontMetrics']/method[@name='Unref']" name="deprecated">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='PangoGlyphString']/field[@name='Glyphs']" name="hidden">1</attr>
|
||||
|
|
Loading…
Reference in a new issue