00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef XMLMAPREADER_H
00020 #define XMLMAPREADER_H
00021
00022 #include <QFile>
00023 #include <QXmlDefaultHandler>
00024 #include "kockpitmap.h"
00025 #include "kockpitunit.h"
00026 #include "kockpitunitmappings.h"
00027 #include "attributemap.h"
00028
00030
00033 class XMLMapReader : public QObject, public QXmlDefaultHandler {
00034
00035 Q_OBJECT
00036
00037 public:
00038
00040
00044 XMLMapReader(KockpitMap* kmap, QObject *parent = 0);
00045
00047 virtual ~XMLMapReader(){ }
00048
00050
00056 bool readFile(const QString &fileName);
00057
00058 protected:
00059
00061
00070 bool startElement(const QString &namespaceURI,
00071 const QString &localName,
00072 const QString &qName,
00073 const QXmlAttributes &atts);
00074
00076
00084 bool endElement(const QString &namespaceURI,
00085 const QString &localName,
00086 const QString &qName);
00087
00089
00095 bool characters(const QString &ch);
00096
00098
00103 bool fatalError(const QXmlParseException &exception);
00104
00106
00111 attrmode toAttrMode(const QString &mode);
00112
00113 private:
00115 KockpitMap *kmap;
00117 QString currentText;
00119 objtype type;
00120 };
00121
00122 Q_DECLARE_METATYPE(XMLMapReader*);
00123
00124 #endif // XMLMAPREADER_H