File indexing completed on 2023-10-01 08:02:06
0001 /* 0002 SPDX-FileCopyrightText: 2007-2008 Thomas Gallinari <tg8187@yahoo.fr> 0003 SPDX-FileCopyrightText: 2007-2008 Nathalie Liesse <nathalie.liesse@gmail.com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef KAPMANPARSER_H 0009 #define KAPMANPARSER_H 0010 0011 #include "game.h" 0012 0013 #include <QXmlStreamAttributes> 0014 0015 /** 0016 * @brief This class handles XML reader events in order to initialize the Maze properties. 0017 */ 0018 class KapmanParser 0019 { 0020 private: 0021 /** The Game to initialize */ 0022 Game *m_game; 0023 0024 /** The parser's buffer */ 0025 QString m_buffer; 0026 0027 /** The rows counter */ 0028 int m_counterRows; 0029 0030 public: 0031 /** 0032 * Creates a new GameParser. 0033 * @param p_game the Game to initialize 0034 */ 0035 explicit KapmanParser(Game *p_game); 0036 0037 /** 0038 * Deletes the GameParser instance. 0039 */ 0040 ~KapmanParser(); 0041 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 0042 bool characters(const QStringRef &ch); 0043 0044 bool startElement(const QStringRef &namespaceURI, const QStringRef &localName, const QStringRef &qName, const QXmlStreamAttributes &atts); 0045 0046 bool endElement(const QStringRef &namespaceURI, const QStringRef &localName, const QStringRef &qName); 0047 #else 0048 bool characters(const QStringView &ch); 0049 0050 bool startElement(const QStringView &namespaceURI, const QStringView &localName, const QStringView &qName, const QXmlStreamAttributes &atts); 0051 0052 bool endElement(const QStringView &namespaceURI, const QStringView &localName, const QStringView &qName); 0053 #endif 0054 bool parse(QIODevice *input); 0055 }; 0056 0057 #endif