mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-01-11 23:05:32 +00:00
ca64721a09
* generator/EnumGen.cs : Open stream Create only. * generator/ObjectGen.cs : New generatable for GObject subclasses. * generator/Parser.cs : Add the object element hook. * generator/StructBase.cs : Handle bits element in GenField. * generator/StructGen.cs : Open stream Create only. * generator/SymbolTable.cs : Additions to simple_types hash. * parser/gapi2xml.pl : Parse bitflags into the bits element. svn path=/trunk/gtk-sharp/; revision=1871
52 lines
1.1 KiB
C#
52 lines
1.1 KiB
C#
// GtkSharp.Generation.StructBase.cs - The Structure/Object Base Class.
|
|
//
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
//
|
|
// (c) 2001 Mike Kestner
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
using System;
|
|
using System.IO;
|
|
using System.Xml;
|
|
|
|
public class StructBase {
|
|
|
|
protected String ns;
|
|
protected XmlElement elem;
|
|
|
|
public StructBase (String ns, XmlElement elem) {
|
|
|
|
this.ns = ns;
|
|
this.elem = elem;
|
|
}
|
|
|
|
protected void GenField (XmlElement field, SymbolTable table, StreamWriter sw)
|
|
{
|
|
String c_type;
|
|
|
|
if (field.HasAttribute("bits") && (field.GetAttribute("bits") == "1")) {
|
|
c_type = "gboolean";
|
|
} else {
|
|
c_type = field.GetAttribute("type");
|
|
}
|
|
char[] ast = {'*'};
|
|
c_type = c_type.TrimEnd(ast);
|
|
String cs_type = table.GetCSType(c_type);
|
|
|
|
if (cs_type == "") {
|
|
Console.WriteLine ("Unknown Type {0}", c_type);
|
|
return;
|
|
}
|
|
|
|
sw.Write ("\t\t" + cs_type);
|
|
if (field.HasAttribute("array_len")) {
|
|
sw.Write ("[]");
|
|
}
|
|
sw.WriteLine (" " + field.GetAttribute("cname") + ";");
|
|
}
|
|
|
|
}
|
|
}
|
|
|