view host/SimpleXMLRuleLoader.h @ 17:3cbd40805795 tip

Remove obsolete stuff from README
author Chris Cannam
date Tue, 03 Dec 2013 16:33:08 +0000
parents b30fcffc5000
children
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */


#ifndef _SIMPLE_XML_RULE_LOADER_H_
#define _SIMPLE_XML_RULE_LOADER_H_

#include <QXmlDefaultHandler>
#include <QXmlParseException>
#include <QXmlAttributes>
#include <QString>

#include "Processor.h"

class SimpleXMLRuleLoader : public QXmlDefaultHandler
{
public:
    SimpleXMLRuleLoader();

    QString getErrorString() const { return m_errorString; }

    bool loadFile(Processor &processor, QString fileName);
    bool loadXml(Processor &processor, const QString &xmlData);
    bool loadXml(Processor &processor, QXmlInputSource &source);

    virtual bool startElement(const QString &namespaceURI,
			      const QString &localName,
			      const QString &qName,
			      const QXmlAttributes& atts);

    virtual bool characters(const QString &);

    virtual bool endElement(const QString &namespaceURI,
			    const QString &localName,
			    const QString &qName);

    bool error(const QXmlParseException &exception);
    bool fatalError(const QXmlParseException &exception);

protected:
    QString m_errorString;
    Processor *m_processor;

    bool m_inPlugins;
    bool m_inRules;
    bool m_inRule;

    Rule *m_rule;

    std::map<int, int> m_externalInternalIndexMap;
};

#endif