view host/SimpleXMLRuleLoader.h @ 3:86914ea77b7b

* start simple xml rule file loading
author cannam
date Fri, 03 Nov 2006 16:40:46 +0000
parents
children b30fcffc5000
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;

    std::map<int, int> m_externalInternalIndexMap;

//    Rule m_currentRule;
};

#endif