generator: Added throws attribute to parameters
This enables gapi to decide whether a parameter is really throwing or should be handled as a usual parameter.
This commit is contained in:
parent
94da3fb2ab
commit
8d4ec22ef2
1 changed files with 21 additions and 2 deletions
|
@ -49,6 +49,18 @@ namespace GtkSharp.Generation {
|
|||
get { return param_list.Count; }
|
||||
}
|
||||
|
||||
// gapi assumes GError** parameters to be error parameters in version 1 and 2
|
||||
private bool throws = false;
|
||||
public bool Throws {
|
||||
get {
|
||||
if (ParserVersion <= 2)
|
||||
return true;
|
||||
if (!throws && elem.HasAttribute ("throws"))
|
||||
throws = elem.GetAttributeAsBoolean ("throws");
|
||||
return throws;
|
||||
}
|
||||
}
|
||||
|
||||
public int VisibleCount {
|
||||
get {
|
||||
int visible = 0;
|
||||
|
@ -76,7 +88,7 @@ namespace GtkSharp.Generation {
|
|||
if (p.IsCount)
|
||||
return true;
|
||||
|
||||
if (p.CType == "GError**")
|
||||
if (p.CType == "GError**" && Throws)
|
||||
return true;
|
||||
|
||||
if (HasCB || HideData) {
|
||||
|
@ -212,7 +224,7 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (p.CType == "GError**")
|
||||
} else if (p.CType == "GError**" && Throws)
|
||||
p = new ErrorParameter (parm);
|
||||
else if (gen is StructBase || gen is ByRefGen) {
|
||||
p = new StructParameter (parm);
|
||||
|
@ -277,5 +289,12 @@ namespace GtkSharp.Generation {
|
|||
return String.Join (", ", result);
|
||||
}
|
||||
}
|
||||
|
||||
private int ParserVersion {
|
||||
get {
|
||||
XmlElement root = elem.OwnerDocument.DocumentElement;
|
||||
return root.HasAttribute ("parser_version") ? int.Parse (root.GetAttribute ("parser_version")) : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue