]> git.sven.stormbind.net Git - sven/vym.git/blob - src/xml-base.h
New upstream version 2.9.22
[sven/vym.git] / src / xml-base.h
1 #ifndef XML_BASE
2 #define XML_BASE
3
4 //#include <QString>
5 #include <QXmlAttributes>
6
7 #include "file.h"
8
9 class VymModel;
10
11 /*! \brief Base class for parsing maps from XML documents */
12
13 class parseBaseHandler : public QXmlDefaultHandler {
14   public:
15     parseBaseHandler();
16     ~parseBaseHandler();
17     QString errorProtocol();
18     QString parseHREF(QString);
19     virtual bool startElement(const QString &, const QString &,
20                               const QString &eName,
21                               const QXmlAttributes &atts) = 0;
22     virtual bool endElement(const QString &, const QString &,
23                             const QString &) = 0;
24     virtual bool characters(const QString &) = 0;
25
26     virtual QString errorString() = 0;
27     bool fatalError(const QXmlParseException &);
28     void setModel(VymModel *);
29     void setTmpDir(QString);
30     void setInputFile(const QString &);
31     void setInputString(const QString &);
32     void setLoadMode(const LoadMode &, int p = -1);
33     bool readHtmlAttr(const QXmlAttributes &);
34
35   protected:
36     QString errorProt;
37
38     LoadMode loadMode;
39     int insertPos;
40
41     bool isVymPart;
42     int branchDepth;
43     VymModel *model;
44     QString tmpDir;
45     QString inputFile;
46     QString inputString;
47     QString htmldata;
48     QString version;
49 };
50 #endif