diff options
Diffstat (limited to 'qtsharp/src/generator/Parser.cs')
-rw-r--r-- | qtsharp/src/generator/Parser.cs | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/qtsharp/src/generator/Parser.cs b/qtsharp/src/generator/Parser.cs index cea811d3..1639b4b6 100644 --- a/qtsharp/src/generator/Parser.cs +++ b/qtsharp/src/generator/Parser.cs @@ -26,21 +26,21 @@ namespace QtCSharp { public class Parser { XmlTextReader xtr; - QType qtype; + TQType qtype; public Parser (string xmlFragment) { - qtype = new QType (); + qtype = new TQType (); 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 (); + NewTQCtors (); } - public QType GetQType () + public TQType GetTQType () { return qtype; } @@ -51,22 +51,22 @@ namespace QtCSharp { if (xtr.NodeType != XmlNodeType.EndElement) { switch (xtr.Name) { case "qtype": - ParseQType (); + ParseTQType (); continue; case "qancestor": - ParseQAncestor (); + ParseTQAncestor (); continue; case "qenum": - ParseQEnum (); + ParseTQEnum (); continue; case "qctor": - ParseQCtor (); + ParseTQCtor (); continue; case "qdctor": - ParseQDCtor (); + ParseTQDCtor (); continue; case "qmethod": - ParseQMethod (); + ParseTQMethod (); continue; default: continue; @@ -75,91 +75,91 @@ namespace QtCSharp { } } - public void NewQCtors () + public void NewTQCtors () { // A ctor for inherited classes - QCtor _qctor = new QCtor(); + TQCtor _qctor = new TQCtor(); _qctor.Name = qtype.Name; _qctor.Access = "internal"; _qctor.Inherited = true; - qtype.AddQCtor(_qctor); + qtype.AddTQCtor(_qctor); // A ctor for type boxing - QCtor __qctor = new QCtor(); + TQCtor __qctor = new TQCtor(); __qctor.Name = qtype.Name; __qctor.Access = "internal"; __qctor.Boxer = true; - QParam qparam = new QParam(); + TQParam qparam = new TQParam(); qparam.Type = "IntPtr"; qparam.Name = "_ptr"; __qctor.AddCSharpParam(qparam); - qtype.AddQCtor(__qctor); + qtype.AddTQCtor(__qctor); // A dummy ctor - QCtor ___qctor = new QCtor(); + TQCtor ___qctor = new TQCtor(); ___qctor.Name = qtype.Name; ___qctor.Access = "internal"; ___qctor.Dummy = true; - QParam ___qparam = new QParam(); - ___qparam.Type = "QNull"; + TQParam ___qparam = new TQParam(); + ___qparam.Type = "TQNull"; ___qparam.Name = "dummy"; ___qctor.AddCSharpParam(___qparam); - qtype.AddQCtor(___qctor); + qtype.AddTQCtor(___qctor); } public void OverLoad () { ArrayList additions = new ArrayList (); - foreach (QCtor qctor in qtype.QCtors){ - foreach (QParam pinvokeparam in qctor.PinvokeParams) { + foreach (TQCtor qctor in qtype.TQCtors){ + foreach (TQParam pinvokeparam in qctor.PinvokeParams) { if (pinvokeparam.Default != null) { - QCtor _qctor = new QCtor(); + TQCtor _qctor = new TQCtor(); _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.AddPinvokeParam((TQParam)qctor.PinvokeParams[j]); + _qctor.AddPinvokeCallParam((TQParam)qctor.PinvokeCallParams[j]); + _qctor.AddCSharpParam((TQParam)qctor.CSharpParams[j]); + _qctor.AddOverloadParam((TQParam) (( TQParam) qctor.CSharpParams[j]).Clone()); } _qctor.CSharpParams.RemoveAt(_qctor.CSharpParams.Count-1); - //qtype.AddQCtor(_qctor); + //qtype.AddTQCtor(_qctor); additions.Add (_qctor); } } } - foreach (QCtor ctor in additions) qtype.AddQCtor (ctor); + foreach (TQCtor ctor in additions) qtype.AddTQCtor (ctor); additions = new ArrayList (); - foreach (QMethod qmethod in qtype.QMethods){ - foreach (QParam pinvokeparam in qmethod.PinvokeParams) { + foreach (TQMethod qmethod in qtype.TQMethods){ + foreach (TQParam pinvokeparam in qmethod.PinvokeParams) { if (pinvokeparam.Default != null) { - QMethod _qmethod = new QMethod(); + TQMethod _qmethod = new TQMethod(); _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.AddPinvokeParam((TQParam)qmethod.PinvokeParams[j]); + _qmethod.AddPinvokeCallParam((TQParam)qmethod.PinvokeCallParams[j]); + _qmethod.AddCSharpParam((TQParam)qmethod.CSharpParams[j]); + _qmethod.AddOverloadParam((TQParam) ((TQParam) qmethod.CSharpParams[j]).Clone()); } _qmethod.CSharpParams.RemoveAt(_qmethod.CSharpParams.Count-1); - //qtype.AddQMethod(_qmethod); + //qtype.AddTQMethod(_qmethod); additions.Add (_qmethod); } } } - foreach (QMethod method in additions) qtype.AddQMethod (method); + foreach (TQMethod method in additions) qtype.AddTQMethod (method); } - public void ParseQType () + public void ParseTQType () { if (xtr.MoveToAttribute("name")) { qtype.Name = xtr.Value; @@ -170,27 +170,27 @@ namespace QtCSharp { } } - public void ParseQAncestor () + public void ParseTQAncestor () { - QAncestor qancestor = new QAncestor(); + TQAncestor qancestor = new TQAncestor(); if (xtr.MoveToAttribute("name")) { qancestor.Name = xtr.Value; } - qtype.AddQAncestor(qancestor); + qtype.AddTQAncestor(qancestor); } - public void ParseQEnum () + public void ParseTQEnum () { bool match = false; - QEnum qenum = new QEnum(); + TQEnum qenum = new TQEnum(); 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); + TQItem qitem = ParseTQItem(); + qenum.AddTQItem(qitem); long parse = 0; try { parse = Int64.Parse(qitem.Value); @@ -203,13 +203,13 @@ namespace QtCSharp { break; } } - qtype.AddQEnum(qenum); + qtype.AddTQEnum(qenum); } - public void ParseQCtor () + public void ParseTQCtor () { bool IsEmpty = xtr.IsEmptyElement; - QCtor qctor = new QCtor(); + TQCtor qctor = new TQCtor(); if (xtr.MoveToAttribute("name")) { qctor.Name = xtr.Value; } @@ -222,22 +222,22 @@ namespace QtCSharp { if (!IsEmpty) { while (xtr.Read()) { if (xtr.Name == "qparam") { - qctor.AddPinvokeParam(ParseQParam()); - qctor.AddPinvokeCallParam(ParseQParam()); - qctor.AddCSharpParam(ParseQParam()); + qctor.AddPinvokeParam(ParseTQParam()); + qctor.AddPinvokeCallParam(ParseTQParam()); + qctor.AddCSharpParam(ParseTQParam()); } else if (xtr.Name == ""){ } else { break; } } } - qtype.AddQCtor(qctor); + qtype.AddTQCtor(qctor); } - public void ParseQDCtor () + public void ParseTQDCtor () { bool IsEmpty = xtr.IsEmptyElement; - QDCtor qdctor = new QDCtor(); + TQDCtor qdctor = new TQDCtor(); if (xtr.MoveToAttribute("name")) { qdctor.Name = xtr.Value; } @@ -247,20 +247,20 @@ namespace QtCSharp { if (!IsEmpty) { while (xtr.Read()) { if (xtr.Name == "qparam") { - qdctor.AddQParam(ParseQParam()); + qdctor.AddTQParam(ParseTQParam()); } else if (xtr.Name == "") { } else { break; } } } - qtype.AddQDCtor(qdctor); + qtype.AddTQDCtor(qdctor); } - public void ParseQMethod () + public void ParseTQMethod () { bool IsEmpty = xtr.IsEmptyElement; - QMethod qmethod = new QMethod(); + TQMethod qmethod = new TQMethod(); if (xtr.MoveToAttribute("name")) { qmethod.Name = xtr.Value; } @@ -281,21 +281,21 @@ namespace QtCSharp { if (!IsEmpty) { while (xtr.Read()) { if (xtr.Name == "qparam") { - qmethod.AddPinvokeParam(ParseQParam()); - qmethod.AddPinvokeCallParam(ParseQParam()); - qmethod.AddCSharpParam(ParseQParam()); + qmethod.AddPinvokeParam(ParseTQParam()); + qmethod.AddPinvokeCallParam(ParseTQParam()); + qmethod.AddCSharpParam(ParseTQParam()); } else if (xtr.Name == ""){ } else { break; } } } - qtype.AddQMethod(qmethod); + qtype.AddTQMethod(qmethod); } - public QItem ParseQItem () + public TQItem ParseTQItem () { - QItem qitem = new QItem(); + TQItem qitem = new TQItem(); if (xtr.MoveToAttribute("name")) { qitem.Name = xtr.Value; } @@ -305,9 +305,9 @@ namespace QtCSharp { return qitem; } - public QParam ParseQParam () + public TQParam ParseTQParam () { - QParam qparam = new QParam(); + TQParam qparam = new TQParam(); if (xtr.MoveToAttribute("type")) { qparam.Type = xtr.Value; } |