Some fixes to support updated gstreamer-sharp (#29)

* parameters: Ignore UserData arguments to compute if has_optional

Those are never present in the prototypes and thus should not be taken
into account to see if prototype alternative has to be implemented.

* Fix generation of interface properties

* generator: Enhance the way we check if a field is padding

First check that fields are private to see if a field is padding,
in GstVideo we have public field staring with padding
(VideoAlignment.padding_top/bottomg/left/right) and thus need to be
taken into account to compare structures.

Also add a way for user to specify that the field is padding with
the new `is-padding` attribute.

In GStreamer padding fields usually look like __gst_reservedX, meaning
that they go unnoticed by previous code.
This commit is contained in:
Thibault Saunier 2017-08-24 10:20:05 -03:00 committed by Mikkel Kruse Johnsen
parent b6260e8865
commit 87d4d29dfd
3 changed files with 10 additions and 2 deletions

View File

@ -206,7 +206,7 @@ namespace GtkSharp.Generation {
return false;
}
if (p.IsOptional && p.PassAs == String.Empty)
if (p.IsOptional && p.PassAs == String.Empty && p.IsUserData == false)
has_optional = true;
IGeneratable gen = p.Generatable;

View File

@ -68,10 +68,14 @@ namespace GtkSharp.Generation {
}
protected virtual string RawGetter (string qpname) {
if (container_type is InterfaceGen)
return "implementor.GetProperty (" + qpname + ")";
return "GetProperty (" + qpname + ")";
}
protected virtual string RawSetter (string qpname) {
if (container_type is InterfaceGen)
return "implementor.SetProperty(" + qpname + ", val)";
return "SetProperty(" + qpname + ", val)";
}

View File

@ -102,7 +102,11 @@ namespace GtkSharp.Generation {
public bool IsPadding {
get {
return (CName.StartsWith ("dummy") || CName.StartsWith ("padding"));
if (elem.GetAttributeAsBoolean ("is-padding"))
return elem.GetAttributeAsBoolean ("is-padding");
return (elem.GetAttribute ("access") == "private" && (
CName.StartsWith ("dummy") || CName.StartsWith ("padding")));
}
}