File indexing completed on 2024-04-21 04:32:14

0001 /*
0002  * Copyright (C) 2010-2015 by Stephen Allewell
0003  * steve.allewell@gmail.com
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2 of the License, or
0008  * (at your option) any later version.
0009  */
0010 
0011 #ifndef SchemeParser_H
0012 #define SchemeParser_H
0013 
0014 #include <QMap>
0015 #include <QStack>
0016 #include <QString>
0017 #include <QXmlDefaultHandler>
0018 
0019 class FlossScheme;
0020 
0021 class SchemeParser : public QXmlDefaultHandler
0022 {
0023 public:
0024     SchemeParser();
0025 
0026     FlossScheme *flossScheme();
0027     virtual bool startDocument() Q_DECL_OVERRIDE;
0028     virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &, const QXmlAttributes &qxmlAttributes) Q_DECL_OVERRIDE;
0029     virtual bool characters(const QString &d) Q_DECL_OVERRIDE;
0030     virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName) Q_DECL_OVERRIDE;
0031     virtual QString errorString() const Q_DECL_OVERRIDE;
0032 
0033 private:
0034     int m_errorCode;
0035     FlossScheme *m_scheme;
0036     QMap<QString, QString> m_flossMap;
0037     QStack<QString> m_elements;
0038 };
0039 
0040 #endif // SchemeParser_H