summaryrefslogtreecommitdiffstats
path: root/qtsharp/src/generator
diff options
context:
space:
mode:
Diffstat (limited to 'qtsharp/src/generator')
-rw-r--r--qtsharp/src/generator/Converter.cs464
-rw-r--r--qtsharp/src/generator/Generator.cs97
-rw-r--r--qtsharp/src/generator/Makefile.am16
-rw-r--r--qtsharp/src/generator/ParseAPI.cs90
-rw-r--r--qtsharp/src/generator/Parser.cs323
-rw-r--r--qtsharp/src/generator/Printer.cs526
-rw-r--r--qtsharp/src/generator/QAncestor.cs26
-rw-r--r--qtsharp/src/generator/QCtor.cs47
-rw-r--r--qtsharp/src/generator/QDCtor.cs57
-rw-r--r--qtsharp/src/generator/QEnum.cs63
-rw-r--r--qtsharp/src/generator/QItem.cs44
-rw-r--r--qtsharp/src/generator/QMember.cs116
-rw-r--r--qtsharp/src/generator/QMethod.cs54
-rw-r--r--qtsharp/src/generator/QParam.cs54
-rw-r--r--qtsharp/src/generator/QType.cs126
-rw-r--r--qtsharp/src/generator/QTypeMap.cs477
-rw-r--r--qtsharp/src/generator/generator.build15
17 files changed, 2595 insertions, 0 deletions
diff --git a/qtsharp/src/generator/Converter.cs b/qtsharp/src/generator/Converter.cs
new file mode 100644
index 00000000..143aa9da
--- /dev/null
+++ b/qtsharp/src/generator/Converter.cs
@@ -0,0 +1,464 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Collections.Specialized;
+//using System.Text.RegularExpressions;
+
+namespace QtCSharp {
+
+ public class Converter {
+
+ ArrayList qtypes;
+ QType qtype;
+ QTypeMap qmap;
+ StringCollection sigs;
+ StringBuilder sig;
+
+ public Converter (ArrayList qtypes, QType qtype, QTypeMap qmap)
+ {
+ this.qtypes = qtypes;
+ this.qtype = qtype;
+ this.qmap = qmap;
+ sigs = new StringCollection ();
+ sig = new StringBuilder ();
+ if (!qtype.IsConverted)
+ Convert ();
+ Ancestors ();
+ qtype.IsConverted = true;
+ }
+
+ public QType GetQType ()
+ {
+ return qtype;
+ }
+
+ public void Convert ()
+ {
+ foreach (QCtor qctor in qtype.QCtors) {
+ qctor.Name = qmap.ReservedType (qctor.Name);
+ if (!qctor.Overload) {
+ ConvertCSharpParams (qctor.CSharpParams);
+ ConvertPinvokeCallParams (qctor.PinvokeCallParams);
+ ConvertPinvokeParams (qctor.PinvokeParams);
+ } else {
+ ConvertOverloadParams (qctor.OverloadParams);
+ }
+ CheckSig (qctor);
+ }
+ foreach (QMethod qmethod in qtype.QMethods) {
+ if (qmethod.Name.StartsWith ("protected_"))
+ qmethod.Name = qmethod.Name.Replace ("protected_", "");
+ qmethod.Name = qmap.ReservedType (qmethod.Name);
+ if (!qmethod.Overload) {
+ ConvertCSharpParams (qmethod.CSharpParams);
+ ConvertPinvokeCallParams (qmethod.PinvokeCallParams);
+ ConvertPinvokeParams (qmethod.PinvokeParams);
+ ConvertReturnType (qmethod);
+ } else {
+ ConvertOverloadParams (qmethod.OverloadParams);
+ ConvertReturnType (qmethod);
+ }
+ qmethod.PascalName = ToPascalCase (qmethod.Name);
+ CheckSig (qmethod);
+ }
+ }
+
+ public void CheckSig (QMethod qmethod)
+ {
+ sig.Append (qmethod.PascalName);
+ foreach (QParam qparam in qmethod.CSharpParams) {
+ sig.Append (qparam.Type);
+ }
+ if (!sigs.Contains (sig.ToString ()) && !sigs.Contains ("The"+sig.ToString ())) {
+ sigs.Add (sig.ToString ());
+ } else {
+ Console.WriteLine ("Throttling "+qtype.Name+" "+qmethod.PascalName);
+ qmethod.Throttle = true;
+ }
+ sig.Length = 0;
+ }
+
+ public void CheckSig (QCtor qctor)
+ {
+ sig.Append (qctor.Name);
+ foreach (QParam qparam in qctor.CSharpParams) {
+ //if (qparam.Type == "QWidget" && qparam.Name == "parent")
+ if (qparam.Name == "parent")
+ qctor.Parent = true;
+ sig.Append (qparam.Type);
+ }
+ if (!sigs.Contains (sig.ToString ()))
+ sigs.Add (sig.ToString ());
+ else {
+ Console.WriteLine ("Throttling "+qtype.Name+" "+qctor.Access+" "+qctor.Name);
+ qctor.Throttle = true;
+ }
+ sig.Length = 0;
+ }
+
+ public void ConvertCSharpParams (ArrayList qparams)
+ {
+ foreach (QParam qparam in qparams) {
+ qparam.Type = qmap.ArrayType (qparam.Type);
+ qparam.Type = StripBad (qparam.Type);
+ qparam.Type = qmap.CSharpType (qparam.Type);
+ qparam.Type = ConvertQString (qparam.Type);
+ qparam.Name = qmap.ReservedType (qparam.Name);
+ }
+ }
+
+ public void ConvertPinvokeCallParams (ArrayList qparams)
+ {
+ foreach (QParam qparam in qparams) {
+ qparam.Type = qmap.ArrayType (qparam.Type);
+ qparam.Type = StripBad (qparam.Type);
+ qparam.Type = qmap.CSharpType (qparam.Type);
+ qparam.Name = qmap.ReservedType (qparam.Name);
+ if (IsQObject (qparam.Type))
+ qparam.Name = qparam.Name + ".RawObject";
+ if (IsIQObject (qparam.Type))
+ qparam.Name = qparam.Name + "." + StripInterface (qparam.Type) + " ()";
+ /* if (IsQString (qparam.Type))
+ qparam.Name = "new QString ("+StripPtr(qparam.Name)+").RawObject";*/
+ qparam.Type = "";
+ }
+ }
+
+ public void ConvertPinvokeParams (ArrayList qparams)
+ {
+ foreach (QParam qparam in qparams) {
+ qparam.Type = qmap.ArrayType (qparam.Type);
+ qparam.Type = StripBad (qparam.Type);
+ qparam.Type = qmap.PinvokeType (qparam.Type);
+ qparam.Name = qmap.ReservedType (qparam.Name);
+ if (IsQObject (qparam.Type) || IsIQObject (qparam.Type))
+ qparam.Type = "IntPtr";
+ }
+ }
+
+ public void ConvertOverloadParams (ArrayList qparams)
+ {
+ foreach (QParam qparam in qparams) {
+ qparam.Type = qmap.ArrayType (qparam.Type);
+ qparam.Type = StripBad (qparam.Type);
+ qparam.Type = qmap.CSharpType (qparam.Type);
+ OverloadedLastParam (qparam, qparams);
+ OverloadedNull (qparam);
+ OverloadedQString (qparam);
+ OverloadedQObject (qparam);
+ OverloadedNestedEnum (qparam);
+ OverloadedNullString (qparam);
+ OverloadedBool (qparam);
+ OverloadedEnum (qparam);
+ OverloadedArray (qparam);
+ OverloadedHex (qparam);
+ OverloadedDefault (qparam);
+ }
+ }
+
+ public void OverloadedLastParam (QParam qparam, ArrayList qparams)
+ {
+ if (qparams.IndexOf (qparam) != qparams.Count - 1)
+ qparam.Default = null;
+ }
+
+ public void OverloadedNull (QParam qparam)
+ {
+ if (qparam.Default == null)
+ qparam.Type = "";
+ }
+
+ public void OverloadedQString (QParam qparam)
+ {
+ if (IsQString (qparam.Type)){
+ qparam.Type = "QString";
+ if (qparam.Default == "QString::null")
+ qparam.Default = "null";
+ else if (qparam.Default == "quotquot")
+ qparam.Default = "null";
+ else
+ qparam.Default = "\""+qparam.Default+"\"";
+ }
+ }
+
+ public void OverloadedQObject (QParam qparam)
+ {
+ if (IsQObject (qparam.Type)) {
+ qparam.Name = "new "+qparam.Type+" ()";
+ qparam.Type = "";
+ }
+ }
+
+ public void OverloadedNestedEnum (QParam qparam)
+ {
+ foreach (QEnum qenum in qtype.QEnums) {
+ if (qparam.Type == qenum.Name) {
+ foreach (QItem qitem in qenum.QItems) {
+ if (qparam.Default == qitem.Name) {
+ qparam.Name = qparam.Type+"."+qparam.Default;
+ qparam.Type = "";
+ }
+ }
+ }
+ }
+ }
+
+ public void OverloadedNullString (QParam qparam)
+ {
+ if (qmap.OverloadType (qparam.Type) == "string" && qparam.Default == "0") {
+ qparam.Type = "";
+ qparam.Name = "\"\"";
+ }
+ }
+
+ public void OverloadedBool (QParam qparam)
+ {
+ if (qparam.Default == "TRUE") {
+ qparam.Type = "";
+ qparam.Name = "true";
+ } else if (qparam.Default == "FALSE") {
+ qparam.Type = "";
+ qparam.Name = "false";
+ } else if (qparam.Type == "bool" && qparam.Default == "1") {
+ qparam.Type = "";
+ qparam.Name = "true";
+ } else if (qparam.Type == "bool" && qparam.Default == "0") {
+ qparam.Type = "";
+ qparam.Name = "false";
+ }
+ }
+
+ public void OverloadedEnum (QParam qparam)
+ {
+ if (IsEnum (qparam.Type)) {
+ qparam.Name = qparam.Type + "." + EnumValue (qparam.Type, qparam.Default);
+ qparam.Type = "";
+ }
+ }
+
+ public void OverloadedArray (QParam qparam)
+ {
+ if (IsArray (qparam.Type)) {
+ qparam.Name = "new "+qparam.Type+"{"+qparam.Default+"}";
+ qparam.Type = "";
+ }
+ }
+
+ public void OverloadedHex (QParam qparam)
+ {
+ if (qparam.Default == "0xffffffff")
+ qparam.Default = "1";
+ }
+
+ public void OverloadedDefault (QParam qparam)
+ {
+ if (qparam.Type != "") {
+ qparam.Type = "("+qmap.OverloadType (qparam.Type)+")";
+ qparam.Name = qparam.Default;
+ }
+ }
+
+ public void ConvertReturnType (QMethod qmethod)
+ {
+ qmethod.Return = qmap.ArrayType (qmethod.Return);
+ qmethod.Return = qmap.PinvokeType (StripBad (qmethod.Return));
+ if (IsQObject(qmethod.Return)) {
+ qmethod.Boxer = true;
+ qmethod.PinvokeReturn = "IntPtr";
+ } else {
+ qmethod.PinvokeReturn = qmethod.Return;
+ }
+ if (qmethod.Return == "QString") {
+ qmethod.QStringReturn = true;
+ }
+ }
+
+ public string StripBad (string str)
+ {
+ str = StripPointer (str);
+ str = StripColon (str);
+ return str;
+ }
+
+ public string StripPointer (string str)
+ {
+ str = str.Replace ("*", "");
+ str = str.Replace ("&", "");
+ if (str.StartsWith ("amp"))
+ str = str.Replace ("amp", "");
+ if (str.EndsWith ("amp"))
+ str = str.Replace ("amp", "");
+ return str;
+ }
+
+ public string ConvertQString (string str)
+ {
+ if (IsQString (str))
+ return "QString";
+ else
+ return str;
+ }
+
+ public string StripColon (string str)
+ {
+ return str = str.Replace ("::", ".");
+ }
+
+ public string StripPtr (string str)
+ {
+ return str = str.Replace (".RawObject", "");
+ }
+
+ public string StripInterface (string str)
+ {
+ return str = str.Replace ("I", "");
+ }
+
+ public string StripEnum (string str)
+ {
+ str = StripColon (str);
+ if (str.IndexOf (".") > 0)
+ return str.Substring (str.IndexOf (".")+1);
+ else
+ return str;
+ }
+
+ public string ToPascalCase (string name)
+ {
+ string pascal = System.Char.ToUpper (name[0]).ToString ()+name.Substring (1, name.Length -1);
+ foreach (QEnum qenum in qtype.QEnums) {
+ if (pascal == qenum.Name)
+ pascal = "The"+pascal;
+ }
+ return pascal;
+ }
+
+ public string EnumValue (string type, string value)
+ {
+ bool match = false;
+ string enumname = StripEnum (type);
+ value = StripEnum (value);
+
+ // There _has_ to be a better way, but I'm tired...
+ foreach (QType qtype in qtypes) {
+ foreach (QEnum qenum in qtype.QEnums) {
+ if (enumname == qenum.Name) {
+ foreach (QItem qitem in qenum.QItems) {
+ if (value == qitem.Name) {
+ match = true;
+ }
+ }
+ if (!match) {
+ foreach (QItem qitem in qenum.QItems) {
+ value = qitem.Name;
+ break;
+ }
+ }
+ }
+ }
+ }
+ return value;
+ }
+
+ public void Ancestors ()
+ {
+ if (qtype.IsInterface || qtype.QAncestors.Count < 2)
+ return;
+
+ string iname = "";
+ foreach (QAncestor qancestor in qtype.QAncestors) {
+ iname = qmap.InterfaceType (qancestor.Name);
+ foreach (QType _qtype in qtypes) {
+ if (_qtype.Name == qancestor.Name && iname != qancestor.Name) {
+ if (!_qtype.IsConverted) {
+ Converter converter = new Converter (qtypes, _qtype, qmap);
+ }
+ qtype.AddQMethod (instPointer (qancestor.Name));
+ qancestor.QMethods = _qtype.QMethods;
+ qancestor.IsInterface = true;
+ qancestor.IName = iname;
+ foreach (QMethod qmethod in qancestor.QMethods) {
+ CheckSig (qmethod);
+ }
+ }
+ }
+ }
+ }
+
+ public QMethod instPointer (string name)
+ {
+ QMethod qmethod = new QMethod ();
+ qmethod.Name = name;
+ qmethod.PascalName = name;
+ qmethod.Access = "public";
+ qmethod.PinvokeReturn = "IntPtr";
+ qmethod.Return = "IntPtr";
+ qmethod.Id = "0";
+ return qmethod;
+ }
+
+ public bool IsQString (string str)
+ {
+ if (qtype.Name == "QString")
+ return true;
+ else if (IsQObject (str) && str == "QString")
+ return true;
+ else
+ return false;
+ }
+
+ public bool IsQObject (string str)
+ {
+ //IndexOf is a hack to search for a char ;-)
+ if (str.StartsWith ("Q") && str.IndexOf (".") < 0)
+ return true;
+ else
+ return false;
+ }
+
+ public bool IsIQObject (string str)
+ {
+ //IndexOf is a hack to search for a char ;-)
+ if (str == "IntPtr") return false;
+ if (str.StartsWith ("I") && str.IndexOf (".") < 0)
+ return true;
+ else
+ return false;
+ }
+
+ public bool IsEnum (string str)
+ {
+ //IndexOf is a hack to search for a char ;-)
+ if (str.IndexOf (".") > 0)
+ return true;
+ else
+ return false;
+ }
+
+ public bool IsArray (string str)
+ {
+ if (str.EndsWith ("[]"))
+ return true;
+ else
+ return false;
+ }
+ }
+}
diff --git a/qtsharp/src/generator/Generator.cs b/qtsharp/src/generator/Generator.cs
new file mode 100644
index 00000000..68b1e031
--- /dev/null
+++ b/qtsharp/src/generator/Generator.cs
@@ -0,0 +1,97 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+using System.IO;
+
+namespace QtCSharp {
+
+ public class Generator {
+
+ void Usage ()
+ {
+ Console.Write (
+ "generator -f file.cs -d directory\n\n" +
+ " -f || --file file.xml The csharp source file to parse.\n\n" +
+ " -d || --directory Specifies the output directory.\n\n");
+ }
+
+ public static void Main (string[] args)
+ {
+ Generator gen = new Generator (args);
+ }
+
+ public Generator (string[] args)
+ {
+ string xmlfile = null;
+ string directory = null;
+
+ int argc = args.Length;
+ for (int i = 0; i < argc; i++) {
+ string arg = args[i];
+ if (arg.StartsWith("-") || arg.StartsWith("/")) {
+ switch (arg) {
+ case "-f": case "--file":
+ if ((i + 1) >= argc) {
+ Usage();
+ return;
+ }
+ xmlfile = args[++i];
+ continue;
+ case "-d": case "--directory":
+ if ((i + 1) >= argc) {
+ Usage ();
+ return;
+ }
+ directory = args[++i];
+ continue;
+ default:
+ Usage ();
+ return;
+ }
+ }
+ }
+
+ if (xmlfile == null) {
+ Usage();
+ return;
+ } else if (directory == null) {
+ Usage ();
+ return;
+ }
+
+ if (!File.Exists (xmlfile)) {
+ Console.WriteLine ("\n No Xml file at {0}\n", args[0]);
+ return;
+ }
+ //if (!Directory.Exists( directory) && directory != null) {
+
+ //Directory.CreateDirectory (directory);
+ //}
+
+ ParseAPI parseapi = new ParseAPI (xmlfile);
+ QTypeMap qmap = new QTypeMap ();
+ Console.WriteLine ("Parsing "+parseapi.QTypes.Count+" Qt classes...");
+
+ foreach (QType qtype in parseapi.QTypes) {
+ Converter converter = new Converter (parseapi.QTypes, qtype, qmap);
+ Printer printer = new Printer (converter.GetQType (), directory);
+ }
+ }
+ }
+}
diff --git a/qtsharp/src/generator/Makefile.am b/qtsharp/src/generator/Makefile.am
new file mode 100644
index 00000000..31532ae8
--- /dev/null
+++ b/qtsharp/src/generator/Makefile.am
@@ -0,0 +1,16 @@
+all: generator.exe
+
+generator.exe: $(wildcard *.cs)
+ csant -D$(CSC_NAME)=$(CSC) -C $(CSC_NAME)
+ chmod 755 $@
+
+clean:
+ rm -rf generator.exe
+
+distclean: clean
+
+install:
+
+uninstall:
+
+.PHONY: all clean distclean install uninstall
diff --git a/qtsharp/src/generator/ParseAPI.cs b/qtsharp/src/generator/ParseAPI.cs
new file mode 100644
index 00000000..57569c7b
--- /dev/null
+++ b/qtsharp/src/generator/ParseAPI.cs
@@ -0,0 +1,90 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Collections;
+
+namespace QtCSharp {
+
+ public class ParseAPI {
+
+ XmlTextReader xtr;
+ ArrayList qtypes;
+
+ public ParseAPI (string xmlfile)
+ {
+ xtr = new XmlTextReader (xmlfile);
+ qtypes = new ArrayList ();
+ Parse ();
+ }
+
+ public ArrayList QTypes
+ {
+ get {return qtypes;}
+ }
+
+ public void Parse ()
+ {
+ Hashtable typehash = new Hashtable();
+ while(xtr.Read ()) {
+ if (xtr.NodeType != XmlNodeType.EndElement) {
+ switch(xtr.Name) {
+ case "qtype":
+ QType t = AddQType ();
+ typehash[t.Name] = t;
+ continue;
+ default:
+ continue;
+ }
+ }
+ }
+
+ foreach (QType t in qtypes) {
+ t.IsQObject = IsQObject(t, typehash);
+ }
+ }
+
+ public QType AddQType ()
+ {
+ Parser parser = new Parser (xtr.ReadOuterXml ());
+ QType type = parser.GetQType ();
+ qtypes.Add (type);
+ return type;
+ }
+
+ private static bool IsQObject(QType t, Hashtable typehash)
+ {
+ if (t.IsInterface) return false;
+ if (t.Name == "QObject") return true;
+
+ foreach (QAncestor a in t.QAncestors) {
+ QType at = (QType)typehash[a.Name];
+ if (at == null)
+ continue;
+ else if (at.Name == "QObject")
+ return true;
+ else if (IsQObject(at, typehash))
+ return true;
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/qtsharp/src/generator/Parser.cs b/qtsharp/src/generator/Parser.cs
new file mode 100644
index 00000000..cea811d3
--- /dev/null
+++ b/qtsharp/src/generator/Parser.cs
@@ -0,0 +1,323 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Xml;
+
+namespace QtCSharp {
+
+ public class Parser {
+
+ XmlTextReader xtr;
+ QType qtype;
+
+ public Parser (string xmlFragment)
+ {
+ qtype = new QType ();
+ XmlNameTable nt = new NameTable ();
+ XmlNamespaceManager nsMgr = new XmlNamespaceManager (nt);
+ XmlParserContext parserContext = new XmlParserContext (null, nsMgr, null, XmlSpace.None);
+ xtr = new XmlTextReader (xmlFragment, XmlNodeType.Document, parserContext);
+ Parse ();
+ OverLoad ();
+ NewQCtors ();
+ }
+
+ public QType GetQType ()
+ {
+ return qtype;
+ }
+
+ public void Parse ()
+ {
+ while(xtr.Read ()) {
+ if (xtr.NodeType != XmlNodeType.EndElement) {
+ switch (xtr.Name) {
+ case "qtype":
+ ParseQType ();
+ continue;
+ case "qancestor":
+ ParseQAncestor ();
+ continue;
+ case "qenum":
+ ParseQEnum ();
+ continue;
+ case "qctor":
+ ParseQCtor ();
+ continue;
+ case "qdctor":
+ ParseQDCtor ();
+ continue;
+ case "qmethod":
+ ParseQMethod ();
+ continue;
+ default:
+ continue;
+ }
+ }
+ }
+ }
+
+ public void NewQCtors ()
+ {
+ // A ctor for inherited classes
+ QCtor _qctor = new QCtor();
+ _qctor.Name = qtype.Name;
+ _qctor.Access = "internal";
+ _qctor.Inherited = true;
+ qtype.AddQCtor(_qctor);
+
+ // A ctor for type boxing
+ QCtor __qctor = new QCtor();
+ __qctor.Name = qtype.Name;
+ __qctor.Access = "internal";
+ __qctor.Boxer = true;
+ QParam qparam = new QParam();
+ qparam.Type = "IntPtr";
+ qparam.Name = "_ptr";
+ __qctor.AddCSharpParam(qparam);
+ qtype.AddQCtor(__qctor);
+
+ // A dummy ctor
+ QCtor ___qctor = new QCtor();
+ ___qctor.Name = qtype.Name;
+ ___qctor.Access = "internal";
+ ___qctor.Dummy = true;
+ QParam ___qparam = new QParam();
+ ___qparam.Type = "QNull";
+ ___qparam.Name = "dummy";
+ ___qctor.AddCSharpParam(___qparam);
+ qtype.AddQCtor(___qctor);
+ }
+
+ public void OverLoad ()
+ {
+ ArrayList additions = new ArrayList ();
+
+ foreach (QCtor qctor in qtype.QCtors){
+ foreach (QParam pinvokeparam in qctor.PinvokeParams) {
+ if (pinvokeparam.Default != null) {
+ QCtor _qctor = new QCtor();
+ _qctor.Name = qctor.Name;
+ _qctor.Access = qctor.Access;
+ _qctor.Overload = true;
+ for (int j = 0; j < qctor.PinvokeParams.IndexOf(pinvokeparam)+1; j++) {
+ _qctor.AddPinvokeParam((QParam)qctor.PinvokeParams[j]);
+ _qctor.AddPinvokeCallParam((QParam)qctor.PinvokeCallParams[j]);
+ _qctor.AddCSharpParam((QParam)qctor.CSharpParams[j]);
+ _qctor.AddOverloadParam((QParam) (( QParam) qctor.CSharpParams[j]).Clone());
+ }
+ _qctor.CSharpParams.RemoveAt(_qctor.CSharpParams.Count-1);
+ //qtype.AddQCtor(_qctor);
+ additions.Add (_qctor);
+ }
+ }
+ }
+
+ foreach (QCtor ctor in additions) qtype.AddQCtor (ctor);
+ additions = new ArrayList ();
+
+ foreach (QMethod qmethod in qtype.QMethods){
+ foreach (QParam pinvokeparam in qmethod.PinvokeParams) {
+ if (pinvokeparam.Default != null) {
+ QMethod _qmethod = new QMethod();
+ _qmethod.Name = qmethod.Name;
+ _qmethod.Access = qmethod.Access;
+ _qmethod.Return = qmethod.Return;
+ _qmethod.Overload = true;
+ for (int j = 0; j < qmethod.PinvokeParams.IndexOf(pinvokeparam)+1; j++) {
+ _qmethod.AddPinvokeParam((QParam)qmethod.PinvokeParams[j]);
+ _qmethod.AddPinvokeCallParam((QParam)qmethod.PinvokeCallParams[j]);
+ _qmethod.AddCSharpParam((QParam)qmethod.CSharpParams[j]);
+ _qmethod.AddOverloadParam((QParam) ((QParam) qmethod.CSharpParams[j]).Clone());
+
+ }
+ _qmethod.CSharpParams.RemoveAt(_qmethod.CSharpParams.Count-1);
+ //qtype.AddQMethod(_qmethod);
+ additions.Add (_qmethod);
+ }
+ }
+ }
+
+ foreach (QMethod method in additions) qtype.AddQMethod (method);
+ }
+
+ public void ParseQType ()
+ {
+ if (xtr.MoveToAttribute("name")) {
+ qtype.Name = xtr.Value;
+ }
+
+ if (xtr.MoveToAttribute("access")) {
+ qtype.Access = xtr.Value;
+ }
+ }
+
+ public void ParseQAncestor ()
+ {
+ QAncestor qancestor = new QAncestor();
+ if (xtr.MoveToAttribute("name")) {
+ qancestor.Name = xtr.Value;
+ }
+ qtype.AddQAncestor(qancestor);
+ }
+
+ public void ParseQEnum ()
+ {
+ bool match = false;
+ QEnum qenum = new QEnum();
+ if (xtr.MoveToAttribute("name"))
+ qenum.Name = xtr.Value;
+ if (xtr.MoveToAttribute("access"))
+ qenum.Access = xtr.Value;
+ while (xtr.Read()) {
+ if (xtr.Name == "qitem") {
+ QItem qitem = ParseQItem();
+ qenum.AddQItem(qitem);
+ long parse = 0;
+ try {
+ parse = Int64.Parse(qitem.Value);
+ } catch {
+ }
+ if (parse >= 2147483647)
+ qenum.Type = "uint";
+ } else if (xtr.Name == "") {
+ } else {
+ break;
+ }
+ }
+ qtype.AddQEnum(qenum);
+ }
+
+ public void ParseQCtor ()
+ {
+ bool IsEmpty = xtr.IsEmptyElement;
+ QCtor qctor = new QCtor();
+ if (xtr.MoveToAttribute("name")) {
+ qctor.Name = xtr.Value;
+ }
+ if (xtr.MoveToAttribute("access")) {
+ qctor.Access = xtr.Value;
+ }
+ if (xtr.MoveToAttribute("id")) {
+ qctor.Id = xtr.Value;
+ }
+ if (!IsEmpty) {
+ while (xtr.Read()) {
+ if (xtr.Name == "qparam") {
+ qctor.AddPinvokeParam(ParseQParam());
+ qctor.AddPinvokeCallParam(ParseQParam());
+ qctor.AddCSharpParam(ParseQParam());
+ } else if (xtr.Name == ""){
+ } else {
+ break;
+ }
+ }
+ }
+ qtype.AddQCtor(qctor);
+ }
+
+ public void ParseQDCtor ()
+ {
+ bool IsEmpty = xtr.IsEmptyElement;
+ QDCtor qdctor = new QDCtor();
+ if (xtr.MoveToAttribute("name")) {
+ qdctor.Name = xtr.Value;
+ }
+ if (xtr.MoveToAttribute("access")) {
+ qdctor.Access = xtr.Value;
+ }
+ if (!IsEmpty) {
+ while (xtr.Read()) {
+ if (xtr.Name == "qparam") {
+ qdctor.AddQParam(ParseQParam());
+ } else if (xtr.Name == "") {
+ } else {
+ break;
+ }
+ }
+ }
+ qtype.AddQDCtor(qdctor);
+ }
+
+ public void ParseQMethod ()
+ {
+ bool IsEmpty = xtr.IsEmptyElement;
+ QMethod qmethod = new QMethod();
+ if (xtr.MoveToAttribute("name")) {
+ qmethod.Name = xtr.Value;
+ }
+ if (xtr.MoveToAttribute("access")) {
+ qmethod.Access = xtr.Value;
+ }
+ if (xtr.MoveToAttribute("return")) {
+ qmethod.Return = xtr.Value;
+ }
+ if (xtr.MoveToAttribute("id")) {
+ qmethod.Id = xtr.Value;
+ }
+ if (xtr.MoveToAttribute("throttle")) {
+ if (String.Compare(xtr.Value, "true", true) == 0) {
+ qmethod.Throttle = true;
+ }
+ }
+ if (!IsEmpty) {
+ while (xtr.Read()) {
+ if (xtr.Name == "qparam") {
+ qmethod.AddPinvokeParam(ParseQParam());
+ qmethod.AddPinvokeCallParam(ParseQParam());
+ qmethod.AddCSharpParam(ParseQParam());
+ } else if (xtr.Name == ""){
+ } else {
+ break;
+ }
+ }
+ }
+ qtype.AddQMethod(qmethod);
+ }
+
+ public QItem ParseQItem ()
+ {
+ QItem qitem = new QItem();
+ if (xtr.MoveToAttribute("name")) {
+ qitem.Name = xtr.Value;
+ }
+ if (xtr.MoveToAttribute("value")) {
+ qitem.Value = xtr.Value;
+ }
+ return qitem;
+ }
+
+ public QParam ParseQParam ()
+ {
+ QParam qparam = new QParam();
+ if (xtr.MoveToAttribute("type")) {
+ qparam.Type = xtr.Value;
+ }
+ if (xtr.MoveToAttribute("name")) {
+ qparam.Name = xtr.Value;
+ }
+ if (xtr.MoveToAttribute("default")) {
+ qparam.Default = xtr.Value;
+ }
+ return qparam;
+ }
+ }
+}
diff --git a/qtsharp/src/generator/Printer.cs b/qtsharp/src/generator/Printer.cs
new file mode 100644
index 00000000..c4f6df87
--- /dev/null
+++ b/qtsharp/src/generator/Printer.cs
@@ -0,0 +1,526 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+using System.IO;
+using System.Text;
+using System.Collections;
+
+namespace QtCSharp {
+
+ public class Printer {
+
+ QType qtype;
+ string tab, directory;
+
+ public Printer (QType qtype, string directory)
+ {
+ this.qtype = qtype;
+ this.directory = directory;
+ tab = "\t";
+ if (qtype.IsInterface)
+ PrintInterface ();
+ else
+ Print ();
+ }
+
+ public void Print ()
+ {
+ StreamWriter writer = new StreamWriter(directory + Path.DirectorySeparatorChar +
+ qtype.Name + ".cs", false, new ASCIIEncoding());
+ writer.Write(Header);
+ writer.Write(StartClass(qtype.Name, qtype.Access, new ArrayList(qtype.QAncestors)));
+
+ foreach (QEnum qenum in qtype.QEnums) {
+ writer.Write(StartEnum(qenum.Name, qenum.Access, qenum.Type));
+ writer.Write(Items(qenum.QItems));
+ writer.Write(EndMember);
+ }
+
+ foreach (QCtor qctor in qtype.QCtors) {
+ if (qctor.Throttle) {
+ } else if (qctor.Inherited) {
+ writer.Write (WriteInherited (qctor.Name, qctor.Access));
+ } else if (qctor.Dummy) {
+ writer.Write (WriteDummy (qctor.Name, qctor.Access));
+ } else if (qctor.Boxer) {
+ writer.Write (WriteBoxer (qctor.Name, qctor.Access));
+ } else if (!qctor.Overload) {
+ writer.Write (ImportAttrib);
+ writer.Write (ImportCtorCall (qctor.Name, qctor.Id, qctor.PinvokeParams));
+ writer.Write (StartCtor (qctor.Name, qctor.Access, qctor.CSharpParams));
+ writer.Write (RawObject (qctor.Name, qctor.Id, qctor.PinvokeCallParams));
+ writer.Write (CheckParent (qctor.Parent));
+ writer.Write (Register);
+ writer.Write (DefaultConnections ());
+ writer.Write (EndMember);
+ } else {
+ writer.Write (OverLoadCtor(qctor.Name, qctor.Access, qctor.CSharpParams, qctor.OverloadParams));
+ }
+ }
+
+ writer.Write (StartDCtor (qtype.Name));
+ writer.Write (DCtorCall);
+ writer.Write (EndMember);
+
+ //writer.Write (DisposePublic ());
+
+ foreach (QDCtor qdctor in qtype.QDCtors) {
+ writer.Write (ImportAttrib);
+ writer.Write (ImportDCtorCall (qdctor.Name));
+ }
+
+ //writer.Write (DisposeProtected ());
+ writer.Write (Delete ());
+
+ foreach (QMethod qmethod in qtype.QMethods) {
+ if (qmethod.Throttle) {
+ } else if (!qmethod.Overload) {
+ writer.Write(ImportAttrib);
+ if (qmethod.Access == "public" || qmethod.Access == "protected" || qmethod.Access == "internal") {
+ writer.Write(ImportMethodCall(qtype.Name, qmethod.Name, qmethod.Id, qmethod.PinvokeReturn, qmethod.PinvokeParams));
+ writer.Write(StartMethod(qmethod.PascalName, qmethod.Access, qmethod.Return, qmethod.CSharpParams));
+ writer.Write(MethodCall(qmethod.QStringReturn, qmethod.Boxer, qtype.Name, qmethod.Name, "rawObject", qmethod.Id, qmethod.Return, qmethod.PinvokeCallParams));
+ } else {
+ writer.Write(StaticImportMethodCall(qtype.Name, qmethod.Name, qmethod.Id, qmethod.PinvokeReturn, qmethod.PinvokeParams));
+ writer.Write(StartMethod(qmethod.PascalName, qmethod.Access, qmethod.Return, qmethod.CSharpParams));
+ writer.Write(StaticMethodCall(qmethod.QStringReturn, qmethod.Boxer, qtype.Name, qmethod.Name, qmethod.Id, qmethod.Return, qmethod.PinvokeCallParams));
+ }
+ writer.Write(EndMember);
+ } else {
+ writer.Write(OverLoadMethod(qmethod.PascalName, qmethod.Access, qmethod.Return, qmethod.CSharpParams, qmethod.OverloadParams));
+ }
+ }
+
+ foreach (QAncestor qancestor in qtype.QAncestors) {
+ writer.Write("\n\n"+tab+tab+"// Begin interface methods.\n");
+ if (qancestor.IsInterface) {
+ Printer printer = new Printer (qancestor, directory);
+ foreach (QMethod qmethod in qancestor.QMethods) {
+ if (qmethod.Throttle) {
+ } else if (!qmethod.Overload) {
+ writer.Write(ImportAttrib);
+ if (qmethod.Access == "public" || qmethod.Access == "protected") {
+ writer.Write(ImportMethodCall(qancestor.Name, qmethod.Name, qmethod.Id, qmethod.PinvokeReturn, qmethod.PinvokeParams));
+ writer.Write(StartMethod(qmethod.PascalName, qmethod.Access, qmethod.Return, qmethod.CSharpParams));
+ writer.Write(MethodCall(qmethod.QStringReturn, qmethod.Boxer, qancestor.Name, qmethod.Name, qancestor.Name+" ()", qmethod.Id, qmethod.Return, qmethod.PinvokeCallParams));
+ } else {
+ writer.Write(StaticImportMethodCall(qancestor.Name, qmethod.Name, qmethod.Id, qmethod.PinvokeReturn, qmethod.PinvokeParams));
+ writer.Write(StartMethod(qmethod.PascalName, qmethod.Access, qmethod.Return, qmethod.CSharpParams));
+ writer.Write(StaticMethodCall(qmethod.QStringReturn, qmethod.Boxer, qancestor.Name, qmethod.Name, qmethod.Id, qmethod.Return, qmethod.PinvokeCallParams));
+ }
+ writer.Write(EndMember);
+ } else {
+ writer.Write(OverLoadMethod(qmethod.PascalName, qmethod.Access, qmethod.Return, qmethod.CSharpParams, qmethod.OverloadParams));
+ }
+ }
+ }
+ }
+
+ writer.Write(EndClass);
+ writer.Write(Footer);
+ writer.Close();
+ }
+
+ public void PrintInterface ()
+ {
+ StreamWriter writer = new StreamWriter(directory + Path.DirectorySeparatorChar +
+ qtype.IName + ".cs", false, new ASCIIEncoding());
+ writer.Write(Header);
+ writer.Write(StartClass(qtype.IName, "public", qtype.QAncestors));
+
+ foreach (QMethod qmethod in qtype.QMethods) {
+ if (qmethod.Throttle || qmethod.Access == "public static" || qmethod.Access == "protected") {
+ } else {
+ writer.Write(IMethod(qmethod.PascalName, qmethod.Return, qmethod.CSharpParams));
+ }
+ }
+ writer.Write("\n"+tab+tab+" IntPtr "+qtype.Name+" ();");
+ writer.Write(EndClass);
+ writer.Write(Footer);
+ writer.Close();
+ }
+
+ public string StartClass (string name, string access, ArrayList qancestors)
+ {
+ StringBuilder sb = new StringBuilder ();
+
+ if (qtype.IsInterface) {
+ sb.Append(tab+access+" interface "+name+" {");
+ return sb.ToString ();
+ }
+
+ sb.Append(tab+access+" class "+name+" : ");
+ if (qancestors.Count == 0) sb.Append ("QtSupport");
+ foreach (QAncestor qancestor in qancestors) {
+ if (!qancestor.IsInterface) {
+ if (qancestor.Name == "Qt") {
+ sb.Append ("QtSupport");
+ break;
+ } else {
+ sb.Append (qancestor.Name);
+ qancestors.Remove (qancestor);
+ break;
+ }
+ }
+ }
+
+ foreach (QAncestor qancestor in qancestors) {
+ if (qancestor.IsInterface) {
+ sb.Append (", "+qancestor.IName);
+ }
+ }
+
+ sb.Append (", IDisposable {");
+ return sb.ToString ();
+ }
+
+ public string EndClass
+ {
+ get {return "\n"+tab+"}";}
+ }
+
+ public string StartEnum (string name, string access, string type)
+ {
+ if (type != null)
+ return "\n\n"+tab+tab+access+" enum "+name+" : "+type+" {";
+ else
+ return "\n\n"+tab+tab+access+" enum "+name+" {";
+ }
+
+ public string WriteInherited (string name, string access)
+ {
+ return "\n\n"+tab+tab+access+" "+name+" () : this (QNull.Instance) {}";
+ }
+
+ public string WriteDummy (string name, string access)
+ {
+ return "\n\n"+tab+tab+access+" "+name+" (QNull dummy) : base (QNull.Instance) {}";
+ }
+
+ public string WriteBoxer (string name, string access)
+ {
+ return "\n\n" +
+ tab+tab+access+" "+name+" (IntPtr ptr) : this (QNull.Instance)\n"+tab+tab+"{\n" +
+ tab+tab+tab+"rawObject = ptr;\n" +
+ tab+tab+tab+"RegisterObject(this);\n" +
+ tab+tab+"}";
+ }
+
+ public string CheckParent (bool check)
+ {
+ if (check)
+ return "\n\n\t\t\tif ((qparent = parent) != null)\n" +
+ "\t\t\t\tqparent.AddChild (this);\n";
+ else
+ return "";
+ }
+
+ public string StartCtor (string name, string access, ArrayList csharpparams)
+ {
+ return "\n"+tab+tab+access+" "+name+" ("+Params(csharpparams)+") : this (QNull.Instance)\n"+tab+tab+"{\n";
+ }
+
+ public string StartDCtor (string name)
+ {
+ return "\n\n"+tab+tab+"~"+name+" ()\n"+tab+tab+"{\n";
+ }
+
+ public string StartMethod (string name, string access, string returntype, ArrayList csharpparams)
+ {
+ string str = "\n"+tab+tab+access+" "+returntype+" "+name+" ("+Params(csharpparams)+")\n"+tab+tab+"{\n";
+
+ // QEvents should never be disposed inside C#
+ if (access.IndexOf ("static") <= 0)
+ str += "\t\t\tif (disposed)\n\t\t\t\tthrow new ObjectDisposedException (this+\": Attempted use of disposed object\");\n\n";
+
+ return str;
+ }
+
+ public string IMethod (string name, string returntype, ArrayList csharpparams)
+ {
+ return "\n"+tab+tab+" "+returntype+" "+name+" ("+Params(csharpparams)+");";
+ }
+
+ public string EndMember
+ {
+ get {return "\n"+tab+tab+"}";}
+ }
+
+ public string OverLoadCtor (string name, string access, ArrayList csharpparams, ArrayList overloadparams)
+ {
+ return "\n\n"+tab+tab+access+" "+name+" ("+Params(csharpparams)+") : this ("+Params(overloadparams)+") {}";
+ }
+
+ public string OverLoadMethod (string name, string access, string returntype, ArrayList csharpparams, ArrayList overloadparams)
+ {
+ string str;
+
+ if (returntype == "void")
+ str = name + "(" + Params(overloadparams) + ");\n" + tab + tab;
+ else
+ str = "return "+name+"("+Params(overloadparams)+");\n" + tab+tab;
+
+ return "\n\n"+tab+tab+access+" "+returntype+" "+name +
+ " ("+Params(csharpparams)+")\n" + tab+tab+"{\n" + tab+tab+tab+ str + "}";
+ }
+
+ public string Items (ArrayList qitems)
+ {
+ int count = 0;
+ StringBuilder sb = new StringBuilder();
+ foreach (QItem qitem in qitems) {
+ count++;
+ sb.Append("\n"+tab+tab+tab+qitem.Name+" = "+qitem.Value);
+ if (count != qitems.Count)
+ sb.Append(",");
+ }
+ return sb.ToString();
+ }
+
+ public string Params (ArrayList qparams)
+ {
+ int count = 0;
+ StringBuilder sb = new StringBuilder();
+ foreach (QParam qparam in qparams) {
+ count++;
+ if (qparam.Type != "")
+ sb.Append(qparam.Type+" "+qparam.Name);
+ else
+ sb.Append(qparam.Name);
+
+ if (count != qparams.Count)
+ sb.Append(", ");
+ }
+ return sb.ToString();
+ }
+
+ public string ImportCtorCall (string name, string id, ArrayList qparams)
+ {
+ if (id != "0")
+ return "\n"+tab+tab+"private static extern IntPtr qt_new_"+name+id+" ("+Params(qparams)+");";
+ else
+ return "\n"+tab+tab+"private static extern IntPtr qt_new_"+name+" ("+Params(qparams)+");";
+ }
+
+ public string ImportDCtorCall (string name)
+ {
+ return "\n"+tab+tab+"private static extern void qt_del_"+name+" (IntPtr raw);";
+ }
+
+ public string ImportMethodCall (string type, string name, string id, string returntype, ArrayList qparams)
+ {
+ if (name.StartsWith ("Q_"))
+ name = name.Replace ("Q_", "");
+ string comma = "";
+ if (qparams.Count != 0) comma = ", ";
+ if (id != "0")
+ return "\n"+tab+tab+"private static extern "+returntype+" qt_"+type+"_"+name+id+" (IntPtr raw"+comma+Params(qparams)+");";
+ else
+ return "\n"+tab+tab+"private static extern "+returntype+" qt_"+type+"_"+name+" (IntPtr raw"+comma+Params(qparams)+");";
+ }
+
+ public string StaticImportMethodCall (string type, string name, string id, string returntype, ArrayList qparams)
+ {
+ if (name.StartsWith ("Q_"))
+ name = name.Replace ("Q_", "");
+ if (id != "0")
+ return "\n"+tab+tab+"private static extern "+returntype+" qt_"+type+"_"+name+id+" ("+Params(qparams)+");";
+ else
+ return "\n"+tab+tab+"private static extern "+returntype+" qt_"+type+"_"+name+" ("+Params(qparams)+");";
+ }
+
+ public string RawObject (string name, string id, ArrayList qparams)
+ {
+ if (qtype.IsQObject) {
+ ArrayList newparams = new ArrayList ();
+
+ foreach (QParam parm in qparams) {
+ //Console.WriteLine ("--> {0}", parm.Name);
+ if (parm.Name == "parent.RawObject") {
+ QParam newparm = parm.Clone() as QParam;
+ newparm.Name = "parent != null ? parent.RawObject : IntPtr.Zero";
+ newparams.Add (newparm);
+ }
+ else
+ newparams.Add (parm);
+ }
+
+ if (id != "0")
+ return tab+tab+tab+"rawObject = qt_new_"+name+id+" ("+Params(newparams)+");";
+ else
+ return tab+tab+tab+"rawObject = qt_new_"+name+" ("+Params(newparams)+");";
+ }
+ else {
+ if (id != "0")
+ return tab+tab+tab+"rawObject = qt_new_"+name+id+" ("+Params(qparams)+");";
+ else
+ return tab+tab+tab+"rawObject = qt_new_"+name+" ("+Params(qparams)+");";
+ }
+ }
+
+ public string DCtorCall {
+ get {
+ return tab+tab+tab+"Dispose (false);";
+ }
+ }
+
+ public string MethodCall (bool qstring, bool boxer, string type, string name, string instPtr, string id, string ReturnType, ArrayList qparams)
+ {
+ if (name.StartsWith ("Q_"))
+ name = name.Replace ("Q_", "");
+
+ string ret = "";
+ string comma = qparams.Count == 0 ? "" : ", ";
+ string newid = id == "0" ? "" : id;
+
+ if (boxer && qstring) {
+ ret = "\t\t\treturn new QString (qt_"+type+"_"+name+newid+" ("+instPtr+comma+Params (qparams)+"));\n";
+ }
+ else if (boxer) {
+ ret = "\t\t\treturn LookupObject (qt_"+type+"_"+name+newid+" ("+instPtr+comma+Params (qparams)+"), typeof ("+ReturnType+")) as "+ReturnType+";";
+ }
+ else {
+ ret = "qt_"+type+"_"+name+newid+" ("+instPtr+comma+Params (qparams)+");";
+
+ if (ReturnType != "void")
+ ret = "return " + ret;
+
+ ret = "\t\t\t" + ret;
+ }
+
+ return ret;
+ }
+
+ public string StaticMethodCall (bool qstring, bool boxer, string type, string name, string id, string ReturnType, ArrayList qparams)
+ {
+ if (name.StartsWith ("Q_"))
+ name = name.Replace ("Q_", "");
+
+ string ret;
+ string newid = id == "0" ? "" : id;
+
+ if (boxer && qstring) {
+ ret = "\t\t\treturn new QString (qt_"+type+"_"+name+newid+" ("+Params (qparams)+"));\n";
+ }
+ else if (boxer) {
+ ret = "\t\t\treturn LookupObject (qt_"+type+"_"+name+newid+" ("+Params (qparams)+"), typeof ("+ReturnType+")) as "+ReturnType+";\n";
+ }
+ else {
+ ret = "qt_"+type+"_"+name+newid+" ("+Params (qparams)+");";
+
+ if (ReturnType != "void")
+ ret = "return " + ret;
+
+ ret = "\t\t\t" + ret;
+ }
+
+ return ret;
+ }
+
+ public string ImportAttrib
+ {
+ get {return "\n\n"+tab+tab+"[DllImport(\"libqtc\", CharSet=CharSet.Ansi)]";}
+ }
+
+ public string Import () {
+ if (!qtype.IsInterface) {
+ return tab + "using System.Runtime.InteropServices;\n\n";
+ } else {
+ return "\n";
+ }
+ }
+
+ public string Header
+ {
+ get {
+ return "// "+qtype.Name+".cs - A Qt to C# binding.\n" +
+ "//\n" +
+ "// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)\n" +
+ "//\n" +
+ "// This program is free software; you can redistribute it and/or\n" +
+ "// modify it under the terms of the GNU General Public License\n" +
+ "// as published by the Free Software Foundation; either version 2\n" +
+ "// of the License, or (at your option) any later version.\n" +
+ "//\n" +
+ "// This program is distributed in the hope that it will be useful,\n" +
+ "// but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +
+ "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" +
+ "// GNU General Public License for more details.\n" +
+ "//\n" +
+ "// You should have received a copy of the GNU General Public License\n" +
+ "// along with this program; if not, write to the Free Software\n" +
+ "// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n" +
+ "//\n" +
+ "// Generated File. Do Not Modify.\n" +
+ "\n" +
+ "namespace Qt {\n" +
+ "\n" +
+ tab + "using Qt;\n" +
+ tab + "using System;\n" + Import ();
+ }
+ }
+
+ public string Footer
+ {
+ get {return "\n}";}
+ }
+
+ public string Register
+ {
+ get
+ {
+ return "\n"+tab+tab+tab+"RegisterObject (this);";
+ }
+ }
+
+ public string Delete ()
+ {
+
+ string ret = "\n" +
+ "\t\tinternal override void Delete ()\n" +
+ "\t\t{\n";
+
+ // Let Qt manage QEvents
+ if (! (qtype.Name.StartsWith ("Q") && qtype.Name.EndsWith ("Event")))
+ {
+ ret += "\t\t\tif (deleted) return;\n\n";
+
+ if (qtype.QDCtors.Count > 0)
+ ret += "\t\t\tqt_del_"+qtype.Name+" (rawObject);\n";
+ else
+ ret = "\n" + ret + "\t\t\t// libqtc lacks a qt_del_"+qtype.Name+" function\n";
+
+ ret += "\t\t\tdeleted = true;\n";
+ }
+
+ ret += "\t\t}";
+
+ return ret;
+
+ }
+
+ public string DefaultConnections ()
+ {
+ if (qtype.IsQObject)
+ return "\n\t\t\tConnect (this, SIGNAL (\"destroyed ()\"), SLOT (\"NativeDestroyed ()\"));";
+ else
+ return "";
+ }
+ }
+}
diff --git a/qtsharp/src/generator/QAncestor.cs b/qtsharp/src/generator/QAncestor.cs
new file mode 100644
index 00000000..5467a902
--- /dev/null
+++ b/qtsharp/src/generator/QAncestor.cs
@@ -0,0 +1,26 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+
+namespace QtCSharp {
+
+ public class QAncestor : QType {
+
+ }
+}
diff --git a/qtsharp/src/generator/QCtor.cs b/qtsharp/src/generator/QCtor.cs
new file mode 100644
index 00000000..880bf13b
--- /dev/null
+++ b/qtsharp/src/generator/QCtor.cs
@@ -0,0 +1,47 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+//using System.IO;
+using System.Collections;
+
+namespace QtCSharp {
+
+ public class QCtor : QMember{
+
+ bool dummy, parent, inherited;
+
+ public bool Dummy
+ {
+ get {return dummy;}
+ set {dummy = value;}
+ }
+
+ public bool Parent
+ {
+ get {return parent;}
+ set {parent = value;}
+ }
+
+ public bool Inherited
+ {
+ get {return inherited;}
+ set {inherited = value;}
+ }
+ }
+}
diff --git a/qtsharp/src/generator/QDCtor.cs b/qtsharp/src/generator/QDCtor.cs
new file mode 100644
index 00000000..8aef33c0
--- /dev/null
+++ b/qtsharp/src/generator/QDCtor.cs
@@ -0,0 +1,57 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+//using System.IO;
+using System.Collections;
+
+namespace QtCSharp {
+
+ public class QDCtor {
+
+ string name, access;
+ ArrayList qparams;
+
+ public QDCtor()
+ {
+ qparams = new ArrayList();
+ }
+
+ public void AddQParam(QParam qparam)
+ {
+ qparams.Add(qparam);
+ }
+
+ public string Name
+ {
+ get {return name;}
+ set {name = value;}
+ }
+
+ public string Access
+ {
+ get {return access;}
+ set {access = value;}
+ }
+
+ public ArrayList QParams
+ {
+ get {return qparams;}
+ }
+ }
+}
diff --git a/qtsharp/src/generator/QEnum.cs b/qtsharp/src/generator/QEnum.cs
new file mode 100644
index 00000000..1be81b41
--- /dev/null
+++ b/qtsharp/src/generator/QEnum.cs
@@ -0,0 +1,63 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+//using System.IO;
+using System.Collections;
+
+namespace QtCSharp {
+
+ public class QEnum {
+
+ string name, access, type;
+ ArrayList qitems;
+
+ public QEnum()
+ {
+ qitems = new ArrayList();
+ }
+
+ public void AddQItem(QItem qitem)
+ {
+ qitems.Add(qitem);
+ }
+
+ public string Name
+ {
+ get {return name;}
+ set {name = value;}
+ }
+
+ public string Access
+ {
+ get {return access;}
+ set {access = value;}
+ }
+
+ public string Type
+ {
+ get {return type;}
+ set {type = value;}
+ }
+
+ public ArrayList QItems
+ {
+ get {return qitems;}
+ }
+ }
+}
diff --git a/qtsharp/src/generator/QItem.cs b/qtsharp/src/generator/QItem.cs
new file mode 100644
index 00000000..22e23c63
--- /dev/null
+++ b/qtsharp/src/generator/QItem.cs
@@ -0,0 +1,44 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+//using System.IO;
+
+namespace QtCSharp {
+
+ public class QItem {
+
+ string name, qvalue;
+
+ public QItem()
+ {
+ }
+
+ public string Name
+ {
+ get {return name;}
+ set {name = value;}
+ }
+
+ public string Value
+ {
+ get {return qvalue;}
+ set {qvalue = value;}
+ }
+ }
+}
diff --git a/qtsharp/src/generator/QMember.cs b/qtsharp/src/generator/QMember.cs
new file mode 100644
index 00000000..95c00280
--- /dev/null
+++ b/qtsharp/src/generator/QMember.cs
@@ -0,0 +1,116 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+using System.IO;
+using System.Collections;
+
+namespace QtCSharp {
+
+ public class QMember {
+
+ string name, access, id;
+ bool overload, throttle, boxer;
+ ArrayList pinvokeparams, pinvokecallparams, csharpparams, overloadparams;
+
+ public QMember()
+ {
+ pinvokeparams = new ArrayList();
+ pinvokecallparams = new ArrayList();
+ csharpparams = new ArrayList();
+ overloadparams = new ArrayList();
+ }
+
+
+ public void AddPinvokeParam(QParam pinvokeparam)
+ {
+ pinvokeparams.Add(pinvokeparam);
+ }
+
+ public void AddPinvokeCallParam(QParam pinvokecallparam)
+ {
+ pinvokecallparams.Add(pinvokecallparam);
+ }
+
+ public void AddCSharpParam(QParam csharpparam)
+ {
+ csharpparams.Add(csharpparam);
+ }
+
+ public void AddOverloadParam(QParam overloadparam)
+ {
+ overloadparams.Add(overloadparam);
+ }
+
+ public string Name
+ {
+ get {return name;}
+ set {name = value;}
+ }
+
+ public string Access
+ {
+ get {return access;}
+ set {access = value;}
+ }
+
+ public bool Overload
+ {
+ get {return overload;}
+ set {overload = value;}
+ }
+
+ public string Id
+ {
+ get {return id;}
+ set {id = value;}
+ }
+
+ public bool Throttle
+ {
+ get {return throttle;}
+ set {throttle = value;}
+ }
+
+ public bool Boxer
+ {
+ get {return boxer;}
+ set {boxer = value;}
+ }
+
+ public ArrayList PinvokeParams
+ {
+ get {return pinvokeparams;}
+ }
+
+ public ArrayList PinvokeCallParams
+ {
+ get {return pinvokecallparams;}
+ }
+
+ public ArrayList CSharpParams
+ {
+ get {return csharpparams;}
+ }
+
+ public ArrayList OverloadParams
+ {
+ get {return overloadparams;}
+ }
+ }
+}
diff --git a/qtsharp/src/generator/QMethod.cs b/qtsharp/src/generator/QMethod.cs
new file mode 100644
index 00000000..6bd6eebd
--- /dev/null
+++ b/qtsharp/src/generator/QMethod.cs
@@ -0,0 +1,54 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+//using System.IO;
+using System.Collections;
+
+namespace QtCSharp {
+
+ public class QMethod : QMember {
+
+ bool qstringreturn;
+ string returntype, pinvokereturn, pascalname;
+
+ public string Return
+ {
+ get {return returntype;}
+ set {returntype = value;}
+ }
+
+ public string PinvokeReturn
+ {
+ get {return pinvokereturn;}
+ set {pinvokereturn = value;}
+ }
+
+ public bool QStringReturn
+ {
+ get {return qstringreturn;}
+ set {qstringreturn = value;}
+ }
+
+ public string PascalName
+ {
+ get {return pascalname;}
+ set {pascalname = value;}
+ }
+ }
+}
diff --git a/qtsharp/src/generator/QParam.cs b/qtsharp/src/generator/QParam.cs
new file mode 100644
index 00000000..53212bad
--- /dev/null
+++ b/qtsharp/src/generator/QParam.cs
@@ -0,0 +1,54 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+//using System.IO;
+
+namespace QtCSharp {
+
+ public class QParam: ICloneable {
+
+ string type, name, defaultvalue;
+
+ public QParam()
+ {}
+
+ public object Clone()
+ {
+ return MemberwiseClone();
+ }
+
+ public string Type
+ {
+ get {return type;}
+ set {type = value;}
+ }
+
+ public string Name
+ {
+ get {return name;}
+ set {name = value;}
+ }
+
+ public string Default
+ {
+ get {return defaultvalue;}
+ set {defaultvalue = value;}
+ }
+ }
+}
diff --git a/qtsharp/src/generator/QType.cs b/qtsharp/src/generator/QType.cs
new file mode 100644
index 00000000..16ba8f56
--- /dev/null
+++ b/qtsharp/src/generator/QType.cs
@@ -0,0 +1,126 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+//using System.IO;
+using System.Collections;
+
+namespace QtCSharp {
+
+ public class QType {
+
+ string name, access, iname;
+ bool isInterface, isConverted, isQObject;
+ ArrayList qancestors, qenums, qctors, qdctors, qmethods;
+
+ public QType ()
+ {
+ qancestors = new ArrayList ();
+ qenums = new ArrayList ();
+ qctors = new ArrayList ();
+ qdctors = new ArrayList ();
+ qmethods = new ArrayList ();
+ }
+
+ public void AddQAncestor (QAncestor qancestor)
+ {
+ qancestors.Add (qancestor);
+ }
+
+ public void AddQEnum (QEnum qenum)
+ {
+ qenums.Add (qenum);
+ }
+
+ public void AddQCtor (QCtor qctor)
+ {
+ qctors.Add (qctor);
+ }
+
+ public void AddQDCtor (QDCtor qdctor)
+ {
+ qdctors.Add (qdctor);
+ }
+
+ public void AddQMethod (QMethod qmethod)
+ {
+ qmethods.Add (qmethod);
+ }
+
+ public string Name
+ {
+ get {return name;}
+ set {name = value;}
+ }
+
+ public string Access
+ {
+ get {return access;}
+ set {access = value;}
+ }
+
+ public bool IsInterface
+ {
+ get {return isInterface;}
+ set {isInterface = value;}
+ }
+
+ public bool IsConverted
+ {
+ get {return isConverted;}
+ set {isConverted = value;}
+ }
+
+ public bool IsQObject {
+ get { return isQObject; }
+ set { isQObject = value; }
+ }
+
+ public string IName
+ {
+ get {return iname;}
+ set {iname = value;}
+ }
+
+ public ArrayList QAncestors
+ {
+ get {return qancestors;}
+ }
+
+ public ArrayList QEnums
+ {
+ get {return qenums;}
+ }
+
+ public ArrayList QCtors
+ {
+ get {return qctors;}
+ }
+
+ public ArrayList QDCtors
+ {
+ get {return qdctors;}
+ }
+
+ public ArrayList QMethods
+ {
+ get {return qmethods;}
+ set {qmethods = value;}
+ }
+ }
+}
diff --git a/qtsharp/src/generator/QTypeMap.cs b/qtsharp/src/generator/QTypeMap.cs
new file mode 100644
index 00000000..241dc825
--- /dev/null
+++ b/qtsharp/src/generator/QTypeMap.cs
@@ -0,0 +1,477 @@
+// A Qt to C# binding generator.
+//
+// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+using System;
+using System.Collections;
+
+namespace QtCSharp {
+
+ public class QTypeMap {
+
+ Hashtable arraymap, mastermap, pinvoketypes, pinvokecalltypes, csharptypes, overloadtypes, reserved, interfaces;
+
+ public QTypeMap ()
+ {
+ arraymap = new Hashtable ();
+ arraymap.Add ("void*", "int[]");
+ arraymap.Add ("void *", "int[]");
+ arraymap.Add ("int*", "int[]");
+ arraymap.Add ("int *", "int[]");
+ arraymap.Add ("double*", "double[]");
+ arraymap.Add ("double *", "double[]");
+ arraymap.Add ("short*", "short[]");
+ arraymap.Add ("short *", "short[]");
+ arraymap.Add ("char**", "string[]");
+ arraymap.Add ("char **", "string[]");
+ arraymap.Add ("char*", "string");
+ arraymap.Add ("uchar**", "string[]");
+ arraymap.Add ("uchar **", "string[]");
+
+ mastermap = new Hashtable ();
+ mastermap.Add ("void", "void");
+ // mastermap.Add ("QByteArray", "byte[]");
+ mastermap.Add ("QBitArray", "byte[]");
+ mastermap.Add ("uchar", "string");
+ mastermap.Add ("unsigned int", "uint");
+ mastermap.Add ("unsigned short", "ushort");
+ mastermap.Add ("unsigned long", "ulong");
+ mastermap.Add ("unsigned char", "string");
+ mastermap.Add ("HANDLE", "uint");
+ mastermap.Add ("HBITMAP", "uint");
+ mastermap.Add ("HCURSOR", "uint");
+ mastermap.Add ("HDC", "uint");
+ mastermap.Add ("HFONT", "uint");
+ mastermap.Add ("HPALETTE", "uint");
+ mastermap.Add ("HRGN", "uint");
+ mastermap.Add ("Display", "IntPtr");
+ mastermap.Add ("Q_REFCOUNT bool", "bool");
+ mastermap.Add ("EventRef", "IntPtr");
+ mastermap.Add ("MSG", "IntPtr");
+ mastermap.Add ("XEvent", "IntPtr");
+ mastermap.Add ("QWSEvent", "IntPtr");
+ mastermap.Add ("GDHandle", "IntPtr");
+ mastermap.Add ("QRgb", "int");
+ mastermap.Add ("QWSDecoration", "IntPtr");
+ mastermap.Add ("QTextParag", "IntPtr");
+ mastermap.Add ("Qt.HANDLE", "IntPtr");
+ mastermap.Add ("QUObject", "IntPtr");
+ mastermap.Add ("QGfx", "IntPtr");
+ mastermap.Add ("QRESULT", "long");
+ mastermap.Add ("QUnknownInterface", "IntPtr");
+ mastermap.Add ("QPtrCollection.Item", "int");
+ mastermap.Add ("type", "IntPtr");
+ mastermap.Add ("array_data", "IntPtr");
+ mastermap.Add ("bitarr_data", "IntPtr");
+ mastermap.Add ("Offset", "int");
+ mastermap.Add ("Q_INT16", "short");
+ mastermap.Add ("Q_INT32", "int");
+ mastermap.Add ("Q_INT8", "char");
+ mastermap.Add ("Q_LONG", "long");
+ mastermap.Add ("Q_PACKED", "uint");
+ mastermap.Add ("Q_UINT16", "ushort");
+ mastermap.Add ("Q_UINT32", "uint");
+ mastermap.Add ("Q_UINT8", "char");
+ mastermap.Add ("Q_ULONG", "long");
+ mastermap.Add ("QStyleHintReturn", "IntPtr");
+ mastermap.Add ("QFileInfoList", "IntPtr");
+ mastermap.Add ("QDomNodePrivate", "IntPtr");
+ mastermap.Add ("GUID", "System.Guid");
+ mastermap.Add ("FILE", "string");
+ mastermap.Add ("EncoderFn", "int");
+ mastermap.Add ("DecoderFn", "int");
+ mastermap.Add ("QDiskFont", "IntPtr");
+ mastermap.Add ("pointer", "IntPtr");
+ mastermap.Add ("T", "IntPtr");
+ mastermap.Add ("T1", "IntPtr");
+ mastermap.Add ("T2", "IntPtr");
+ mastermap.Add ("Iterator", "IntPtr");
+ mastermap.Add ("iterator", "IntPtr");
+ mastermap.Add ("_iterator", "IntPtr");
+ mastermap.Add ("reference", "IntPtr");
+ mastermap.Add ("_reference", "IntPtr");
+ mastermap.Add ("ConstIterator", "int");
+ mastermap.Add ("QWSDisplay", "IntPtr");
+ mastermap.Add ("CGContextRef", "IntPtr");
+ mastermap.Add ("WId", "uint");
+ mastermap.Add ("QWidgetMapper", "IntPtr");
+ mastermap.Add ("size_type", "int");
+ mastermap.Add ("Item", "IntPtr");
+ mastermap.Add ("image_io_handler", "int");
+ mastermap.Add ("QCOORD", "short");
+ mastermap.Add ("key_type", "IntPtr");
+ mastermap.Add ("K", "IntPtr");
+ mastermap.Add ("NodePtr", "int");
+ mastermap.Add ("QTextFormat", "IntPtr");
+ mastermap.Add ("QTextDocument", "IntPtr");
+ mastermap.Add ("QTextCursor", "IntPtr");
+ mastermap.Add ("_NPStream", "IntPtr");
+ mastermap.Add ("PID", "long");
+ mastermap.Add ("Region", "int");
+ mastermap.Add ("RgnHandle", "IntPtr");
+ mastermap.Add ("QRemoteInterface", "IntPtr");
+ mastermap.Add ("mode_t", "int");
+ mastermap.Add ("QSqlFieldInfo", "IntPtr");
+ mastermap.Add ("QSqlRecordInfo", "IntPtr");
+ mastermap.Add ("QSqlRecordPrivate", "IntPtr");
+ mastermap.Add ("QTSMFI", "int");
+ mastermap.Add ("Widget", "QWidget");
+ mastermap.Add ("WidgetClass", "int");
+ mastermap.Add ("ArgList", "int");
+ mastermap.Add ("Cardinal", "int");
+ mastermap.Add ("XrmOptionDescRec", "IntPtr");
+ mastermap.Add ("size_t", "int");
+ mastermap.Add ("ULONG_MAX", "UInt64.MaxValue");
+
+ // Enums
+ mastermap.Add ("Event", "QAccessible.Event");
+ mastermap.Add ("Role", "QAccessible.Role");
+ mastermap.Add ("NavDirection", "QAccessible.NavDirection");
+ mastermap.Add ("Text", "QAccessible.Text");
+ mastermap.Add ("ColorSpec", "QApplication.ColorSpec");
+ mastermap.Add ("ToggleState", "QButton.ToggleState");
+ mastermap.Add ("RttiValues", "QCanvasItem.RttiValues");
+ mastermap.Add ("FrameAnimationType", "QCanvasSprite.FrameAnimationType");
+ mastermap.Add ("Category", "QChar.Category");
+ mastermap.Add ("Decomposition", "QChar.Decomposition");
+ mastermap.Add ("Joining", "QChar.Joining");
+ mastermap.Add ("CombiningClass", "QChar.CombiningClass");
+ mastermap.Add ("Spec", "QColor.Spec");
+ mastermap.Add ("ColorRole", "QColorGroup.ColorRole");
+ mastermap.Add ("Boundary", "QDataBrowser.Boundary");
+ mastermap.Add ("ByteOrder", "QDataStream.ByteOrder");
+ mastermap.Add ("Refresh", "QDataTable.Refresh");
+ mastermap.Add ("Order", "QDateEdit.Order");
+ mastermap.Add ("DialogCode", "QDialog.DialogCode");
+ mastermap.Add ("FilterSpec", "QDir.FilterSpec");
+ mastermap.Add ("SortSpec", "QDir.SortSpec");
+ mastermap.Add ("RecordType", "QDns.RecordType");
+ mastermap.Add ("HandlePosition", "QDockArea.HandlePosition");
+ mastermap.Add ("Place", "QDockWindow.Place");
+ mastermap.Add ("CloseMode", "QDockWindow.CloseMode");
+ mastermap.Add ("NodeType", "QDomNode.NodeType");
+ mastermap.Add ("DragMode", "QDragObject.DragMode");
+ mastermap.Add ("Action", "QDropEvent.Action");
+ mastermap.Add ("ViewMode", "QFileDialog.ViewMode");
+ mastermap.Add ("PreviewMode", "QFileDialog.PreviewMode");
+ mastermap.Add ("PermissionSpec", "QFileInfo.PermissionSpec");
+ mastermap.Add ("StyleStrategy", "QFont.StyleStrategy");
+ mastermap.Add ("Weight", "QFont.Weight");
+ mastermap.Add ("Script", "QFont.Script");
+ mastermap.Add ("Shadow", "QFrame.Shadow");
+ mastermap.Add ("FormatOption", "QGL.FormatOption");
+ mastermap.Add ("Corner", "QGridLayout.Corner");
+ mastermap.Add ("Size", "QIconSet.Size");
+ mastermap.Add ("Arrangement", "QIconView.Arrangement");
+ mastermap.Add ("ItemTextPos", "QIconView.ItemTextPos");
+ mastermap.Add ("Endian", "QImage.Endian");
+ mastermap.Add ("ScaleMode", "QImage.ScaleMode");
+ mastermap.Add ("PaintDeviceFlags", "QInternal.PaintDeviceFlags");
+ mastermap.Add ("Rules", "QJpUnicodeConv.Rules");
+ mastermap.Add ("SegmentStyle", "QLCDNumber.SegmentStyle");
+ mastermap.Add ("LayoutMode", "QListBox.LayoutMode");
+ mastermap.Add ("WidthMode", "QListView.WidthMode");
+ mastermap.Add ("RenameAction", "QListView.RenameAction");
+ mastermap.Add ("DockWindows", "QMainWindow.DockWindows");
+ mastermap.Add ("Color", "QMapNodeBase.Color");
+ mastermap.Add ("Separator", "QMenuBar.Separator");
+ mastermap.Add ("Icon", "QMessageBox.Icon");
+ mastermap.Add ("Access", "QMetaData.Access");
+ mastermap.Add ("Flags", "QMetaProperty.Flags");
+ mastermap.Add ("Status", "QMovie.Status");
+ mastermap.Add ("InstanceMode", "QNPInstance.InstanceMode");
+ mastermap.Add ("StreamMode", "QNPInstance.StreamMode");
+ mastermap.Add ("Operation", "QNetworkProtocol.Operation");
+ mastermap.Add ("ConnectionState", "QNetworkProtocol.ConnectionState");
+ mastermap.Add ("DisposalMethod", "QPNGImageWriter.DisposalMethod");
+ mastermap.Add ("PDevCmd", "QPaintDevice.PDevCmd");
+ mastermap.Add ("CoordinateMode", "QPainter.CoordinateMode");
+ mastermap.Add ("TextDirection", "QPainter.TextDirection");
+ mastermap.Add ("ColorGroup", "QPalette.ColorGroup");
+ mastermap.Add ("Optimization", "QPixmap.Optimization");
+ mastermap.Add ("Edge", "QPolygonScanner.Edge");
+ mastermap.Add ("PrinterMode", "QPrinter.PrinterMode");
+ mastermap.Add ("PageSize", "QPrinter.PageSize");
+ mastermap.Add ("PageOrder", "QPrinter.PageOrder");
+ mastermap.Add ("PaperSource", "QPrinter.PaperSource");
+ mastermap.Add ("Communication", "QProcess.Communication");
+ mastermap.Add ("RegionType", "QRegion.RegionType");
+ mastermap.Add ("ResizePolicy", "QScrollView.ResizePolicy");
+ mastermap.Add ("ScrollBarMode", "QScrollView.ScrollBarMode");
+ mastermap.Add ("RestartHint", "QSessionManager.RestartHint");
+ mastermap.Add ("System", "QSettings.System");
+ mastermap.Add ("SizeType", "QSizePolicy.SizeType");
+ mastermap.Add ("ExpandData", "QSizePolicy.ExpandData");
+ mastermap.Add ("TickSetting", "QSlider.TickSetting");
+ mastermap.Add ("Op", "QSql.Op");
+ mastermap.Add ("Location", "QSql.Location");
+ mastermap.Add ("Confirm", "QSql.Confirm");
+ mastermap.Add ("DriverFeature", "QSqlDriver.DriverFeature");
+ mastermap.Add ("SectionFlags", "QString.SectionFlags");
+ mastermap.Add ("PrimitiveElement", "QStyle.PrimitiveElement");
+ mastermap.Add ("StyleFlags", "QStyle.StyleFlags");
+ mastermap.Add ("SFlags", "QStyle.StyleFlags");
+ mastermap.Add ("ControlElement", "QStyle.ControlElement");
+ mastermap.Add ("SubRect", "QStyle.SubRect");
+ mastermap.Add ("ComplexControl", "QStyle.ComplexControl");
+ mastermap.Add ("SubControl", "QStyle.SubControl");
+ mastermap.Add ("SCFlags", "QStyle.SubControl");
+ mastermap.Add ("PixelMetric", "QStyle.PixelMetric");
+ mastermap.Add ("ContentsType", "QStyle.ContentsType");
+ mastermap.Add ("StylePixmap", "QStyle.StylePixmap");
+ mastermap.Add ("StyleOptionDefault", "QStyleOption.StyleOptionDefault");
+ mastermap.Add ("AdditionalStyleValues", "QStyleSheetItem.AdditionalStyleValues");
+ mastermap.Add ("DisplayMode", "QStyleSheetItem.DisplayMode");
+ mastermap.Add ("WhiteSpaceMode", "QStyleSheetItem.WhiteSpaceMode");
+ mastermap.Add ("Margin", "QStyleSheetItem.Margin");
+ mastermap.Add ("ListStyle", "QStyleSheetItem.ListStyle");
+ mastermap.Add ("FocusStyle", "QTable.FocusStyle");
+ mastermap.Add ("EditMode", "QTable.EditMode");
+ mastermap.Add ("EditType", "QTableItem.EditType");
+ mastermap.Add ("TabletDevice", "QTabletEvent.TabletDevice");
+ mastermap.Add ("KeyboardAction", "QTextEdit.KeyboardAction");
+ mastermap.Add ("CursorAction", "QTextEdit.CursorAction");
+ mastermap.Add ("SaveMode", "QTranslator.SaveMode");
+ mastermap.Add ("Prefix", "QTranslatorMessage.Prefix");
+ mastermap.Add ("FocusPolicy", "QWidget.FocusPolicy");
+ mastermap.Add ("BackgroundOrigin", "QWidget.BackgroundOrigin");
+ mastermap.Add ("ButtonState", "Qt.ButtonState");
+ mastermap.Add ("AlignmentFlags", "Qt.AlignmentFlags");
+ mastermap.Add ("TextFlags", "Qt.TextFlags");
+ mastermap.Add ("WidgetState", "Qt.WidgetState");
+ mastermap.Add ("WState", "Qt.WidgetState");
+ mastermap.Add ("WidgetFlags", "Qt.WidgetFlags");
+ mastermap.Add ("WFlags", "Qt.WidgetFlags");
+ mastermap.Add ("ImageConversionFlags", "Qt.ImageConversionFlags");
+ mastermap.Add ("BGMode", "Qt.BGMode");
+ mastermap.Add ("PaintUnit", "Qt.PaintUnit");
+ mastermap.Add ("GUIStyle", "Qt.GUIStyle");
+ mastermap.Add ("Modifier", "Qt.Modifier");
+ mastermap.Add ("Key", "Qt.Key");
+ mastermap.Add ("ArrowType", "Qt.ArrowType");
+ mastermap.Add ("RasterOp", "Qt.RasterOp");
+ mastermap.Add ("PenStyle", "Qt.PenStyle");
+ mastermap.Add ("PenCapStyle", "Qt.PenCapStyle");
+ mastermap.Add ("PenJoinStyle", "Qt.PenJoinStyle");
+ mastermap.Add ("BrushStyle", "Qt.BrushStyle");
+ mastermap.Add ("WindowsVersion", "Qt.WindowsVersion");
+ mastermap.Add ("UIEffect", "Qt.UIEffect");
+ mastermap.Add ("CursorShape", "Qt.CursorShape");
+ mastermap.Add ("TextFormat", "Qt.TextFormat");
+ mastermap.Add ("Dock", "Qt.Dock");
+ mastermap.Add ("DateFormat", "Qt.DateFormat");
+ mastermap.Add ("BackgroundMode", "Qt.BackgroundMode");
+ mastermap.Add ("StringComparisonMode", "Qt.StringComparisonMode");
+ mastermap.Add ("ComparisonFlags", "Qt.StringComparisonMode");
+
+ // We need to make sure all params use the interfaces, ie IQPaintDevice
+ /*mastermap.Add ("QAccessibleFactoryInterface", "IQAccessibleFactory");
+ mastermap.Add ("QAccessibleInterface", "IQAccessible");*/
+ mastermap.Add ("QPaintDevice", "IQPaintDevice");
+ /*mastermap.Add ("QMenuData", "IQMenuData");
+ mastermap.Add ("QRangeControl", "IQRangeControl");
+ mastermap.Add ("QMimeSource", "IQMimeSource");
+ mastermap.Add ("QLayoutItem", "IQLayoutItem");
+ mastermap.Add ("QUrl", "IQUrl");
+ mastermap.Add ("QIODevice", "IQIODevice");
+ mastermap.Add ("QXmlContentHandler", "IQXmlContentHandler");
+ mastermap.Add ("QXmlErrorHandler", "IQXmlErrorHandler");
+ mastermap.Add ("QXmlDTDHandler", "IQXmlDTDHandler");
+ mastermap.Add ("QXmlEntityResolver", "IQXmlEntityResolver");
+ //mastermap.Add ("QXmlLexicalHandler", "IQXmlLexicalHandler");
+ mastermap.Add ("QXmlDeclHandler", "IQXmlDeclHandler");
+ mastermap.Add ("QwAbsSpriteFieldView", "IQwAbsSpriteFieldView");
+ mastermap.Add ("QSqlQuery", "IQSqlQuery");
+ mastermap.Add ("QFeatureListInterface", "IQFeatureList");
+ mastermap.Add ("QUnknownInterface", "IQUnknown");
+ mastermap.Add ("QShared", "IQShared");*/
+
+ // Key Duplication
+ //mastermap.Add ("Direction", "QBoxLayout.Direction");
+ //mastermap.Add ("Direction", "QChar.Direction");
+ //mastermap.Add ("Reason", "QContextMenuEvent.Reason");
+ //mastermap.Add ("Reason", "QFocusEvent.Reason");
+ //mastermap.Add ("Reason", "QNPInstance.Reason");
+ //mastermap.Add ("Mode", "QFileDialog.Mode");
+ //mastermap.Add ("Mode", "QIconSet.Mode");
+ //mastermap.Add ("Mode", "QLCDNumber.Mode");
+ //mastermap.Add ("Mode", "QSqlCursor.Mode");
+ //mastermap.Add ("Shape", "QFrame.Shape");
+ //mastermap.Add ("Shape", "QTabBar.Shape");
+ //mastermap.Add ("KeyType", "QGCache.KeyType");
+ //mastermap.Add ("KeyType", "QGDict.KeyType");
+ //mastermap.Add ("State", "QAccessible.State");
+ //mastermap.Add ("State", "QNetworkProtocol.State");
+ //mastermap.Add ("State", "QSocket.State");
+ //mastermap.Add ("State", "QValidator.State");
+ //mastermap.Add ("ResizeMode", "QIconView.ResizeMode");
+ //mastermap.Add ("ResizeMode", "QLayout.ResizeMode");
+ //mastermap.Add ("ResizeMode", "QListView.ResizeMode");
+ //mastermap.Add ("ResizeMode", "QListView.ResizeMode");
+ //mastermap.Add ("EchoMode", "QLineEdit.EchoMode");
+ //mastermap.Add ("EchoMode", "QtMultiLineEdit.EchoMode");
+ //mastermap.Add ("ColorMode", "QApplication.ColorMode");
+ //mastermap.Add ("ColorMode", "QPrinter.ColorMode");
+ //mastermap.Add ("ColorMode", "QPixmap.ColorMode");
+ //mastermap.Add ("SelectionMode", "QIconView.SelectionMode");
+ //mastermap.Add ("SelectionMode", "QListBox.SelectionMode");
+ //mastermap.Add ("SelectionMode", "QListView.SelectionMode");
+ //mastermap.Add ("SelectionMode", "QTable.SelectionMode");
+ //mastermap.Add ("Error", "QSocket.Error");
+ //mastermap.Add ("Error", "QSocketDevice.Error");
+ //mastermap.Add ("Error", "QNetworkProtocol.Error");
+ //mastermap.Add ("ButtonSymbols", "QSpinBox.ButtonSymbols");
+ //mastermap.Add ("ButtonSymbols", "QSpinWidget.ButtonSymbols");
+ //mastermap.Add ("StyleHint", "QStyle.StyleHint");
+ //mastermap.Add ("StyleHint", "QFont.StyleHint");
+ //mastermap.Add ("Encoding", "QApplication.Encoding");
+ //mastermap.Add ("Encoding", "QTextStream.Encoding");
+ //mastermap.Add ("VerticalAlignment", "QTextEdit.VerticalAlignment");
+ //mastermap.Add ("VerticalAlignment", "QStyleSheetItem.VerticalAlignment");
+ //mastermap.Add ("Orientation", "QPrinter.Orientation");
+ //mastermap.Add ("Orientation", "Qt.Orientation");
+ //mastermap.Add ("WrapPolicy", "QTextEdit.WrapPolicy");
+ //mastermap.Add ("WrapPolicy", "QtMultiLineEdit.WrapPolicy");
+ //mastermap.Add ("WordWrap", "QTextEdit.WordWrap");
+ //mastermap.Add ("WordWrap", "QtMultiLineEdit.WordWrap");
+
+ // These are here in case we need to override the mastermap
+ pinvoketypes = new Hashtable ();
+ pinvokecalltypes = new Hashtable ();
+ csharptypes = new Hashtable ();
+ overloadtypes = new Hashtable ();
+
+ // These are reserved keywords.
+ reserved = new Hashtable ();
+ reserved.Add ("lock", "Q_lock");
+ reserved.Add ("object", "Q_object");
+ reserved.Add ("ref", "Q_ref");
+ reserved.Add ("base", "Q_base");
+ reserved.Add ("string", "Q_string");
+ reserved.Add ("const", "Q_const");
+ reserved.Add ("event", "Q_event");
+
+ // The allowed interfaces
+ interfaces = new Hashtable ();
+ interfaces.Add ("QAccessibleFactoryInterface", "IQAccessibleFactory");
+ interfaces.Add ("QAccessibleInterface", "IQAccessible");
+ interfaces.Add ("QPaintDevice", "IQPaintDevice");
+ interfaces.Add ("QMenuData", "IQMenuData");
+ interfaces.Add ("QRangeControl", "IQRangeControl");
+ interfaces.Add ("QMimeSource", "IQMimeSource");
+ interfaces.Add ("QLayoutItem", "IQLayoutItem");
+ interfaces.Add ("QUrl", "IQUrl");
+ interfaces.Add ("QIODevice", "IQIODevice");
+ interfaces.Add ("QXmlContentHandler", "IQXmlContentHandler");
+ interfaces.Add ("QXmlErrorHandler", "IQXmlErrorHandler");
+ interfaces.Add ("QXmlDTDHandler", "IQXmlDTDHandler");
+ interfaces.Add ("QXmlEntityResolver", "IQXmlEntityResolver");
+ //interfaces.Add ("QXmlLexicalHandler", "IQXmlLexicalHandler");
+ interfaces.Add ("QXmlDeclHandler", "IQXmlDeclHandler");
+ interfaces.Add ("QwAbsSpriteFieldView", "IQwAbsSpriteFieldView");
+ interfaces.Add ("QSqlQuery", "IQSqlQuery");
+ interfaces.Add ("QFeatureListInterface", "IQFeatureList");
+ interfaces.Add ("QUnknownInterface", "IQUnknown");
+ interfaces.Add ("QShared", "IQShared");
+ }
+
+ public string PinvokeType (string str)
+ {
+ if ((string)mastermap[str] != null)
+ if((string)pinvoketypes[(string)mastermap[str]] != null)
+ return (string)pinvoketypes[(string)mastermap[str]];
+ else
+ return (string)mastermap[str];
+ else if ((string)pinvoketypes[str] != null)
+ return (string)pinvoketypes[str];
+ else
+ return str;
+ }
+
+ public string PinvokeCallType (string str)
+ {
+
+ if ((string)mastermap[str] != null)
+ if((string)pinvokecalltypes[(string)mastermap[str]] != null)
+ return (string)pinvokecalltypes[(string)mastermap[str]];
+ else
+ return (string)mastermap[str];
+ else if ((string)pinvokecalltypes[str] != null)
+ return (string)pinvokecalltypes[str];
+ else
+ return str;
+ }
+
+ public string CSharpType (string str)
+ {
+ if ((string)mastermap[str] != null)
+ if((string)csharptypes[(string)mastermap[str]] != null)
+ return (string)csharptypes[(string)mastermap[str]];
+ else
+ return (string)mastermap[str];
+ else if ((string)csharptypes[str] != null)
+ return (string)csharptypes[str];
+ else
+ return str;
+ }
+
+ public string OverloadType (string str)
+ {
+ if ((string)mastermap[str] != null)
+ if((string)overloadtypes[(string)mastermap[str]] != null)
+ return (string)overloadtypes[(string)mastermap[str]];
+ else
+ return (string)mastermap[str];
+ else if ((string)overloadtypes[str] != null)
+ return (string)overloadtypes[str];
+ else
+ return str;
+ }
+
+ public string ArrayType (string str)
+ {
+ if ((string)arraymap[str] != null)
+ return (string)arraymap[str];
+ else
+ return str;
+ }
+
+ public string ReservedType (string str)
+ {
+ if ((string)reserved[str] != null)
+ return (string)reserved[str];
+ else
+ return str;
+ }
+
+ public string ReturnType (string str)
+ {
+ if ((string)reserved[str] != null)
+ return (string)reserved[str];
+ else
+ return str;
+ }
+
+ public string InterfaceType (string str)
+ {
+ if ((string)interfaces[str] != null)
+ return (string)interfaces[str];
+ else
+ return str;
+ }
+ }
+}
diff --git a/qtsharp/src/generator/generator.build b/qtsharp/src/generator/generator.build
new file mode 100644
index 00000000..dd703536
--- /dev/null
+++ b/qtsharp/src/generator/generator.build
@@ -0,0 +1,15 @@
+<?xml version="1.0">
+<project name="Qt# Binding Generator" default="all">
+ <target name="all">
+ <compile output="generator.exe" target="exe" optimize="true">
+ <references>
+ <file name="System.Xml" />
+ <file name="System" />
+ </references>
+
+ <sources>
+ <includes name="*.cs" />
+ </sources>
+ </compile>
+ </target>
+</project>