1 | /* |
2 | * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr> |
3 | * Copyright 2007-2008 Nathalie Liesse <nathalie.liesse@gmail.com> |
4 | * |
5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License as |
7 | * published by the Free Software Foundation; either version 2 of |
8 | * the License, or (at your option) any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ |
18 | |
19 | #ifndef KAPMANPARSER_H |
20 | #define KAPMANPARSER_H |
21 | |
22 | #include "game.h" |
23 | |
24 | #include <QXmlDefaultHandler> |
25 | |
26 | /** |
27 | * @brief This class handles XML reader events in order to initialize the Maze properties. |
28 | */ |
29 | class KapmanParser : public QXmlDefaultHandler { |
30 | |
31 | private: |
32 | |
33 | /** The Game to initialize */ |
34 | Game * m_game; |
35 | |
36 | /** The parser's buffer */ |
37 | QString m_buffer; |
38 | |
39 | /** The rows counter */ |
40 | int m_counterRows; |
41 | public: |
42 | |
43 | /** |
44 | * Creates a new GameParser. |
45 | * @param p_game the Game to initialize |
46 | */ |
47 | KapmanParser(Game* p_game); |
48 | |
49 | /** |
50 | * Deletes the GameParser instance. |
51 | */ |
52 | ~KapmanParser(); |
53 | |
54 | /** |
55 | * Implement QXmlDefaultHandler::characters |
56 | */ |
57 | bool characters(const QString & ch ); |
58 | |
59 | /** |
60 | * Implements QXmlDefaultHandler::startElement() |
61 | */ |
62 | bool startElement(const QString&, const QString&, const QString& p_qName, const QXmlAttributes& p_atts); |
63 | |
64 | /** |
65 | * Implements QXmlDefaultHandler::endElement() |
66 | */ |
67 | bool endElement(const QString &, const QString &, const QString & p_qName ); |
68 | |
69 | }; |
70 | |
71 | #endif |
72 | |
73 | |