mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-02-28 15:17:00 +00:00
generator/EnumGen.cs: Added support for different types. Useful for the
GtkMozEmbed headers. svn path=/trunk/gtk-sharp/; revision=11696
This commit is contained in:
parent
6b913229ea
commit
ff931046db
|
@ -1,3 +1,7 @@
|
||||||
|
2003-02-18 Mark Crichton <crichton@gimp.org>
|
||||||
|
|
||||||
|
* generator/EnumGen.cs: Handle different enum types.
|
||||||
|
|
||||||
2003-02-14 Duncan Mak <duncan@ximian.com>
|
2003-02-14 Duncan Mak <duncan@ximian.com>
|
||||||
|
|
||||||
* api/gtk-api.xml:
|
* api/gtk-api.xml:
|
||||||
|
|
|
@ -61,9 +61,35 @@ namespace GtkSharp.Generation {
|
||||||
if (Elem.GetAttribute("type") == "flags")
|
if (Elem.GetAttribute("type") == "flags")
|
||||||
sw.WriteLine ("\t[Flags]");
|
sw.WriteLine ("\t[Flags]");
|
||||||
|
|
||||||
|
// Ok, this is obscene. We need to go through the enums first
|
||||||
|
// to find "large" values. If we find some, we need to change
|
||||||
|
// the base type of the enum.
|
||||||
|
|
||||||
|
string enum_type = null;
|
||||||
|
|
||||||
|
foreach (XmlNode node in Elem.ChildNodes) {
|
||||||
|
if (!(node is XmlElement) || node.Name != "member") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlElement member = (XmlElement) node;
|
||||||
|
|
||||||
|
if (member.HasAttribute("value")) {
|
||||||
|
string value = member.GetAttribute("value");
|
||||||
|
if (value.EndsWith("U")) {
|
||||||
|
enum_type = "uint";
|
||||||
|
member.SetAttribute("value", value.TrimEnd('U'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sw.WriteLine ("#region Autogenerated code");
|
sw.WriteLine ("#region Autogenerated code");
|
||||||
|
|
||||||
sw.WriteLine ("\tpublic enum " + Name + " {");
|
if (enum_type != null)
|
||||||
|
sw.WriteLine ("\tpublic enum " + Name + " : " + enum_type + " {");
|
||||||
|
else
|
||||||
|
sw.WriteLine ("\tpublic enum " + Name + " {");
|
||||||
|
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
|
|
||||||
foreach (XmlNode node in Elem.ChildNodes) {
|
foreach (XmlNode node in Elem.ChildNodes) {
|
||||||
|
|
Loading…
Reference in a new issue