d952d533c10f840ae57a25dab080c2855c1bd93d
[dorian] / dorian / containerhandler.h
1 #ifndef CONTAINERHANDLER_H
2 #define CONTAINERHANDLER_H
3
4 #include <QXmlContentHandler>
5 #include <QString>
6
7 /** XML content handler for EPUB container format. */
8 class ContainerHandler: public QXmlContentHandler
9 {
10 public:
11     bool endDocument() {return true;}
12     bool endPrefixMapping(const QString &) {return true;}
13     QString errorString() const {return "";}
14     bool ignorableWhitespace(const QString &) {return true;}
15     bool processingInstruction(const QString &, const QString &) {
16         return true;
17     }
18     void setDocumentLocator(QXmlLocator *) {}
19     bool skippedEntity(const QString &) {return true;}
20     bool startDocument() {return true;}
21     bool startPrefixMapping(const QString &, const QString &) {return true;}
22     bool characters(const QString &) {return true;}
23     bool endElement(const QString &, const QString &, const QString &) {
24         return true;
25     }
26
27     bool startElement(const QString &namespaceUri, const QString &name,
28                       const QString &qName, const QXmlAttributes &attrs)
29     {
30         (void)namespaceUri;
31         (void)qName;
32         if (name == "rootfile") {
33             rootFile = attrs.value("full-path");
34         }
35         return true;
36     }
37
38     QString rootFile;
39 };
40
41 #endif // CONTAINERHANDLER_H