File indexing completed on 2024-04-28 07:51:04

0001 /*
0002     SPDX-FileCopyrightText: 2008 Mathias Kraus <k.hias@gmx.de>
0003     SPDX-FileCopyrightText: 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
0004     SPDX-FileCopyrightText: 2007-2008 Nathalie Liesse <nathalie.liesse@gmail.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef MAPPARSER_H
0010 #define MAPPARSER_H
0011 #include <QXmlStreamAttributes>
0012 class Arena;
0013 
0014 /**
0015  * @brief This class handles XML reader events in order to initialize the Arena properties.
0016  */
0017 class MapParser
0018 {
0019 
0020 private:
0021 
0022     /** The Game to initialize */
0023     Arena* m_arena;
0024 
0025     /** The parser's buffer */
0026     QString m_buffer;
0027 
0028     /** The rows counter */
0029     int m_counterRows;
0030 public:
0031 
0032     /**
0033       * Creates a new GameParser.
0034       * @param p_arena the Arena to initialize
0035       */
0036     explicit MapParser(Arena* p_arena);
0037 
0038     /**
0039       * Deletes the GameParser instance.
0040       */
0041     ~MapParser();
0042 
0043     Q_REQUIRED_RESULT bool characters(const QStringView &ch);
0044 
0045     Q_REQUIRED_RESULT bool startElement(const QStringView &namespaceURI, const QStringView &localName,
0046                       const QStringView &qName, const QXmlStreamAttributes &atts);
0047 
0048     Q_REQUIRED_RESULT bool endElement(const QStringView &namespaceURI,
0049                     const QStringView &localName, const QStringView &qName);
0050 
0051     Q_REQUIRED_RESULT bool parse(QIODevice *input);
0052 };
0053 
0054 #endif
0055