NCL Composer  0.1.5
 All Classes Functions Variables Pages
NCLParser.h
1 /*
2  * Copyright 2011 TeleMidia/PUC-Rio.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see
16  * <http://www.gnu.org/licenses/>.
17  */
18 #ifndef NCLSAXHANDLER_H
19 #define NCLSAXHANDLER_H
20 
21 #include <QtXml>
22 
23 #include <QList>
24 #include <QtGui>
25 #include <QMessageBox>
26 #include <NCLTreeWidget.h>
27 
28 class NCLTreeWidget;
29 
30 class NCLParser : public QObject, public QXmlDefaultHandler {
31  Q_OBJECT
32 
33 public:
34  NCLParser(NCLTreeWidget *tree);
35  bool startElement(const QString &namespaceURI,
36  const QString &localName,
37  const QString &qName,
38  const QXmlAttributes &attributes);
39  bool endElement(const QString &namespaceURI,
40  const QString &localName,
41  const QString &qName);
42  bool characters(const QString &str);
43  bool fatalError(const QXmlParseException &exception);
44  void setDocumentLocator(QXmlLocator *locator);
45 
46 private:
47  NCLTreeWidget *treeWidget;
48  QTreeWidgetItem *currentItem;
49  QString currentText;
50  QXmlLocator *locator;
51 
52 signals:
53  void fatalErrorFound ( QString message,
54  QString file,
55  int line,
56  int column,
57  int severity);
58 };
59 #endif