parser: Add property support for ginterface

This commit is contained in:
Olivier Dufour 2011-07-30 11:47:44 +02:00
parent fe776b3a48
commit f0579eb53d
3 changed files with 80 additions and 18 deletions

View file

@ -6789,7 +6789,7 @@
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
</class_struct>
<field name="Priv" cname="priv" type="GEmblemedIconPrivate*" />
<property name="" cname="" type="class" />
<property name="Gicon" cname="gicon" type="GIcon" readable="true" writeable="true" construct-only="true" />
<implements>
<interface cname="GIcon" />
</implements>

View file

@ -2578,10 +2578,10 @@
<class_struct cname="GtkScrollableInterface">
<field name="BaseIface" cname="base_iface" type="GTypeInterface" />
</class_struct>
<property name="" cname="" type="ginterface" />
<property name="" cname="" type="ginterface" />
<property name="" cname="" type="ginterface" />
<property name="" cname="" type="ginterface" />
<property name="Hadjustment" cname="hadjustment" type="GtkAdjustment" readable="true" writeable="true" construct="true" />
<property name="Vadjustment" cname="vadjustment" type="GtkAdjustment" readable="true" writeable="true" construct="true" />
<property name="HscrollPolicy" cname="hscroll-policy" type="GtkScrollablePolicy" readable="true" writeable="true" />
<property name="VscrollPolicy" cname="vscroll-policy" type="GtkScrollablePolicy" readable="true" writeable="true" />
<method name="GetHadjustment" cname="gtk_scrollable_get_hadjustment">
<return-type type="GtkAdjustment*" />
</method>
@ -4443,8 +4443,8 @@
<field name="Padding" cname="padding" type="gpointer" array_len="16" />
</class_struct>
<field name="Priv" cname="priv" type="GtkAppChooserButtonPrivate*" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="ShowDialogItem" cname="show-dialog-item" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="Heading" cname="heading" type="gchar*" readable="true" writeable="true" />
<signal name="CustomItemActivated" cname="custom-item-activated" when="FIRST" field_name="custom_item_activated">
<return-type type="void" />
<parameters>
@ -4504,8 +4504,8 @@
<field name="Padding" cname="padding" type="gpointer" array_len="16" />
</class_struct>
<field name="Priv" cname="priv" type="GtkAppChooserDialogPrivate*" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="Gfile" cname="gfile" type="GFile" readable="true" writeable="true" construct-only="true" />
<property name="Heading" cname="heading" type="gchar*" readable="true" writeable="true" />
<implements>
<interface cname="GtkAppChooser" />
</implements>
@ -4558,12 +4558,12 @@
<field name="Padding" cname="padding" type="gpointer" array_len="16" />
</class_struct>
<field name="Priv" cname="priv" type="GtkAppChooserWidgetPrivate*" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="ShowDefault" cname="show-default" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="ShowRecommended" cname="show-recommended" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="ShowFallback" cname="show-fallback" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="ShowOther" cname="show-other" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="ShowAll" cname="show-all" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="DefaultText" cname="default-text" type="gchar*" readable="true" writeable="true" />
<signal name="ApplicationSelected" cname="application-selected" when="FIRST" field_name="application_selected">
<return-type type="void" />
<parameters>
@ -13627,7 +13627,7 @@
<field name="Padding" cname="padding" type="gpointer" array_len="16" />
</class_struct>
<field name="Priv" cname="priv" type="GtkNumerableIconPrivate*" />
<property name="" cname="" type="class" />
<property name="BackgroundIconName" cname="background-icon-name" type="gchar*" readable="true" writeable="true" />
<method name="GetBackgroundGicon" cname="gtk_numerable_icon_get_background_gicon">
<return-type type="GIcon*" />
</method>
@ -18427,7 +18427,7 @@
<method vm="_switch_padding_7" />
</class_struct>
<field name="Priv" cname="priv" type="GtkSwitchPrivate*" />
<property name="" cname="" type="class" />
<property name="Active" cname="active" type="gboolean" readable="true" writeable="true" />
<virtual_method name="SwitchPadding1" cname="_switch_padding_1" shared="true" padding="true">
<return-type type="void" />
</virtual_method>

View file

@ -1015,6 +1015,53 @@ sub addPropElem
$prop_elem->setAttribute('construct-only', "true") if ($mode =~ /CONSTRUCT_ONLY/);
}
sub addPropElem2
{
my ($spec, $node, $is_child) = @_;
my ($name, $mode, $docs);
$spec =~ /g_param_spec_(\w+)\s*\((.*)\s*\);/;
my $type = $1;
my @params = split(/,/, $2);
$name = $params[0];
if ($defines{$name}) {
$name = $defines{$name};
} else {
$name =~ s/\s*\"//g;
}
$mode = $params[$#params];
if ($type =~ /boolean|float|double|^u?int|pointer|unichar/) {
$type = "g$type";
} elsif ($type =~ /string/) {
$type = "gchar*";
} elsif ($type =~ /boxed|object/) {
$type = $params[$#params-1];
$type =~ s/TYPE_//;
$type =~ s/\s+//g;
$type = StudlyCaps(lc($type));
} elsif ($type =~ /enum|flags/) {
$type = $params[$#params-2];
$type =~ s/TYPE_//;
$type =~ s/\s+//g;
$type = StudlyCaps(lc($type));
}
$prop_elem = $doc->createElement($is_child ? "childprop" : "property");
$node->appendChild($prop_elem);
$prop_elem->setAttribute('name', StudlyCaps($name));
$prop_elem->setAttribute('cname', $name);
$prop_elem->setAttribute('type', $type);
$prop_elem->setAttribute('readable', "true") if ($mode =~ /READ/);
$prop_elem->setAttribute('writeable', "true") if ($mode =~ /WRIT/);
$prop_elem->setAttribute('construct', "true") if ($mode =~ /CONSTRUCT(?!_)/);
$prop_elem->setAttribute('construct-only', "true") if ($mode =~ /CONSTRUCT_ONLY/);
}
sub parseTypeToken
{
my ($tok) = @_;
@ -1115,6 +1162,8 @@ sub parseInitFunc
my @signal_vms = ();
my $linenum = 0;
my $pspec = "";
my $pspec_use = 0;
while ($linenum < @init_lines) {
my $line = $init_lines[$linenum];
@ -1123,10 +1172,18 @@ sub parseInitFunc
# FIXME: This ignores the bool helper macro thingie.
} elsif ($line =~ /g_object_(class|interface)_install_prop/) {
my $prop = $line;
$pspec_use = 1;
while ($prop !~ /\)\s*;/) {
$prop .= $init_lines[++$linenum];
if ($init_lines[$linenum] =~ /g_param_spec_/) {
$pspec_use = 0;
}
}
if ($pspec_use) {
addPropElem2 ($prop.$pspec, $obj_el, 0);
} else {
addPropElem ($prop, $obj_el, 0);
}
addPropElem ($prop, $obj_el, 0);
$propcnt++;
} elsif ($line =~ /gtk_container_class_install_child_property/) {
my $prop = $line;
@ -1143,6 +1200,11 @@ sub parseInitFunc
$signal_vm = addSignalElem ($sig, $classdef, $obj_el);
push (@signal_vms, $signal_vm) if $signal_vm;
$sigcnt++;
} elsif ($line =~ /g_param_spec_/) {
$pspec = $line;
do {
$pspec .= $init_lines[++$linenum];
} until ($init_lines[$linenum] =~ /\)\s*;/);
}
$linenum++;
}