2009-04-25 Mike Kestner <mkestner@novell.com>

* parser/gapi-fixup.cs: add remove-attr and change-node-type
	fixup rules.  [Fixes #494194]

svn path=/trunk/gtk-sharp/; revision=132676
This commit is contained in:
Mike Kestner 2009-04-26 03:08:54 +00:00
parent a2715073d1
commit 9d5b3e97be
2 changed files with 47 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2009-04-25 Mike Kestner <mkestner@novell.com>
* parser/gapi-fixup.cs: add remove-attr and change-node-type
fixup rules. [Fixes #494194]
2009-04-25 Mike Kestner <mkestner@novell.com>
* generator/OpaqueGen.cs: support declaring managed ifaces.

View file

@ -120,6 +120,30 @@ namespace GtkSharp.Parsing {
if (!matched)
Console.WriteLine ("Warning: <add-node path=\"{0}\"/> matched no nodes", path);
}
XPathNodeIterator change_node_type_iter = meta_nav.Select ("/metadata/change-node-type");
while (change_node_type_iter.MoveNext ()) {
string path = change_node_type_iter.Current.GetAttribute ("path", "");
XPathNodeIterator api_iter = api_nav.Select (path);
bool matched = false;
while (api_iter.MoveNext ()) {
XmlElement node = ( (IHasXmlNode) api_iter.Current).GetNode () as XmlElement;
XmlElement parent = node.ParentNode as XmlElement;
XmlElement new_node = api_doc.CreateElement (change_node_type_iter.Current.Value);
foreach (XmlNode child in node.ChildNodes)
new_node.AppendChild (child.Clone ());
foreach (XmlAttribute attribute in node.Attributes)
new_node.Attributes.Append ( (XmlAttribute) attribute.Clone ());
parent.ReplaceChild (new_node, node);
matched = true;
}
if (!matched)
Console.WriteLine ("Warning: <change-node-type path=\"{0}\"/> matched no nodes", path);
}
XPathNodeIterator attr_iter = meta_nav.Select ("/metadata/attr");
while (attr_iter.MoveNext ()) {
@ -156,6 +180,24 @@ namespace GtkSharp.Parsing {
if (!matched)
Console.WriteLine ("Warning: <move-node path=\"{0}\"/> matched no nodes", path);
}
XPathNodeIterator remove_attr_iter = meta_nav.Select ("/metadata/remove-attr");
while (remove_attr_iter.MoveNext ()) {
string path = remove_attr_iter.Current.GetAttribute ("path", "");
string name = remove_attr_iter.Current.GetAttribute ("name", "");
XPathNodeIterator api_iter = api_nav.Select (path);
bool matched = false;
while (api_iter.MoveNext ()) {
XmlElement node = ( (IHasXmlNode) api_iter.Current).GetNode () as XmlElement;
node.RemoveAttribute (name);
matched = true;
}
if (!matched)
Console.WriteLine ("Warning: <remove-attr path=\"{0}\"/> matched no nodes", path);
}
if (symbol_doc != null) {
XPathNavigator symbol_nav = symbol_doc.CreateNavigator ();